Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
Bio.Phylo.PhyloXML.Phyloxml Class Reference
Inheritance diagram for Bio.Phylo.PhyloXML.Phyloxml:
Inheritance graph
[legend]
Collaboration diagram for Bio.Phylo.PhyloXML.Phyloxml:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __getitem__
def __iter__
def __len__
def __str__
def __repr__

Public Attributes

 attributes
 phylogenies
 other

Detailed Description

Root node of the PhyloXML document.

Contains an arbitrary number of Phylogeny elements, possibly followed by
elements from other namespaces.

:Parameters:
    attributes : dict
        (XML namespace definitions)
    phylogenies : list
        The phylogenetic trees
    other : list
        Arbitrary non-phyloXML elements, if any

Definition at line 48 of file PhyloXML.py.


Constructor & Destructor Documentation

def Bio.Phylo.PhyloXML.Phyloxml.__init__ (   self,
  attributes,
  phylogenies = None,
  other = None 
)

Definition at line 62 of file PhyloXML.py.

00062 
00063     def __init__(self, attributes, phylogenies=None, other=None):
00064         self.attributes = {
00065                 "xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance", # standard
00066                 "xmlns": "http://www.phyloxml.org",
00067                 "xsi:schemaLocation": "http://www.phyloxml.org http://www.phyloxml.org/1.10/phyloxml.xsd",
00068                 }
00069         if attributes:
00070             self.attributes.update(attributes)
00071         self.phylogenies = phylogenies or []
00072         self.other = other or []


Member Function Documentation

def Bio.Phylo.PhyloXML.Phyloxml.__getitem__ (   self,
  index 
)
Get a phylogeny by index or name.

Definition at line 73 of file PhyloXML.py.

00073 
00074     def __getitem__(self, index):
00075         """Get a phylogeny by index or name."""
00076         if isinstance(index, int) or isinstance(index, slice):
00077             return self.phylogenies[index]
00078         if not isinstance(index, basestring):
00079             raise KeyError("can't use %s as an index" % type(index))
00080         for tree in self.phylogenies:
00081             if tree.name == index:
00082                 return tree
00083         else:
00084             raise KeyError("no phylogeny found with name " + repr(index))

Here is the caller graph for this function:

Iterate through the phylogenetic trees in this object.

Definition at line 85 of file PhyloXML.py.

00085 
00086     def __iter__(self):
00087         """Iterate through the phylogenetic trees in this object."""
00088         return iter(self.phylogenies)

Here is the caller graph for this function:

Number of phylogenetic trees in this object.

Definition at line 89 of file PhyloXML.py.

00089 
00090     def __len__(self):
00091         """Number of phylogenetic trees in this object."""
00092         return len(self.phylogenies)

def Bio.Phylo.BaseTree.TreeElement.__repr__ (   self) [inherited]
Show this object's constructor with its primitive arguments.

Definition at line 216 of file BaseTree.py.

00216 
00217     def __repr__(self):
00218         """Show this object's constructor with its primitive arguments."""
00219         def pair_as_kwarg_string(key, val):
00220             if isinstance(val, basestring):
00221                 return "%s='%s'" % (key, _sugar.trim_str(unicode(val)))
00222             return "%s=%s" % (key, val)
00223         return u'%s(%s)' % (self.__class__.__name__,
00224                             ', '.join(pair_as_kwarg_string(key, val)
00225                                   for key, val in self.__dict__.iteritems()
00226                                   if val is not None and
00227                                   type(val) in (str, int, float, bool, unicode)
00228                                   ))

Definition at line 93 of file PhyloXML.py.

00093 
00094     def __str__(self):
00095         return '%s([%s])' % (self.__class__.__name__,
00096                              ',\n'.join(map(str, self.phylogenies)))
00097 


Member Data Documentation

Definition at line 63 of file PhyloXML.py.

Definition at line 71 of file PhyloXML.py.

Definition at line 70 of file PhyloXML.py.


The documentation for this class was generated from the following file: