Skip to content

Commit dcb23fa

Browse files
committed
updated panc pdo files for proper DMSO control
DMSO is the last row of concentration values
1 parent 83b0e34 commit dcb23fa

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

build/pancpdo/04-getPancPDOExperiments.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,22 @@ def get_data(token):
9595

9696
##renormalize values to max
9797
##IMPORTANT: this is how we normalize without DMSO. We need to consider how we're doing this for EACH ORGANOID
98-
##currently we take the max value of each orgnaoid/replicate.
99-
rtab["MaxRep"] = rtab.groupby(['Drug','Organoid','Rep']).Response.transform('max')
100-
rtab['PercResponse'] = (rtab.Response/rtab.MaxRep)*100.00
98+
##currently we take the max value of each orgnaoid/replicate.
99+
##UPDATE: see belo
100+
# rtab["MaxRep"] = rtab.groupby(['Drug','Organoid','Rep']).Response.transform('max')
101+
# rtab['PercResponse'] = (rtab.Response/rtab.MaxRep)*100.00
101102

102103

103104
##dosenum isa dummy value to use for merging since we need to repeat the concentrations over and over
104105
dosenum = [a for a in range(15)]
105106
rtab['Dosenum']=dosenum*int(rtab.shape[0]/15)
106107

108+
##The last dose (dosenum ==14) is the control value per Herve. we now must normalize to that
109+
110+
dmso_vals = rtab[rtab.Dosenum==14][['Organoid','Drug','Rep','Response']].rename({'Response':'DMSO'},axis=1)
111+
full_res = rtab.merge(dmso_vals,on=['Organoid','Drug','Rep'])
112+
full_res['PercResponse'] = 100*(full_res.Response/full_res.DMSO)
113+
107114
#print(set(rtab.Drug))
108115
##merge the concentrations
109116
concs = concs.dropna().melt(value_vars=concs.columns,var_name='Drug',value_name='Dose')
@@ -114,7 +121,7 @@ def get_data(token):
114121
concs['Dosenum'] = dosenum*int(concs.shape[0]/15)##creating dosenum here to merge
115122
#print(set(concs.Drug))
116123

117-
return rtab.merge(concs)
124+
return full_res.merge(concs)
118125

119126
if __name__=='__main__':
120127
main()

0 commit comments

Comments
 (0)