MCPcopy Create free account
hub / github.com/Mew233/pairwise / process_drugcomb

Function process_drugcomb

pairwise/prepare_data.py:28–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26 'Customized':'process_customized'}
27
28 def process_drugcomb():
29 data = pd.read_csv(os.path.join(ROOT_DIR, 'data', 'synergy_data','p13','p13_trueset.csv'))
30 data = data[['drug_row', 'drug_col','cell_line_name','study_name','tissue_name',\
31 'synergy_zip','synergy_loewe','synergy_hsa','synergy_bliss','DepMap_ID','RRID',\
32 'pubchemID_x','compound0_x','pubchemID_y','compound0_y',\
33 'ri_row', 'ri_col']]
34
35 data_trim = data[['compound0_x','compound0_y','DepMap_ID','tissue_name','synergy_loewe',\
36 'ri_row', 'ri_col']]
37
38 ## clean the scores
39 data_trim = data_trim[data_trim['synergy_loewe'] != '\\N']
40 data_trim['synergy_loewe'] = data_trim['synergy_loewe'].astype(float)
41
42 data_trim['compound0_x'] = data_trim['compound0_x'].apply(lambda x: split_it(x))
43 data_trim['compound0_y'] = data_trim['compound0_y'].apply(lambda x: split_it(x))
44
45
46 # # summarize 3*3 or 5*3 data into one by calculating the mean score
47 # summary_data = data_trim.groupby(['compound0_x','compound0_y','DepMap_ID_x']).agg({\
48 # "synergy_loewe":'mean',"study_name":'count'}).reset_index().rename(columns={\
49 # 'synergy_loewe':'MEAN_SCORE','study_name':'count'}).astype({'compound0_x':'int32','compound0_y':'int32'})
50
51 # # some experiments may fail and get NA values, drop these experiments
52 summary_data = data_trim.dropna()
53
54 summary_data = summary_data[['compound0_x','compound0_y','DepMap_ID','tissue_name','synergy_loewe','ri_row', 'ri_col']].rename(columns={\
55 'compound0_x':'drug1','compound0_y':'drug2','DepMap_ID':'cell','synergy_loewe':'score',\
56 'ri_row':'ic_1', 'ri_col':'ic_2'})
57
58 # proessed_dpi = pd.read_csv(os.path.join(ROOT_DIR, 'results','proessed_dpi_extended.csv'),index_col=0)
59 # proessed_dpi.columns = proessed_dpi.columns.astype(int)
60 # library = set(proessed_dpi.columns)
61 # summary_data = summary_data[summary_data['drug1'].isin(library)]
62 # summary_data = summary_data[summary_data['drug2'].isin(library)]
63
64 return summary_data.head(10000)
65
66 def process_sanger2022():
67 data = pd.read_csv(os.path.join(ROOT_DIR, 'data', 'synergy_data','Sanger2022','Jaaks2022_trueset_xiabo.csv'))

Callers 1

process_sanger2022Function · 0.85

Calls 1

split_itFunction · 0.85

Tested by

no test coverage detected