Skip to content

Commit

Permalink
Merge pull request #6 from jjc2718/experiment_script
Browse files Browse the repository at this point in the history
Add script to run pancancer classification experiments
  • Loading branch information
jjc2718 authored Aug 7, 2020
2 parents d2047f8 + ba08abe commit 66ca105
Show file tree
Hide file tree
Showing 11 changed files with 1,409 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
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:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@

data/EBPlusPlusAdjustPANCAN_IlluminaHiSeq_RNASeqV2-v2.geneExp.tsv
data/*.gz
data/*.pkl

results/*
49 changes: 49 additions & 0 deletions 01_run_pancancer_classification.py
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)

Loading

0 comments on commit 66ca105

Please sign in to comment.