Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
68 additions
and
16 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import subprocess | ||
import os | ||
import glob | ||
import shutil | ||
import sys | ||
|
||
def run(cmd: str) -> None: | ||
subprocess.run(cmd, shell=True, check=True, stdout=sys.stdout) | ||
|
||
cohorts = ['SKCM', 'GBM', 'READ', 'ESCA', 'PAAD', 'SARC', | ||
'OV', 'KIRP', 'CESC', 'KIRC', 'LIHC', 'STAD', 'BLCA', | ||
'COAD', 'LUSC', 'HNSC', 'LGG', 'LUAD', 'UCEC', 'BRCA']] | ||
|
||
for cohort in cohorts: | ||
os.makedirs(f'{cohort}/samples', exist_ok=True) | ||
os.makedirs(f'{cohort}/compare_junctions/hist', exist_ok=True) | ||
bed_files = glob.glob(f'{cohort}*modified.bed') | ||
for bed_file in bed_files: | ||
shutil.copy(bed_file, f'{cohort}/{bed_file}') | ||
os.chdir(f'{cohort}/samples') | ||
run(f'aws s3 cp s3://regtools-results-unstranded/{cohort}/ . --recursive') | ||
tar_files = glob.glob('*.tar.gz') | ||
for tar_file in tar_files: | ||
run(f'tar xzf {tar_file}') | ||
os.remove(tar_file) | ||
run('rm -rf all*; rm -rf compare_junctions*') | ||
os.chdir('..') | ||
run('ls samples/ > dir_names.tsv') | ||
bed_files = glob.glob(f'*modified.bed') | ||
for bed_file in bed_files: | ||
tag = bed_file.split('_')[1] | ||
os.rename(bed_file, f'all_splicing_variants_{tag}.bed') | ||
run(f'python3 /home/ec2-user/workspace/regtools/scripts/stats_wrapper.py {tag}') | ||
run(f'Rscript --vanilla /home/ec2-user/workspace/regtools/scripts/filter_and_BH.R {tag}') | ||
run(f'aws s3 cp compare_junctions/ s3://regtools-results-unstranded/{cohort}/compare_junctions3/ --recursive)') | ||
os.chdir('..') | ||
shutil.rmtree(cohort) |
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