()
| 354 | |
| 355 | |
| 356 | def process_dpi(): |
| 357 | # load drug target dataset |
| 358 | targets = pd.read_csv(os.path.join(ROOT_DIR, 'data', 'drug_data','all_targets.csv')) |
| 359 | enzymes = pd.read_csv(os.path.join(ROOT_DIR, 'data', 'drug_data','all_enzyme.csv')) |
| 360 | carrier = pd.read_csv(os.path.join(ROOT_DIR, 'data', 'drug_data','all_carrier.csv')) |
| 361 | transporter = pd.read_csv(os.path.join(ROOT_DIR, 'data', 'drug_data','all_transporter.csv')) |
| 362 | all = pd.concat([targets,enzymes,carrier,transporter]) |
| 363 | # all = targets |
| 364 | drug_targets = explode_dpi(all) |
| 365 | |
| 366 | dtc = pd.read_csv(os.path.join(ROOT_DIR, 'data', 'drug_data','dtc_db2ncbi.csv')) |
| 367 | drug_targets_L = pd.concat([drug_targets,dtc]) |
| 368 | drug_targets_L = drug_targets_L.drop_duplicates(subset=['Drug IDs','NCBI_ID']) |
| 369 | |
| 370 | drug_mapping = dict(zip(drug_targets_L['Drug IDs'].unique().tolist(), range(len(drug_targets_L['Drug IDs'].unique())))) |
| 371 | gene_mapping = dict(zip(drug_targets_L['NCBI_ID'].unique().tolist(), range(len(drug_targets_L['NCBI_ID'].unique())))) |
| 372 | encoding = np.zeros((len(drug_targets_L['Drug IDs'].unique()), len(drug_targets_L['NCBI_ID'].unique()))) |
| 373 | for _, row in drug_targets_L.iterrows(): |
| 374 | encoding[drug_mapping[row['Drug IDs']], gene_mapping[row['NCBI_ID']]] = 1 |
| 375 | target_feats = dict() |
| 376 | for drug, row_id in drug_mapping.items(): |
| 377 | target_feats[int(drug)] = encoding[row_id].tolist() |
| 378 | |
| 379 | proessed_dpi = pd.DataFrame(target_feats) |
| 380 | proessed_dpi.index = drug_targets_L['NCBI_ID'].unique() |
| 381 | # proessed_dpi.to_csv(os.path.join(ROOT_DIR, 'results','proessed_dpi_db.csv')) |
| 382 | |
| 383 | # network = nx.read_edgelist(os.path.join(ROOT_DIR, 'data','cell_line_data','PPI','string_network'), delimiter='\t', nodetype=int, |
| 384 | # data=(('weight', float),)) |
| 385 | |
| 386 | # data_dicts = np.load(os.path.join(ROOT_DIR, 'data', 'cell_line_data',"CCLE",'input_cellline_data.npy'),allow_pickle=True).item() |
| 387 | # ccle = data_dicts['exp'] |
| 388 | # customized = pd.read_csv(os.path.join(ROOT_DIR, 'data', 'cell_line_data',"Customized",'crc_exp.csv'), index_col=0) |
| 389 | # tcga = pd.read_csv(os.path.join(ROOT_DIR, 'data', 'cell_line_data',"Customized",'tcga_colon_exp.csv'), index_col=0) |
| 390 | |
| 391 | # #column is drugbank id, row is entrez id |
| 392 | # proessed_dpi = proessed_dpi.loc[proessed_dpi.index.isin(list(network.nodes)), :] |
| 393 | # proessed_dpi = proessed_dpi.loc[proessed_dpi.index.isin(list(ccle.index)), :] |
| 394 | # proessed_dpi = proessed_dpi.loc[proessed_dpi.index.isin(list(customized.index)), :] |
| 395 | # proessed_dpi = proessed_dpi.loc[proessed_dpi.index.isin(list(tcga.index)), :] |
| 396 | # proessed_dpi.columns = proessed_dpi.columns.astype(int) |
| 397 | return proessed_dpi |
| 398 | |
| 399 | ##RWR algorithm for drug-target from transynergy |
| 400 | def process_dpi_RWR(): |
no test coverage detected