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

def Bio::AlignIO::NexusIO::NexusWriter::write_file (   self,
  alignments 
)

Use this to write an entire file containing the given alignments.

alignments - A list or iterator returning Alignment objects.
     This should hold ONE and only one Alignment.

Definition at line 72 of file NexusIO.py.

00072                                      :
        """Use this to write an entire file containing the given alignments.

        alignments - A list or iterator returning Alignment objects.
                     This should hold ONE and only one Alignment.
        """
        align_iter = iter(alignments) #Could have been a list
        try :
            first_alignment = align_iter.next()
        except StopIteration :
            first_alignment = None
        if first_alignment is None :
            #Nothing to write!
            return
        
        #Check there is only one alignment...
        try :
            second_alignment = align_iter.next()
        except StopIteration :
            second_alignment = None
        if second_alignment is not None :
            raise ValueError("We can only write one Alignment to a Nexus file.")

        #Good.  Actually write the single alignment,
        self.write_alignment(first_alignment)
        return 1 #we only support writing one alignment!

    def write_alignment(self, alignment) :


Generated by  Doxygen 1.6.0   Back to index