()
| 469 | |
| 470 | # ## for RGCN =============unfinished=============== |
| 471 | def process_hetero_network(): |
| 472 | ppi_data = pd.read_csv(os.path.join(ROOT_DIR, 'data', 'cell_line_data','PPI','protein-protein_network.csv')) |
| 473 | |
| 474 | tuples = [tuple(x) for x in ppi_data.values] |
| 475 | graph = nx.Graph() |
| 476 | graph.add_edges_from(tuples) |
| 477 | |
| 478 | targets = pd.read_csv(os.path.join(ROOT_DIR, 'data', 'drug_data','all_targets.csv')) |
| 479 | drug_targets = explode_dpi(targets) |
| 480 | #deplete proteins in dpi, which not in ppi |
| 481 | selected_proteins = list(set(ppi_data['protein_a'])) + list(set(ppi_data['protein_b'])) |
| 482 | drug_targets_new = drug_targets[(drug_targets['NCBI_ID'].isin(selected_proteins))] |
| 483 | |
| 484 | def get_target_dict(dpi_df): |
| 485 | dp_dict = collections.defaultdict(list) |
| 486 | drug_list = list(set(dpi_df['Drug IDs'])) |
| 487 | for drug in drug_list: |
| 488 | drug_df = dpi_df[dpi_df['Drug IDs']==drug] |
| 489 | target = list(set(drug_df['NCBI_ID'])) |
| 490 | dp_dict[drug] = target |
| 491 | return dp_dict |
| 492 | |
| 493 | dpi_dict = get_target_dict(drug_targets_new) |
| 494 | |
| 495 | ## cpi |
| 496 | cpi_data = pd.read_csv(os.path.join(ROOT_DIR, 'data', 'cell_line_data','CCLE','batchcorr_CCLE_exp.csv')) |
| 497 | cpi_data.columns = ['Entrezid']+[split_it_cell(_) for _ in list(cpi_data.columns)[1:]] |
| 498 | |
| 499 | cpi_data['Entrezid'] = [split_it_cellName(_) for _ in list(cpi_data['Entrezid'])] |
| 500 | # cpi_data['Entrezid'] = [(range(len(cpi_data['Entrezid'])))] |
| 501 | |
| 502 | df_transpose = cpi_data.T |
| 503 | # set first row as column |
| 504 | df_transpose.columns = df_transpose.iloc[0] |
| 505 | cell_targets = df_transpose.drop(df_transpose.index[0]) |
| 506 | cell_targets_new = cell_targets[(cell_targets.index.isin(selected_proteins))].T |
| 507 | |
| 508 | |
| 509 | def get_cell_target_dict(cpi_df): |
| 510 | cp_dict = collections.defaultdict(list) |
| 511 | cell_list = list(set(cpi_df.index)) |
| 512 | |
| 513 | nodes_dict = dict(zip(range(len(cpi_df.columns)),cpi_df.columns)) |
| 514 | |
| 515 | #128 high exp protein |
| 516 | for cell in cell_list: |
| 517 | cell_df = cpi_df[cpi_df.index==cell] |
| 518 | _array = abs(cell_df.values).argsort(axis=1)[:,::-1][0][:128] |
| 519 | array = [nodes_dict[k] for k in _array] |
| 520 | |
| 521 | target = list(array) |
| 522 | cp_dict[cell] = target |
| 523 | return cp_dict |
| 524 | |
| 525 | cpi_dict = get_cell_target_dict(cell_targets_new) |
| 526 | |
| 527 | # cpi_data = pd.read_csv(os.path.join(ROOT_DIR, 'data', 'cell_line_data','CCLE','CCLE_mut.csv')) |
| 528 | # CCLE_mu = cpi_data[['DepMap_ID', 'Entrez_Gene_Id']] |
nothing calls this directly
no test coverage detected