Back to index

python-biopython  1.60
Newick.py
Go to the documentation of this file.
00001 # Copyright (C) 2009 by Eric Talevich (eric.talevich@gmail.com)
00002 # This code is part of the Biopython distribution and governed by its
00003 # license. Please see the LICENSE file that should have been included
00004 # as part of this package.
00005 
00006 """Classes corresponding to Newick trees, also used for Nexus trees.
00007 
00008 See classes in `Bio.Nexus`: Trees.Tree, Trees.NodeData, and Nodes.Chain.
00009 """
00010 __docformat__ = "restructuredtext en"
00011 
00012 import warnings
00013 
00014 from Bio.Phylo import BaseTree
00015 
00016 
00017 class Tree(BaseTree.Tree):
00018     """Newick Tree object."""
00019 
00020     def __init__(self, root=None, rooted=False, id=None, name=None, weight=1.0):
00021         BaseTree.Tree.__init__(self, root=root or Clade(),
00022                 rooted=rooted, id=id, name=name)
00023         self.weight = weight
00024 
00025 
00026 class Clade(BaseTree.Clade):
00027     """Newick Clade (sub-tree) object."""
00028 
00029     def __init__(self, branch_length=1.0, name=None, clades=None,
00030                  confidence=None, comment=None):
00031         BaseTree.Clade.__init__(self, branch_length=branch_length,
00032                 name=name, clades=clades, confidence=confidence)
00033         self.comment = comment
00034