MCPcopy Create free account
hub / github.com/InternScience/InternAgent / get_similarity_network

Function get_similarity_network

tasks/AutoTPPR/code/experiment.py:611–635  ·  view source on GitHub ↗
(network_type, adata, threshold, k,
                           data_path, data_name, split, seed, train_gene_set_size,
                           set2conditions, default_pert_graph=True, pert_list=None)

Source from the content-addressed store, hash-verified

609 return df_edge_list
610
611def get_similarity_network(network_type, adata, threshold, k,
612 data_path, data_name, split, seed, train_gene_set_size,
613 set2conditions, default_pert_graph=True, pert_list=None):
614
615 if network_type == 'co-express':
616 df_out = get_coexpression_network_from_train(adata, threshold, k,
617 data_path, data_name, split,
618 seed, train_gene_set_size,
619 set2conditions)
620 elif network_type == 'go':
621 if default_pert_graph:
622 server_path = 'https://dataverse.harvard.edu/api/access/datafile/6934319'
623 #tar_data_download_wrapper(server_path,
624 #os.path.join(data_path, 'go_essential_all'),
625 #data_path)
626 df_jaccard = pd.read_csv(os.path.join(data_path,
627 'go_essential_all/go_essential_all.csv'))
628
629 else:
630 df_jaccard = make_GO(data_path, pert_list, data_name)
631
632 df_out = df_jaccard.groupby('target').apply(lambda x: x.nlargest(k + 1,
633 ['importance'])).reset_index(drop = True)
634
635 return df_out
636
637def get_coexpression_network_from_train(adata, threshold, k, data_path,
638 data_name, split, seed, train_gene_set_size,

Callers 1

model_initializeMethod · 0.70

Calls 4

read_csvMethod · 0.80
make_GOFunction · 0.70
applyMethod · 0.45

Tested by

no test coverage detected