Skip to content
Browse files

Handle named feature colors as strings in chromosome diagrams

  • Loading branch information...
1 parent a2cd2ed commit 575a7915dbaedcfeb0b669f3609e5b53351f15e8 @peterjc peterjc committed Mar 18, 2013
Showing with 4 additions and 3 deletions.
  1. +3 −2 Bio/Graphics/BasicChromosome.py
  2. +1 −1 Tests/test_GraphicsChromosome.py
View
5 Bio/Graphics/BasicChromosome.py
@@ -591,7 +591,7 @@ def __init__(self, bp_length, features,
The features can either be SeqFeature objects, or tuples of values:
start (int), end (int), strand (+1, -1, O or None), label (string),
- ReportLab color, and optional ReportLab fill color.
+ ReportLab color (string or object), and optional ReportLab fill color.
Note we require 0 <= start <= end <= bp_length, and within the vertical
space allocated to this segmenet lines will be places according to the
@@ -660,8 +660,9 @@ def _overdraw_subcomponents(self, cur_drawing):
except AttributeError:
#Assume tuple of ints, string, and color
start, end, strand, name, color = f[:5]
+ color = _color_trans.translate(color)
if len(f) > 5:
- fill_color = f[5]
+ fill_color = _color_trans.translate(f[5])
else:
fill_color = color
assert 0 <= start <= end <= self.bp_length
View
2 Tests/test_GraphicsChromosome.py
@@ -309,7 +309,7 @@ def test_simple_tRNA(self):
cytobands.append((length-1000000, length, 0, "Last 1 Mbp", colors.black, colors.brown))
#Additional dummy entry to check fill colour on both strands,
if name == "Chr III":
- cytobands.append((11000000, 13000000, -1, "Reverse", colors.red, colors.yellow))
+ cytobands.append((11000000, 13000000, -1, "Reverse", "red", "yellow"))
elif name == "Chr V":
cytobands.append((9500000, 11000000, +1, "Forward", colors.red, colors.yellow))
#Create the drawing object for the chromosome

0 comments on commit 575a791

Please sign in to comment.
Something went wrong with that request. Please try again.