nta
Run single-omic NTA (Network-topology based analysis) with edge list and list of starting analytes/nodes
Parameters
edge_list-list[list[str]]of the network which is a list of lists where each entry is a node.analyte_list-list[str]of analytes for starting the NTA with.nta_method- aNTAMethodobject specifying the NTA method for the analysis.n- the number of seeds or nodes to identify according tonta_method
Returns
Returns a dictionary object containing the candidates (seed nodes when using prioritization), scores (random-walk probabilities), and neighborhood (identified nodes)
Panics
Panics if the network or the analyte list is malformed or not at specified path. Will also panic if nta_method is not specified correctly
Example
import webgestaltpy
def file_to_list(file_path: str) -> list[str]:
"""Convert file to list[str]"""
with open(file_path, "r") as r:
return list(r.readlines())
def read_network(file_path: str) -> list[list[str]]:
"""Read .net file to format for nta()"""
with open(file_path, "r") as r:
lines = r.readlines()
net = []
for line in lines:
if "\t" in line:
net.append(line.split("\t"))
return net
nta_method = webgestaltpy.NTAMethod.Prioritization
y = webgestaltpy.nta(read_network("data/hsapiens_network_CPTAC_Proteomics_OV_entrezgene.net"),
file_to_list("data/net_genes.txt"(), nta_method, 5)
print(y)
Output