In [1]:
%matplotlib inline
In [2]:
from hiveplot import HivePlot
import networkx as nx
import matplotlib.pyplot as plt
In [3]:
p = nx.read_gpickle('hiv1_homology_model.pkl')
p
Out[3]:
In [4]:
p.nodes(data=True)[0]
Out[4]:
In [5]:
nodes = dict()
nodes['chainA'] = [n for n, d in p.nodes(data=True) if d['chain_id'] == 'A']
nodes['chainB'] = [n for n, d in p.nodes(data=True) if d['chain_id'] == 'B']
edges = dict()
edges['all'] = [(u, v, d) for u, v, d in p.edges(data=True)]
nodes_cmap = dict()
nodes_cmap['chainA'] = 'red'
nodes_cmap['chainB'] = 'blue'
In [6]:
h = HivePlot(nodes, edges, nodes_cmap)
h.draw()
plt.savefig('protein_graph.pdf')
In [ ]: