Skip to content

Commit 5d4882c

Browse files
committed
updated to allow for multiple drug files
1 parent f723463 commit 5d4882c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

build/build_all.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def main():
9191
### Drug matching scripts take a while
9292
### they are their own step and can be run independentyly, before others, or alongside sample/omics
9393
### DepMap/Sanger, MPNST, LINCS
94-
df=''
94+
dflist=[]
9595
if args.drugs or args.all:
9696
###build drug data
9797
for da in [a for a in datasets if a not in ['cptac','hcmi']]:
@@ -101,8 +101,8 @@ def main():
101101
di = da
102102

103103
if not os.path.exists('local/'+da+'_drugs.tsv'):
104-
run_cmd([di,'sh','build_drugs.sh',df],da+' drugs')
105-
df = '/tmp/'+da+'_drugs.tsv'
104+
run_cmd([di,'sh','build_drugs.sh',','.join(dflist)],da+' drugs')
105+
dflist = dflist.append('/tmp/'+da+'_drugs.tsv')
106106

107107
#### Any new omics files are created here.
108108
## depends on samples!

build/mpnst/02_get_drug_data.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (length(args) == 0) {
1919

2020
# Set your personal access token
2121
PAT <- args[1]
22-
olddrugfile <- args[2]
22+
olddrugfiles <- args[2]
2323
newdrugfile <- args[3]
2424
# Log in to Synapse
2525
synLogin(authToken = PAT)
@@ -71,7 +71,12 @@ alldrugs[which(alldrugs=='PD901')]<-'PD-0325901'
7171
print(paste(alldrugs,collapse=','))
7272

7373
##copy old drug to new drug
74-
file.copy(olddrugfile,newdrugfile)
74+
olddrugs<-do.call(rbind,lapply(unique(unlist(strsplit(olddrugfiles,split=','))),function(x) read.table(x)))
75+
olddrugs<-unique(olddrugs)
76+
77+
print(paste('Read in ',nrow(olddrugs),'old drugs'))
78+
#file.copy(olddrugfile,newdrugfile)
79+
write.table(olddrugs,file=newdrugfile,sep='\t')
7580
output_file_path <- newdrugfile
7681
ignore_file_path <- '/tmp/ignore_chems.txt'
7782

0 commit comments

Comments
 (0)