Commits

Mark Howison committed 5633028

graph: updated coloring

  • Participants
  • Parent commits 3febe6f
  • Branches chloroplast, devel 3
    1. issue-6
    2. issue-7
    3. issue7a

Comments (0)

Files changed (1)

 dot_max_node_size = 1.0
 dot_min_node_size = 0.1
 dot_palette = (
-    (253, 212, 158),
-    (253, 187, 132),
-    (252, 141, 89),
-    (239, 101, 72),
-    (215, 48, 31),
-    (179, 0, 0),
-    (127, 0, 0))
+    (215,25,28),
+    (253,174,97),
+    (186,186,186))
 
 def colormap(palette, x):
     l = len(palette) - 1
-    x = float(x) / l
+    x = float(1.0-x) * l
     i = int(x)
     if i < l:
         x -= i
         with open(filename, 'w') as f:
             print >>f, 'graph G {'
 #            print >>f, 'size="%d,%d";' % dot_graph_size
-            print >>f, 'splines=true;'
-            print >>f, 'nodesep=1;'
+            print >>f, 'splines=false;'
+#            print >>f, 'nodesep=1;'
             for n in self.G.nodes_iter():
                 id = "node%d" % n
                 width = norm * len(self.G.node[n]['seq']) + dot_min_node_size
                 if frequencies:
-                    if id in frequencies:
-                        color = 'color=grey fillcolor="%s" style=filled' % colormap(dot_palette, frequencies[id])
-                    else:
-                        color = "color=grey fillcolor=grey90 style=filled"
+                    color = 'color=grey fillcolor="%s" style=filled' % colormap(dot_palette, frequencies.get(id, 0.0))
                 elif colors:
-                    color = "color=%s" % colors.get(id, "grey")
+                    color = "color=%s" % colors.get(id, "grey40")
                 elif active:
                     if self.A.has_node(n):
                         color = "color=red"
             for n1, n2 in self.G.edges_iter():
                 id = "edge%d" % self.G.edge[n1][n2]['id']
                 if frequencies:
-                    if id in frequencies:
-                        color = 'color="%s" style=bold' % colormap(dot_palette, frequencies[id])
-                    else:
-                        color = "color=grey90"
+                    color = 'color="%s"' % colormap(dot_palette, frequencies.get(id, 0.0))
                 elif colors:
-                    color = "color=%s" % colors.get(id, "grey")
+                    color = "color=%s" % colors.get(id, "grey40")
                 elif active:
                     if self.A.has_edge(n1, n2):
                         color = "color=red"
                     else:
                         color = "color=grey90"
                 else:
-                    color = "grey"
-                print >>f, '"%d" -- "%d" [id="%s" %s];' % (n1, n2, id, color)
+                    color = "color=grey"
+                print >>f, '"%d" -- "%d" [id="%s" %s style=bold];' % (n1, n2, id, color)
             print >>f, '}'
 
     # Graph state