Skip to content

Commit f723463

Browse files
committed
update fit curve again
1 parent be3ccc7 commit f723463

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

build/beatAML/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ synapseclient
55
argparse
66
numpy
77
openpyxl
8+
matplotlib
9+
scikit-learn

build/broad_sanger/04-drug_dosage_and_curves.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import os
1414
import argparse
1515
import pandas as pd
16+
import subprocess
1617

1718
parser = argparse.ArgumentParser()
1819
parser.add_argument('--curSampleFile',dest='samplefile',default=None,help='DepMap sample file')
@@ -24,18 +25,18 @@
2425
samplefile = opts.samplefile
2526
drugfile = opts.dfile
2627

27-
cmd = '/opt/venv/bin/python 04b-nci60-updated.py --sampleFile '+samplefile+' --drugFile '+drugfile
28+
cmd = ['/opt/venv/bin/python 04b-nci60-updated.py','--sampleFile',samplefile,'--drugFile',drugfile]
2829
print(cmd)
29-
os.system(cmd)
30+
subprocess.run(cmd)
3031

3132
####step 4a - get dose response data
32-
cmd = 'Rscript 04a-drugResponseData.R '+samplefile+' '+drugfile+' CTRPv2,FIMM,GDSC'
33+
cmd = ['Rscript','04a-drugResponseData.R',samplefile,drugfile,'CTRPv2,FIMM,GDSC']
3334
print(cmd)
34-
os.system(cmd)
35+
subprocess.run(cmd)
3536

36-
cmd = 'Rscript 04a-drugResponseData.R '+samplefile+' '+drugfile+' gCSI,PRISM,CCLE'
37+
cmd = ['Rscript','04a-drugResponseData.R',samplefile,drugfile,'gCSI,PRISM,CCLE']
3738
print(cmd)
38-
os.system(cmd)
39+
subprocess.run(cmd)
3940

4041

4142
#cmd = 'Rscript 04a-drugResponseData.R '+samplefile+' '+drugfile+' NCI60'
@@ -46,7 +47,7 @@
4647
allfiles=[a for a in os.listdir('./') if 'DoseResponse' in a]
4748
print(allfiles)
4849
for a in allfiles:
49-
os.system('/opt/venv/bin/python fit_curve.py --input '+a+' --output '+a)
50+
subprocess.run(['/opt/venv/bin/python','fit_curve.py','--input='+a+,'--output='+a])
5051

5152
###step 4c concatenate all files
5253
outfiles = [a for a in os.listdir("./") if ".0" in a]

build/utils/fit_curve.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,10 @@ def process_df_part(df, fname, beataml=False, sep='\t', start=0, count=None):
162162
groups = df.groupby(cols)
163163
count = count or (4484081 - start)
164164
groups = islice(groups, start, start+count)
165-
166-
with multiprocessing.Pool(processes=multiprocessing.cpu_count()/4) as pool:
165+
cores = multiprocessing.cpu_count()
166+
poolsize = round(cores/2)
167+
print('we have '+str(cores)+' cores and '+str(poolsize)+' threads')
168+
with multiprocessing.Pool(processes=poolsize) as pool:
167169
results = pool.map(process_single_drug, groups)
168170

169171
with open(f'{fname}.{start}', 'w') as f:

0 commit comments

Comments
 (0)