-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from jjc2718/experiment_script
Add script to run pancancer classification experiments
- Loading branch information
Showing
11 changed files
with
1,409 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: Python tests | ||
|
||
on: [push, pull_request] | ||
on: [pull_request] | ||
|
||
jobs: | ||
run-tests: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,6 @@ | |
|
||
data/EBPlusPlusAdjustPANCAN_IlluminaHiSeq_RNASeqV2-v2.geneExp.tsv | ||
data/*.gz | ||
data/*.pkl | ||
|
||
results/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
""" | ||
Script to run pancancer classification experiments, by calling classify_cancer_type.py | ||
with the corresponding arguments | ||
""" | ||
import os | ||
import sys | ||
import subprocess | ||
|
||
import pandas as pd | ||
from tqdm import tqdm | ||
|
||
import pancancer_utilities.config as cfg | ||
|
||
EXP_SCRIPT = os.path.join(cfg.repo_root, | ||
'pancancer_utilities', | ||
'scripts', | ||
'classify_cancer_type.py') | ||
|
||
# genes and cancer types to run experiments for | ||
# just hardcoding these for now, might choose them systematically later | ||
genes = ['TP53', 'PTEN', 'KRAS', 'BRAF', 'TTN'] | ||
cancer_types = ['BRCA', 'THCA', 'SKCM', 'GBM', 'SARC'] | ||
|
||
def run_single_experiment(gene, cancer_type, use_pancancer, | ||
shuffle_labels, verbose=False): | ||
args = [ | ||
'python', | ||
EXP_SCRIPT, | ||
'--gene', gene, | ||
'--holdout_cancer_type', cancer_type | ||
] | ||
if use_pancancer: | ||
args.append('--use_pancancer') | ||
if shuffle_labels: | ||
args.append('--shuffle_labels') | ||
|
||
if verbose: | ||
print('Running: {}'.format(' '.join(args))) | ||
subprocess.call(args) | ||
|
||
if __name__ == '__main__': | ||
|
||
for gene in tqdm(genes): | ||
for cancer_type in tqdm(cancer_types): | ||
run_single_experiment(gene, cancer_type, False, False) | ||
run_single_experiment(gene, cancer_type, True, False) | ||
run_single_experiment(gene, cancer_type, False, True) | ||
run_single_experiment(gene, cancer_type, True, True) | ||
|
Oops, something went wrong.