Package Bio :: Package Graphics :: Package GenomeDiagram :: Module _Colors :: Class ColorTranslator
[hide private]
[frames] | no frames]

Class ColorTranslator

source code

object --+
         |
        ColorTranslator

Class providing methods for translating representations of color into
Instance Methods [hide private]
 
__init__(self, filename=None)
information
source code
 
translate(self, color=None)
or a tuple of three floats 0 -> 1, or a string giving one of the named colors defined by ReportLab, or a ReportLab color object (returned as is).
source code
 
read_colorscheme(self, filename)
format plaintext as: INT RED GREEN BLUE Comment Where RED, GREEN and BLUE are intensities in the range 0 -> 255 e.g.
source code
 
get_artemis_colorscheme(self)
Return the Artemis color scheme as a dictionary.
source code
 
artemis_color(self, value)
Artemis color (integer) to ReportLab Color object.
source code
 
get_colorscheme(self)
Return the user-defined color scheme as a dictionary.
source code
 
scheme_color(self, value)
color scheme
source code
 
int255_color(self, values)
integers in the range 0->255
source code
 
float1_color(self, values)
in the range 0 -> 1
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, filename=None)
(Constructor)

source code 
o filename Location of a file containing colorscheme
information

Optional parameters set the color scheme

Overrides: object.__init__

translate(self, color=None)

source code 
o color Color defined as an int, a tuple of three ints 0->255

or a tuple of three floats 0 -> 1, or a string giving one of the named colors defined by ReportLab, or a ReportLab color object (returned as is).

(This argument is overridden by a backwards compatible argument with UK spelling, colour).

Returns a colors.Color object, determined semi-intelligently depending on the input values

read_colorscheme(self, filename)

source code 
o filename The location of a file defining colors in tab-separated
format plaintext as: INT RED GREEN BLUE Comment Where RED, GREEN and BLUE are intensities in the range 0 -> 255 e.g. 2 255 0 0 Red: Information transfer

Reads information from a file containing color information and stores it internally

artemis_color(self, value)

source code 

Artemis color (integer) to ReportLab Color object.

Arguments:
  • value: An int representing a functional class in the Artemis color scheme (see www.sanger.ac.uk for a description), or a string from a GenBank feature annotation for the color which may be dot delimited (in which case the first value is used).

Takes an int representing a functional class in the Artemis color scheme, and returns the appropriate colors.Color object

scheme_color(self, value)

source code 
o value An int representing a single color in the user-defined
color scheme

Takes an int representing a user-defined color and returns the appropriate colors.Color object

int255_color(self, values)

source code 
o values A tuple of (red, green, blue) intensities as
integers in the range 0->255

Takes a tuple of (red, green, blue) intensity values in the range 0 -> 255 and returns an appropriate colors.Color object

float1_color(self, values)

source code 
o values A tuple of (red, green, blue) intensities as floats
in the range 0 -> 1

Takes a tuple of (red, green, blue) intensity values in the range 0 -> 1 and returns an appropriate colors.Color object