Package Bio :: Package Phylo :: Module NeXML
[hide private]
[frames] | no frames]

Source Code for Module Bio.Phylo.NeXML

 1  # Copyright (C) 2013 Ben Morris (ben@bendmorris.com) 
 2  # based on code by Eric Talevich (eric.talevich@gmail.com) 
 3  # This code is part of the Biopython distribution and governed by its 
 4  # license. Please see the LICENSE file that should have been included 
 5  # as part of this package. 
 6   
 7  """Classes corresponding to NeXML trees. 
 8   
 9  See classes in `Bio.Nexus`: Trees.Tree, Trees.NodeData, and Nodes.Chain. 
10  """ 
11   
12  from Bio.Phylo import BaseTree 
13   
14   
15 -class Tree(BaseTree.Tree):
16 """NeXML Tree object.""" 17
18 - def __init__(self, root=None, rooted=False, id=None, name=None, weight=1.0):
19 BaseTree.Tree.__init__(self, root=root or Clade(), 20 rooted=rooted, id=id, name=name) 21 self.weight = weight
22 23
24 -class Clade(BaseTree.Clade):
25 """NeXML Clade (sub-tree) object.""" 26
27 - def __init__(self, branch_length=1.0, name=None, clades=None, 28 confidence=None, comment=None, **kwargs):
29 BaseTree.Clade.__init__(self, branch_length=branch_length, 30 name=name, clades=clades, confidence=confidence) 31 self.comment = comment 32 33 for key, value in kwargs.items(): 34 setattr(self, key, value)
35