-
Notifications
You must be signed in to change notification settings - Fork 3
Gene expression script
First version of CosmicDB adapter for retrieval of gene expression data and parallel calculation of average Z-scores. It uses mpi4py for parallel execution and pandas for indexing CSV tables.
Gene argument (-g --gene) can be provided as single name (Uniprot notation) or as path to file containing gene Uniprot IDs, every gene ID in a new line.
Tissue argument is always provided as a single name and all gene expressions are calculated for a single tissue sample.
- requirements: Python 2.7, mpi4py, pandas, requests
- setup COSMICDB_USER and COSMICDB_PASS environment variables
- download token has to be manually obtained from https://cancer.sanger.ac.uk/cosmic/download - it is valid for unknown period of time (48h - 14 days)
- default WORKING_DIR is ./genes/expressions/
Usage:
export COSMICDB_USER=<Cosmic email>
export COSMICDB_PASS=<Cosmic password>
Get expression data from CosmicDB:
python get_gene_expression_parallel.py -g <gene Uniprot ID or file path> -t <tissue name> -n <number of cores(for splitting CSV)>
Calculate average Z-score expression:
mpiexec -n <number of cores> python calculate_gene_expression.py -g <gene name or file path> -t <tissue_name> -o <path-to-output-file>
After execution of script get_gene_expression_parallel.py files generated in ./genes/expressions/ are not removed.
Batch download of expression data from a list in file:
python get_gene_expression_parallel.py -g <path-to--gene-list-file> -t <tissue name> -n <number of cores>
Example of batch download from CosmicDB:
python get_gene_expression_parallel.py -g ./genes/uniprot_entries_small.txt -t breast -n 12
Batch calculation of Z-scores for list of genes:
python batch_calculate_gene_expressions.py -g <path-to-gene-list-file> -t breast -o <path-to-csv-output> -n <number of cores>
Example:
python batch_calculate_gene_expressions.py -g ./genes/uniprot_entries_small.txt -t breast -o ./genes/expression_scores.csv -n 12