This is a detailed tutorial for subnetwork drawing. For a brief tutorial on every step, see main.ipynb.
# Removes CPU usage limit by some jupyter versions
import os
os.environ['KMP_AFFINITY'] = ''
import numpy as np
import matplotlib.pyplot as plt
from dictys.net import network
from dictys.plot.static import fig_subnet
d0=network.from_file('../../data/static.h5')
fig=plt.figure()
ax=fig.add_subplot(111)
nodes,edges=fig_subnet(d0,ax,'Erythroid',regulators=['GATA1'])
sparsity=0.05
fig=plt.figure()
ax=fig.add_subplot(111)
nodes,edges=fig_subnet(d0,ax,'Erythroid',regulators=['GATA1'],sparsity=sparsity)
fig=plt.figure()
ax=fig.add_subplot(111)
nodes,edges=fig_subnet(d0,ax,'Erythroid',regulators=['GATA1'],sparsity=sparsity,annotate='GATA1,PRIM1,BTRC,GYPC,PPM1A,YOD1,FBXO9,PRR5,TRIM58'.split(','))
fig=plt.figure(figsize=(12,12))
ax=fig.add_subplot(111)
nodes,edges=fig_subnet(d0,ax,'Erythroid',regulators=['GATA1'],sparsity=sparsity,annotate='all')
nodes.head()
x | y | |
---|---|---|
ABHD5 | -1.440797 | 0.343543 |
ACSM3 | 1.145363 | -0.535579 |
ADAM9 | 1.361300 | 0.452628 |
AGO2 | 0.771508 | -1.163065 |
AGTPBP1 | -0.740132 | 1.290446 |
edges.head()
Regulator | Target | Strength | |
---|---|---|---|
0 | GATA1 | ABHD5 | 0.113482 |
1 | GATA1 | ACSM3 | 0.275617 |
2 | GATA1 | ADAM9 | 0.025134 |
3 | GATA1 | AGO2 | -0.127033 |
4 | GATA1 | AGTPBP1 | 0.217776 |
fig=plt.figure()
ax=fig.add_subplot(111)
nodes,edges=fig_subnet(d0,ax,'Erythroid',targets=['GYPC'],annotate='all')
fig=plt.figure()
ax=fig.add_subplot(111)
nodes,edges=fig_subnet(d0,ax,'Erythroid',regulators=['HLTF'],annotate='HLTF,BCL11A,UBAC1,DNAJC9,SEC14L1,NUSAP1,UBE2O,GTPBP1,ZBTB7A,OIP5,E2F1,FRYL'.split(','),sparsity=sparsity)
fig=plt.figure()
ax=fig.add_subplot(111)
nodes,edges=fig_subnet(d0,ax,'B',regulators=['SPIB'],annotate='SPIB,RAP2C,BANK1,HLA-DQA1,HLA-DPB1,SEMA4B,HLA-DPA1,PAX5'.split(','))
fig=plt.figure()
ax=fig.add_subplot(111)
nodes,edges=fig_subnet(d0,ax,'B',regulators=['PAX5'],annotate='PAX5,USF2,WTAP,PIK3CA'.split(','))