-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrunAgainstTCGA.py
More file actions
173 lines (160 loc) · 7.21 KB
/
runAgainstTCGA.py
File metadata and controls
173 lines (160 loc) · 7.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
from subprocess import *
import os
import multiprocessing as mp
tumors = ['ACC', 'BLCA', 'BRCA', 'CESC', 'CHOL', 'COAD', 'DLBC', 'ESCA', 'GBM', 'HNSC', 'KICH', 'KIRC', 'KIRP', 'LGG', 'LIHC', 'LUAD', 'LUSC', 'MESO', 'OV', 'PAAD', 'PCPG', 'PRAD', 'READ', 'SARC', 'SKCM', 'STAD', 'TGCT', 'THCA', 'THYM', 'UCEC', 'UCS', 'UVM']
#tumors = ['ACC']
# Run for each tumor type in TCGA
def runOncoMerge(tumor):
print(tumor)
# Make the output directory if it doesn't exists already
if not os.path.exists('TCGA/output/'+tumor):
os.mkdir('TCGA/output/'+tumor)
# Run first run with no filters
print('Running no_filter...')
cmd1 = ['python3 oncoMerge.py',
'-gp TCGA/GISTIC/'+tumor,
'-aaf TCGA/OncoMerge_input_g2e_converter.csv',
'-ln "Locus ID"',
'-pam TCGA/PAM/'+tumor+'_somMutMC3.csv',
'-mscv TCGA/MutSig2cv/'+tumor+'_sig2cv.csv',
'-fus TCGA/FUSIONS/'+tumor+'_fusions.csv',
'-op TCGA/output_11_4_2022/'+tumor+'/no_filter',
'-pq 1',
'-mlg 10000',
'-sp',
'-tcga True',
'-bl TCGA/blacklist/blacklist_29850653_29625053.csv']
print(' '.join(cmd1))
proc1 = Popen(' '.join(cmd1), shell=True, stdout=PIPE, stderr=PIPE)
out = proc1.communicate()
# Run with only permuted q-value
print('\nRunning pq...')
cmd2 = ['python3 oncoMerge.py',
'-gp TCGA/GISTIC/'+tumor,
'-aaf TCGA/OncoMerge_input_g2e_converter.csv',
'-ln "Locus ID"',
'-pam TCGA/PAM/'+tumor+'_somMutMC3.csv',
'-mscv TCGA/MutSig2cv/'+tumor+'_sig2cv.csv',
'-fus TCGA/FUSIONS/'+tumor+'_fusions.csv',
'-op TCGA/output_11_4_2022/'+tumor+'/pq',
'-pq 0.1',
'-mlg 10000',
'-lp TCGA/output_11_4_2022/'+tumor+'/no_filter',
'-tcga True',
'-bl TCGA/blacklist/blacklist_29850653_29625053.csv']
print(' '.join(cmd2))
proc2 = Popen(' '.join(cmd2), shell=True, stdout=PIPE, stderr=PIPE)
out = proc2.communicate()
# Run with maximum frequency filter
print('\nRunning mff...')
cmd3 = ['python3 oncoMerge.py',
'-gp TCGA/GISTIC/'+tumor,
'-aaf TCGA/OncoMerge_input_g2e_converter.csv',
'-ln "Locus ID"',
'-pam TCGA/PAM/'+tumor+'_somMutMC3.csv',
'-mscv TCGA/MutSig2cv/'+tumor+'_sig2cv.csv',
'-fus TCGA/FUSIONS/'+tumor+'_fusions.csv',
'-op TCGA/output_11_4_2022/'+tumor+'/mff',
'-pq 1',
'-mlg 10',
'-lp TCGA/output_11_4_2022/'+tumor+'/no_filter',
'-tcga True',
'-bl TCGA/blacklist/blacklist_29850653_29625053.csv']
print(' '.join(cmd3))
proc3 = Popen(' '.join(cmd3), shell=True, stdout=PIPE, stderr=PIPE)
out = proc3.communicate()
# Run with both filters
print('\nRunning pq_mff...')
cmd4 = ['python3 oncoMerge.py',
'-gp TCGA/GISTIC/'+tumor,
'-aaf TCGA/OncoMerge_input_g2e_converter.csv',
'-ln "Locus ID"',
'-pam TCGA/PAM/'+tumor+'_somMutMC3.csv',
'-mscv TCGA/MutSig2cv/'+tumor+'_sig2cv.csv',
'-fus TCGA/FUSIONS/'+tumor+'_fusions.csv',
'-op TCGA/output_11_4_2022/'+tumor+'/pq_mff',
'-pq 0.1',
'-mlg 10',
'-lp TCGA/output_11_4_2022/'+tumor+'/no_filter',
'-tcga True',
'-bl TCGA/blacklist/blacklist_29850653_29625053.csv']
print(' '.join(cmd4))
proc4 = Popen(' '.join(cmd4), shell=True, stdout=PIPE, stderr=PIPE)
out = proc4.communicate()
# Both filters + GISTIC threshold shallow
print('\nRunning pq_mff (GISTIC shallow)...')
cmd5 = ['python3 oncoMerge.py',
'-gp TCGA/GISTIC/'+tumor,
'-aaf TCGA/OncoMerge_input_g2e_converter.csv',
'-ln "Locus ID"',
'-pam TCGA/PAM/'+tumor+'_somMutMC3.csv',
'-mscv TCGA/MutSig2cv/'+tumor+'_sig2cv.csv',
'-fus TCGA/FUSIONS/'+tumor+'_fusions.csv',
'-op TCGA/output_11_4_2022/'+tumor+'/pq_mff_gt1',
'-pq 0.1',
'-mlg 10',
'-gt 1',
'-lp TCGA/output_11_4_2022/'+tumor+'/no_filter',
'-tcga True',
'-bl TCGA/blacklist/blacklist_29850653_29625053.csv']
proc5 = Popen(' '.join(cmd5), shell=True, stdout=PIPE, stderr=PIPE)
out = proc5.communicate()
# Both filters PQ options
for pq in [0.01, 0.05, 0.2]: # 0.1 is default
print('\nRunning pq_mff (pq theshold test) '+str(pq)+' ...')
cmd6 = ['python3 oncoMerge.py',
'-gp TCGA/GISTIC/'+tumor,
'-aaf TCGA/OncoMerge_input_g2e_converter.csv',
'-ln "Locus ID"',
'-pam TCGA/PAM/'+tumor+'_somMutMC3.csv',
'-mscv TCGA/MutSig2cv/'+tumor+'_sig2cv.csv',
'-fus TCGA/FUSIONS/'+tumor+'_fusions.csv',
'-op TCGA/output_11_4_2022/'+tumor+'/pq_mff_pq'+str(pq).replace('\.','_'),
'-pq '+str(pq),
'-mlg 10',
'-lp TCGA/output_11_4_2022/'+tumor+'/no_filter',
'-tcga True',
'-bl TCGA/blacklist/blacklist_29850653_29625053.csv']
proc6 = Popen(' '.join(cmd6), shell=True, stdout=PIPE, stderr=PIPE)
out = proc6.communicate()
# Both filters MMF options
for mmf in [0.01, 0.1, 0.2]: # 0.05 is default
print('\nRunning pq_mff (pq theshold test) '+str(pq)+' ...')
cmd7 = ['python3 oncoMerge.py',
'-gp TCGA/GISTIC/'+tumor,
'-aaf TCGA/OncoMerge_input_g2e_converter.csv',
'-ln "Locus ID"',
'-pam TCGA/PAM/'+tumor+'_somMutMC3.csv',
'-mscv TCGA/MutSig2cv/'+tumor+'_sig2cv.csv',
'-fus TCGA/FUSIONS/'+tumor+'_fusions.csv',
'-op TCGA/output_11_4_2022/'+tumor+'/pq_mff_mmf'+str(mmf).replace('\.','_'),
'-pq 0.1',
'-mlg 10',
'-mmf '+str(mmf),
'-lp TCGA/output_11_4_2022/'+tumor+'/no_filter',
'-tcga True',
'-bl TCGA/blacklist/blacklist_29850653_29625053.csv']
proc7 = Popen(' '.join(cmd7), shell=True, stdout=PIPE, stderr=PIPE)
out = proc7.communicate()
# Both filters MLG options
for mlg in [1, 5, 15, 20]: # 10 is default
print('\nRunning pq_mff (mlg test) '+str(mlg)+' ...')
cmd8 = ['python3 oncoMerge.py',
'-gp TCGA/GISTIC/'+tumor,
'-aaf TCGA/OncoMerge_input_g2e_converter.csv',
'-ln "Locus ID"',
'-pam TCGA/PAM/'+tumor+'_somMutMC3.csv',
'-mscv TCGA/MutSig2cv/'+tumor+'_sig2cv.csv',
'-fus TCGA/FUSIONS/'+tumor+'_fusions.csv',
'-op TCGA/output_11_4_2022/'+tumor+'/pq_mff_mlg'+str(mlg).replace('\.','_'),
'-pq 0.1',
'-mlg '+str(mlg),
'-lp TCGA/output_11_4_2022/'+tumor+'/no_filter',
'-tcga True',
'-bl TCGA/blacklist/blacklist_29850653_29625053.csv']
proc8 = Popen(' '.join(cmd8), shell=True, stdout=PIPE, stderr=PIPE)
out = proc8.communicate()
# Parallelize
pool = mp.Pool(15)
pool.map(runOncoMerge, tumors)
pool.close()