Back to index

python-biopython  1.60
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
Bio.Graphics.BasicChromosome.TelomereSegment Class Reference
Inheritance diagram for Bio.Graphics.BasicChromosome.TelomereSegment:
Inheritance graph
[legend]
Collaboration diagram for Bio.Graphics.BasicChromosome.TelomereSegment:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def draw
def draw
def add
def remove

Public Attributes

 start_x_position
 end_x_position
 start_y_position
 end_y_position
 scale
 fill_color
 label
 label_size
 chr_percent

Private Member Functions

def _draw_segment

Private Attributes

 _inverted

Detailed Description

A segment that is located at the end of a linear chromosome.

This is just like a regular segment, but it draws the end of a chromosome
which is represented by a half circle. This just overrides the
_draw_segment class of ChromosomeSegment to provide that specialized
drawing.

Definition at line 681 of file BasicChromosome.py.


Constructor & Destructor Documentation

def Bio.Graphics.BasicChromosome.TelomereSegment.__init__ (   self,
  inverted = 0 
)
Initialize a segment at the end of a chromosome.

See ChromosomeSegment for all of the attributes that can be
customized in a TelomereSegments.

Arguments:

o inverted -- Whether or not the telomere should be inverted
(ie. drawn on the bottom of a chromosome)

Definition at line 689 of file BasicChromosome.py.

00689 
00690     def __init__(self, inverted = 0):
00691         """Initialize a segment at the end of a chromosome.
00692 
00693         See ChromosomeSegment for all of the attributes that can be
00694         customized in a TelomereSegments.
00695 
00696         Arguments:
00697 
00698         o inverted -- Whether or not the telomere should be inverted
00699         (ie. drawn on the bottom of a chromosome)
00700         """
00701         ChromosomeSegment.__init__(self)
00702 
00703         self._inverted = inverted

Here is the caller graph for this function:


Member Function Documentation

def Bio.Graphics.BasicChromosome.TelomereSegment._draw_segment (   self,
  cur_drawing 
) [private]
Draw a half circle representing the end of a linear chromosome.

Reimplemented from Bio.Graphics.BasicChromosome.ChromosomeSegment.

Definition at line 704 of file BasicChromosome.py.

00704 
00705     def _draw_segment(self, cur_drawing):
00706         """Draw a half circle representing the end of a linear chromosome.
00707         """
00708         # set the coordinates of the segment -- it'll take up the MIDDLE part
00709         # of the space we have.
00710         width = (self.end_x_position - self.start_x_position) \
00711                 * self.chr_percent
00712         height = self.start_y_position - self.end_y_position
00713         center_x = 0.5 * (self.end_x_position + self.start_x_position)
00714         start_x = center_x - 0.5 * width
00715         if self._inverted:
00716             center_y = self.start_y_position
00717             start_angle = 180
00718             end_angle = 360
00719         else:
00720             center_y = self.end_y_position
00721             start_angle = 0
00722             end_angle = 180
00723         
00724         cap_wedge = Wedge(center_x, center_y, width / 2,
00725                           start_angle, end_angle, height)
00726         cap_wedge.strokeColor = None
00727         cap_wedge.fillColor = self.fill_color
00728         cur_drawing.add(cap_wedge)
00729         
00730         #Now draw an arc for the the curved edge of the wedge,
00731         #ommiting the flat end.
00732         cap_arc = ArcPath()
00733         cap_arc.addArc(center_x, center_y, width / 2,
00734                        start_angle, end_angle, height)
00735         cur_drawing.add(cap_arc)

def Bio.Graphics.BasicChromosome._ChromosomeComponent.add (   self,
  component 
) [inherited]
Add a sub_component to the list of components under this item.

Definition at line 63 of file BasicChromosome.py.

00063 
00064     def add(self, component):
00065         """Add a sub_component to the list of components under this item.
00066         """
00067         assert isinstance(component, _ChromosomeComponent), \
00068                "Expected a _ChromosomeComponent object, got %s" % component
00069         
00070         self._sub_components.append(component)

Here is the caller graph for this function:

Draw the specified component.

Definition at line 83 of file BasicChromosome.py.

00083 
00084     def draw(self):
00085         """Draw the specified component.
00086         """
        raise AssertionError("Subclasses must implement.")
def Bio.Graphics.BasicChromosome.ChromosomeSegment.draw (   self,
  cur_drawing 
) [inherited]
Draw a chromosome segment.

Before drawing, the range we are drawing in needs to be set.

Reimplemented in Bio.Graphics.BasicChromosome.SpacerSegment.

Definition at line 399 of file BasicChromosome.py.

00399 
00400     def draw(self, cur_drawing):
00401         """Draw a chromosome segment.
00402 
00403         Before drawing, the range we are drawing in needs to be set.
00404         """
00405         for position in (self.start_x_position, self.end_x_position,
00406                          self.start_y_position, self.end_y_position):
00407             assert position != -1, "Need to set drawing coordinates."
00408 
00409         self._draw_subcomponents(cur_drawing) #Anything behind
00410         self._draw_segment(cur_drawing)
00411         self._overdraw_subcomponents(cur_drawing) #Anything on top
00412         self._draw_label(cur_drawing)

Here is the call graph for this function:

def Bio.Graphics.BasicChromosome._ChromosomeComponent.remove (   self,
  component 
) [inherited]
Remove the specified component from the subcomponents.

Raises a ValueError if the component is not registered as a
sub_component.

Definition at line 71 of file BasicChromosome.py.

00071 
00072     def remove(self, component):
00073         """Remove the specified component from the subcomponents.
00074 
00075         Raises a ValueError if the component is not registered as a
00076         sub_component.
00077         """
00078         try:
00079             self._sub_components.remove(component)
00080         except ValueError:
00081             raise ValueError("Component %s not found in sub_components." %
00082                              component)


Member Data Documentation

Definition at line 702 of file BasicChromosome.py.

Definition at line 397 of file BasicChromosome.py.

Definition at line 388 of file BasicChromosome.py.

Definition at line 390 of file BasicChromosome.py.

Definition at line 394 of file BasicChromosome.py.

Definition at line 395 of file BasicChromosome.py.

Definition at line 396 of file BasicChromosome.py.

Definition at line 393 of file BasicChromosome.py.

Definition at line 387 of file BasicChromosome.py.

Definition at line 389 of file BasicChromosome.py.


The documentation for this class was generated from the following file: