biopython v1.71.0 Bio.Graphics.DisplayRepresentation.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.

Link to this section Summary

Functions

Initialize a representation of chromosome counts

Translate the given count into a color using the color scheme

Add counts to the given segment name

Add a label to a specific segment

Add the collected segment information to a chromosome for drawing

Retrieve the color and label info about the segments

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

Set the scale for a specific chromosome segment

Link to this section Functions

Initialize a representation of chromosome counts.

Arguments:

  • segment_names - An ordered list of all segment names along the chromosome. The count and other information will be added to these.
  • 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).
Link to this function _color_from_count()

Translate the given count into a color using the color scheme.

Add counts to the given segment name.

Arguments:

  • segment_name - The name of the segment we should add counts to. If the name is not present, a KeyError will be raised.
  • count - The counts to add the current segment. This defaults to a single count.

Add a label to a specific segment.

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

Link to this function fill_chromosome()

Add the collected segment information to a chromosome for drawing.

Arguments:

  • 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.

Link to this function get_segment_info()

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.

Link to this function scale_segment_value()

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.

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.