Snippets

Dénes Türei induced_subgraph by Gene Symbols or UniProt IDs with pypath

Created by Dénes Türei
#!/usr/bin/env python

import pypath

pa = pypath.PyPath()

pa.init_network(pypath.data_formats.pathway)

[v.index for v in  pa.gss(['ULK1', 'AKT1', 'EGF', 'EGFR', 'foobar'])]
# [1384, 1312, 727, 68]

# for UniProts:

# [v.index for v in  pa.ups(['P00533', ...])]

g0 = pa.graph.induced_subgraph([v.index for v in  pa.gss(['ULK1', 'AKT1', 'EGF', 'EGFR', 'foobar'])])
g0.vcount()
# 4
g0.ecount()
# 1
g0
# <igraph.Graph object at 0x6d7c323c0048>
g0.es[0]['refs_by_source']

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.