def eval_func(space): # --- bp --- bp = biolib.Ontology(filemanager.Load.ontology_similarity_data("BP")) bp.filter_gene_names(genes_in_data) bp.convert_nan_to_zero() bp.apply_threshold(space["threshold"]) if space["binarize"]: bp.binarize() bp.to_np(genes_in_data) bp = algorithms.Adjacency(bp.data, genes_in_data) return evaluator.evaluate(bp)
# data = json.load(f) ######################################################################################################################## # # ---------Select genes 2 use in common--------------- # --- using most restricting params d = diseaseslib.DiGeNet(group_by="by_diseases") gl = diseaseslib.GeneLinkage(gene_code="entrezid", gen_interval_len=priorization_params["linkage_interval"]) # --- load info for networks --- # ppi, bp ppi = biolib.PPI(filemanager.Load.ppi()) bp = biolib.Ontology(filemanager.Load.ontology_similarity_data("BP")) gtex_genes = biolib.EXP().gene_names # --- finding genes in common --- genes_in_data = diseaseslib.get_gene_universe(gene_linkage=gl, dict_of_networks={}, list_of_list_of_genes=[ppi.gene_names, bp.gene_names, gtex_genes], mode="intersect") print("Genes in common: {}".format(len(genes_in_data))) # --- ppi --- ppi.filter_gene_names(genes_in_data) ppi.apply_threshold(ppi_params["threshold"]) if ppi_params["binarize"]: ppi.binarize()