Spaces:
Paused
Paused
Erva Ulusoy commited on
Commit ·
67e78f6
1
Parent(s): 51641fb
updated edge coloring, modified edge labels to more clear ones
Browse files15 unmodified lines161718192021164 unmodified lines18618718818919019119229 unmodified lines22222322422522622722822923023115 unmodified lines'Protein': '#3aa6a4'}GO_CATEGORY_MAPPING = {'Biological Process': 'GO_term_P','Molecular Function': 'GO_term_F',164 unmodified lines# Add edges and target nodesfor edge_type, edges in visualized_edges.items():source_type, relation_type, target_type = edge_typefor edge_info in edges:edge, probability, is_ground_truth = edge_infosource, target = edge[0], edge[1]29 unmodified linesif probability is not None:if probability == 'no_pred':edge_color = '#219ebc'edge_label += '(P=Not generated)'else:edge_label += f"(P={probability:.2f})"edge_color = '#c1121f' if is_ground_truth else '#219ebc'net.add_edge(source_str, target_str,label=edge_label,font={'size': 0},15 unmodified lines1617181920212223242526272829303132333435363738164 unmodified lines20320420520620720820921021121221321429 unmodified lines24424524624724824925025125225325415 unmodified lines'Protein': '#3aa6a4'}EDGE_LABEL_TRANSLATION = {'Orthology': 'is ortholog to','Pathway': 'takes part in','kegg_path_prot': 'takes part in','protein_domain': 'has','PPI': 'interacts with','HPO': 'is associated with','kegg_dis_prot': 'is related to','Disease': 'is related to','Drug': 'targets','protein_ec': 'catalyzes','Chembl': 'targets',('protein_function', 'GO_term_F'): 'enables',('protein_function', 'GO_term_P'): 'is involved in',('protein_function', 'GO_term_C'): 'localizes to',}GO_CATEGORY_MAPPING = {'Biological Process': 'GO_term_P','Molecular Function': 'GO_term_F',164 unmodified lines# Add edges and target nodesfor edge_type, edges in visualized_edges.items():source_type, relation_type, target_type = edge_typeif relation_type == 'protein_function':relation_type = EDGE_LABEL_TRANSLATION[(relation_type, target_type)]else:relation_type = EDGE_LABEL_TRANSLATION[relation_type]for edge_info in edges:edge, probability, is_ground_truth = edge_infosource, target = edge[0], edge[1]29 unmodified linesif probability is not None:if probability == 'no_pred':edge_color = '#219ebc'edge_label += ' (P=Not generated)'else:edge_label += f" (P={probability:.2f})"edge_color = '#8338ec' if is_ground_truth else '#c1121f'# if validated prediction purple, if non-validated prediction red, if no prediction (directly from database) bluenet.add_edge(source_str, target_str,label=edge_label,font={'size': 0},
visualize_kg.py+27-4