num_cov = len(pred_df.columns) covariates = np.zeros((num_cov + 2,)) covariates[:num_cov] = covariates_df.values # loop over proteins to get values for current time step for p in node_list: pred_df.ix[time, p] = regGBR[stim][p].predict(covariates) # zero out covariate we are inhibiting, again pred_df.ix[time, test_inhib_targets[test_inhib]] = 0 pred_dict[test_inhib][stim] = pred_df out_path = 'results/sakev-{0}-{1}-Prediction'.format(cell_line, test_inhib) utilities.write_MIDAS(pred_dict[test_inhib], test_inhib_targets[test_inhib], out_path, datatype='Experimental', cell_line=cell_line) # BT549 ########################################### cell_line = 'BT549' test_inhib_targets = {'TestInhib1' : ['EGFR_pY1068', 'EGFR_pY1173', 'HER2_pY1248'], 'TestInhib2' : ['Src_pY416','Src_pY527'], 'TestInhib3' : ['mTOR_pS2448'], 'TestInhib4' : ['EGFR_pY1068', 'EGFR_pY1173'], 'TestInhib5' : []} print '----------- ' + cell_line + ' ------------' data = pd.read_csv('data/{0}_main.csv'.format(cell_line), header=0) inhibs = set(data['Inhibitor']) stims = set(data['Stimulus'])
# loop over times for tidx in range(1,len(times)): time = times[tidx] # get covariates for this time step and scale covariates_df = ((pred_df.ix[times[tidx-1], :]) - scalarblah.mean_[:-3]) / scalarblah.std_[:-3] # zero out covariate we are inhibiting try: covariates_df.ix[test_inhib_targets[test_inhib]] = 0 except: pass num_cov = len(pred_df.columns) covariates = np.zeros((num_cov + 3,)) covariates[:num_cov] = covariates_df.values # loop over proteins to get values for current time step for p in node_list: pred_df.ix[time, p] = regGBR[stim][p].predict(covariates) # zero out covariate we are inhibiting, again pred_df.ix[time, test_inhib] = 0 pred_dict[test_inhib][stim] = pred_df ### SAVE TO MIDAS for node in node_list: out_path = 'results/sakev-{0}-Prediction-Insilico'.format(node) utilities.write_MIDAS(pred_dict[node], node, out_path, datatype='inSilico', cell_line='inSilico')