Next / Previous / Contents / Shipman's homepage

18.2. TaxaTree.setRoot(): Store the root taxon

nomcompile3
# - - -   T a x a T r e e . s e t R o o t

    def setRoot ( self, taxon ):
        '''Store the root taxon.
        '''

There are two conditions for successfully storing the root.

nomcompile3
        #-- 1 --
        if self.root is not None:
            raise ValueError ( "There is already a root taxon: "
                "'%s'" % self.root )
        elif taxon.rank.depth != 0:
            raise ValueError ( "The root taxon must have rank "
                "%s." % self.hier[0] )
        else:
            self.root = taxon