Logo Search packages:      
Sourcecode: python-biopython version File versions

def Bio::Graphics::BasicChromosome::Chromosome::draw (   self,
  cur_drawing 
)

Draw a chromosome on the specified template.

Ideally, the x_position and y_*_position attributes should be
set prior to drawing -- otherwise we're going to have some problems.

Definition at line 228 of file BasicChromosome.py.

00228                                :
        """Draw a chromosome on the specified template.

        Ideally, the x_position and y_*_position attributes should be
        set prior to drawing -- otherwise we're going to have some problems.
        """
        for position in (self.start_x_position, self.end_x_position,
                         self.start_y_position, self.end_y_position):
            assert position != -1, "Need to set drawing coordinates."

        # first draw all of the sub-sections of the chromosome -- this
        # will actually be the picture of the chromosome
        cur_y_pos = self.start_y_position
        if self.scale_num:
            y_pos_change = ((self.start_y_position * .95 - self.end_y_position)
                            / self.scale_num)
        elif len(self._sub_components) > 0:
            y_pos_change = ((self.start_y_position * .95 - self.end_y_position)
                            / self.subcomponent_size())
        # no sub_components to draw
        else:
            pass
            
        for sub_component in self._sub_components:
            this_y_pos_change = sub_component.scale * y_pos_change
            
            # set the location of the component to draw
            sub_component.start_x_position = self.start_x_position
            sub_component.end_x_position = self.end_x_position
            sub_component.start_y_position = cur_y_pos
            sub_component.end_y_position = cur_y_pos - this_y_pos_change

            # draw the sub component
            sub_component.draw(cur_drawing)

            # update the position for the next component
            cur_y_pos -= this_y_pos_change

        self._draw_label(cur_drawing, self._name)

    def _draw_label(self, cur_drawing, label_name):


Generated by  Doxygen 1.6.0   Back to index