Mercurial > repos > pablocarb > synbiodesign
annotate rpviz/nxvisualizer.py @ 30:0ad6fda90f41 draft default tip
planemo upload commit f74fd52b330cc7460d98121b9bb78c08ca915d1e
author | pablocarb |
---|---|
date | Thu, 29 Aug 2019 06:59:58 -0400 |
parents | fe78fd6b315a |
children |
rev | line source |
---|---|
16
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
2 """ |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
3 Created on Thu May 30 10:21:48 2019 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
4 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
5 @author: anael |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
6 """ |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
7 #Usefull |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
8 import inspect |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
9 #inspect.getargspec(function) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
10 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
11 import networkx as nx |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
12 from IPython.display import Image |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
13 import requests |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
14 import json |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
15 import pandas as pd |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
16 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
17 # Library for util |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
18 from py2cytoscape.data.cynetwork import CyNetwork |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
19 from py2cytoscape.data.cyrest_client import CyRestClient |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
20 from py2cytoscape.data.style import StyleUtil |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
21 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
22 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
23 def network(LR,Lreact,Lprod,name,smile,image): |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
24 ###Create the network with networkx |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
25 G=nx.DiGraph() |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
26 G.add_nodes_from(LR) #add reactions nodes |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
27 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
28 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
29 for i in range(len(LR)): |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
30 for j in range(len(Lreact[i])): |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
31 G.add_edge(Lreact[i][j],LR[i]) #add reactants nodes |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
32 for k in range(len(Lprod[i])): |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
33 G.add_edge(LR[i],Lprod[i][k]) #add products nodes |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
34 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
35 #Attribute category |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
36 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
37 dic_types={} |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
38 for i in range(len(LR)): |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
39 dic_types[(list(G.nodes))[i]]='reactions' |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
40 for node in range(len(list(G.nodes))): |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
41 if list(G.nodes)[node] in Lprod[i]: |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
42 dic_types[list(G.nodes)[node]]='product' |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
43 if list(G.nodes)[node] not in dic_types: |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
44 dic_types[list(G.nodes)[node]]='reactant' |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
45 print(dic_types) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
46 nx.set_node_attributes(G,name='category',values=dic_types) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
47 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
48 #Attribute smile |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
49 nx.set_node_attributes(G, name='smiles', values=smile) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
50 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
51 #Attribute image |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
52 nx.set_node_attributes(G,name='image', values=image) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
53 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
54 nx.write_gml(G,name+'.gml') |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
55 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
56 #Connect with cytoscape |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
57 cy = CyRestClient() |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
58 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
59 # Reset |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
60 #cy.session.delete() |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
61 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
62 #To create the network in cytoscape |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
63 network = cy.network.create_from_networkx(G, name=name, collection='My network collection') |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
64 print('New network created with py2cytoscape. Its SUID is ' + str(network.get_id())) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
65 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
66 #To get the SUID of all the components of the network |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
67 all_suid = cy.network.get_all() |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
68 net1 = cy.network.create(all_suid[0]) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
69 print(net1.get_first_view()) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
70 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
71 #Styles |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
72 cy.layout.apply(name='hierarchical', network=network) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
73 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
74 # Get all existing Visual Styles |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
75 styles = cy.style.get_all() |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
76 print(json.dumps(styles, indent=4)) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
77 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
78 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
79 # Get a reference to the existing style |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
80 default_style = cy.style.create('default') |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
81 print(default_style.get_name()) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
82 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
83 # Get all available Visual Properties |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
84 print(len(cy.style.vps.get_all())) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
85 node_vps=cy.style.vps.get_node_visual_props() |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
86 edge_vps = cy.style.vps.get_edge_visual_props() |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
87 network_vps=cy.style.vps.get_network_visual_props() |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
88 print(pd.Series(edge_vps).head()) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
89 print(pd.Series(node_vps).head()) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
90 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
91 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
92 # Create a new style |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
93 style1 = cy.style.create("My_style") |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
94 print(style1.get_name()) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
95 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
96 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
97 new_defaults = { |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
98 # Node defaults |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
99 'NODE_FILL_COLOR': '#00ddee', |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
100 'NODE_SIZE': 20, |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
101 'NODE_BORDER_WIDTH': 0, |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
102 'NODE_LABEL_COLOR': 'black', |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
103 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
104 # Edge defaults |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
105 'EDGE_WIDTH': 3, |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
106 'EDGE_STROKE_UNSELECTED_PAINT': '#aaaaaa', |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
107 'EDGE_LINE_TYPE': 'LONG_DASH', |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
108 'EDGE_TARGET_ARROW_SHAPE' : 'DELTA', |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
109 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
110 # Network defaults |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
111 'NETWORK_BACKGROUND_PAINT': 'white', |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
112 } |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
113 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
114 style1.update_defaults(new_defaults) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
115 #Apply style |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
116 cy.style.apply(style1, network) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
117 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
118 # Passthrough mapping to get node labels |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
119 style1.create_passthrough_mapping(column='name', col_type='String', vp='NODE_LABEL') |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
120 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
121 # Discrete mapping for node colours: |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
122 cat = { |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
123 'reactant': '#4D833C', |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
124 'product': '#C04E5D' |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
125 } |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
126 style1.create_discrete_mapping(column='category', |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
127 col_type='String', |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
128 vp='NODE_FILL_COLOR', |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
129 mappings=cat) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
130 |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
131 # Discrete mapping for node shape: |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
132 reac = { |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
133 'reactions': 'RECTANGLE' |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
134 } |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
135 style1.create_discrete_mapping(column='category', |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
136 col_type='String', |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
137 vp='NODE_SHAPE', |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
138 mappings=reac) |
fe78fd6b315a
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
pablocarb
parents:
diff
changeset
|
139 |