Package Bio :: Package Graphics :: Module DisplayRepresentation :: Class ChromosomeCounts
[hide private]
[frames] | no frames]

Class ChromosomeCounts

source code

object --+
         |
        ChromosomeCounts

Represent a chromosome with count information.

This is used to display information about counts along a chromosome. The segments are expected to have different count information, which will be displayed using a color scheme.

I envision using this class when you think that certain regions of the chromosome will be especially abundant in the counts, and you want to pick those out.

Instance Methods [hide private]
 
__init__(self, segment_names, color_scheme={(1, 1): Color(.933333,.509804,.933333,1), (2, 2): Color(.2941...)
Initialize a representation of chromosome counts.
source code
 
add_count(self, segment_name, count=1)
Add counts to the given segment name.
source code
 
scale_segment_value(self, segment_name, scale_value=None)
Divide the counts for a segment by some kind of scale value.
source code
 
add_label(self, segment_name, label)
Add a label to a specific segment.
source code
 
set_scale(self, segment_name, scale)
Set the scale for a specific chromosome segment.
source code
 
get_segment_info(self)
Retrieve the color and label info about the segments.
source code
 
fill_chromosome(self, chromosome)
Add the collected segment information to a chromosome for drawing.
source code
 
_color_from_count(self, count)
Translate the given count into a color using the color scheme.
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, segment_names, color_scheme={(1, 1): Color(.933333,.509804,.933333,1), (2, 2): Color(.2941...)
(Constructor)

source code 

Initialize a representation of chromosome counts.

Arguments:

o segment_names - An ordered list of all segment names along the chromosome. The count and other information will be added to these.

o color_scheme - A coloring scheme to use in the counts. This should be a dictionary mapping count ranges to colors (specified in reportlab.lib.colors).

Overrides: object.__init__

add_count(self, segment_name, count=1)

source code 

Add counts to the given segment name.

Arguments:

o segment_name - The name of the segment we should add counts to. If the name is not present, a KeyError will be raised.

o count - The counts to add the current segment. This defaults to a single count.

scale_segment_value(self, segment_name, scale_value=None)

source code 

Divide the counts for a segment by some kind of scale value.

This is useful if segments aren't represented by raw counts, but are instead counts divided by some number.

add_label(self, segment_name, label)

source code 

Add a label to a specific segment.

Raises a KeyError is the specified segment name is not found.

set_scale(self, segment_name, scale)

source code 

Set the scale for a specific chromosome segment.

By default all segments have the same scale -- this allows scaling by the size of the segment.

Raises a KeyError is the specified segment name is not found.

get_segment_info(self)

source code 

Retrieve the color and label info about the segments.

Returns a list consiting of two tuples specifying the counts and label name for each segment. The list is ordered according to the original listing of names. Labels are set as None if no label was specified.

fill_chromosome(self, chromosome)

source code 

Add the collected segment information to a chromosome for drawing.

Arguments:

o chromosome - A Chromosome graphics object that we can add chromosome segments to.

This creates ChromosomeSegment (and TelomereSegment) objects to fill in the chromosome. The information is derived from the label and count information, with counts transformed to the specified color map.

Returns the chromosome with all of the segments added.