Map tissue expression
This notebook checks whether network nodes have detected expression in a tissue of interest. For cancer tissues, Neko uses the current Human Protein Atlas cancer table directly and caches it locally. Other tissues use a batched OmniPath request.
[ ]:
%%time
from neko.core.network import Network
from neko._visual.visualize_network import NetworkVisualizer
from neko.inputs import Universe
from neko._annotations.gene_ontology import Ontology
1. Import genes as network nodes
[ ]:
genes = ["SRC", "NOTCH1", "FAK", "CDH1", "CDH2", "VIM", "MAP4K4", "LATS1", "LATS2", "PTK2B"]
[ ]:
new_net1 = Network(genes, resources = 'omnipath')
[ ]:
#Print node dataframe
new_net1.nodes
2. Check for detected gene expression in the tissue of interest
The tissue name is matched exactly after ignoring case and repeated whitespace. Records whose HPA level is Not detected are reported as False.
[ ]:
annot = Ontology()
results_df = annot.check_tissue_annotations(
genes_df=new_net1.nodes,
tissue='colorectal cancer',
)
print(results_df)
3. Color nodes based on detected expression in the tissue of interest
The tissue_mapping function highlights nodes with detected expression in light blue and nodes without detected expression in light gray. A service error stops the annotation step instead of treating unavailable data as absent.
[ ]:
network_visualizer = NetworkVisualizer(new_net1)
network_visualizer.tissue_mapping(results_df)
network_visualizer.render()
[ ]: