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

def Bio::Clustalw::ClustalAlignment::__str__ (   self  ) 

Print out the alignment so it looks pretty.

The output produced from this should also be formatted in valid
clustal format.

Definition at line 136 of file __init__.py.

00136                      :
        """Print out the alignment so it looks pretty.

        The output produced from this should also be formatted in valid
        clustal format.
        """
        # if the version isn't set, we need to use the default
        if self._version == '':
            self._version = self.DEFAULT_VERSION
        
        output = "CLUSTAL X (%s) multiple sequence alignment\n\n\n" % \
                 self._version

        cur_char = 0
        max_length = len(self._records[0].seq)

        # keep displaying sequences until we reach the end
        while cur_char != max_length:
            # calculate the number of sequences to show, which will
            # be less if we are at the end of the sequence
            if (cur_char + 50) > max_length:
                show_num = max_length - cur_char
            else:
                show_num = 50

            # go through all of the records and print out the sequences
            # when we output, we do a nice 80 column output, although this
            # may result in truncation of the ids.
            for record in self._records:
                line = record.description[0:30].ljust(36)
                line = line + record.seq.data[cur_char:(cur_char + show_num)]
                
                output = output + line + "\n"

            # now we need to print out the star info, if we've got it
            if self._star_info != '':
                output = output + (" " * 36) + \
                     self._star_info[cur_char:(cur_char + show_num)] + "\n"

            output = output + "\n"
            cur_char = cur_char + show_num

        # have a extra newline, so strip two off and add one before returning
        return string.rstrip(output) + "\n"
            

    def _add_star_info(self, stars):


Generated by  Doxygen 1.6.0   Back to index