Package Bio :: Package Phylo :: Module PhyloXMLIO :: Class Parser
[hide private]
[frames] | no frames]

Class Parser

source code

object --+
         |
        Parser

Methods for parsing all phyloXML nodes from an XML stream.

To minimize memory use, the tree of ElementTree parsing events is cleared after completing each phylogeny, clade, and top-level 'other' element. Elements below the clade level are kept in memory until parsing of the current clade is finished -- this shouldn't be a problem because clade is the only recursive element, and non-clade nodes below this level are of bounded size.

Instance Methods [hide private]
 
__init__(self, file)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
read(self)
Parse the phyloXML file and create a single Phyloxml object.
source code
 
parse(self)
Parse the phyloXML file incrementally and return each phylogeny.
source code
 
_parse_phylogeny(self, parent)
Parse a single phylogeny within the phyloXML tree.
source code
 
_parse_clade(self, parent)
Parse a Clade node and its children, recursively.
source code
 
_parse_sequence(self, parent) source code
 
_parse_taxonomy(self, parent) source code
 
other(self, elem, namespace, localtag) source code
 
accession(self, elem) source code
 
annotation(self, elem) source code
 
binary_characters(self, elem) source code
 
clade_relation(self, elem) source code
 
color(self, elem) source code
 
confidence(self, elem) source code
 
date(self, elem) source code
 
distribution(self, elem) source code
 
domain(self, elem) source code
 
domain_architecture(self, elem) source code
 
events(self, elem) source code
 
id(self, elem) source code
 
mol_seq(self, elem) source code
 
point(self, elem) source code
 
polygon(self, elem) source code
 
property(self, elem) source code
 
reference(self, elem) source code
 
sequence_relation(self, elem) source code
 
uri(self, elem) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  _clade_complex_types = ['color', 'events', 'binary_characters'...
  _clade_list_types = {'confidence': 'confidences', 'distributio...
  _clade_tracked_tags = set(['binary_characters', 'branch_length...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, file)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

_parse_phylogeny(self, parent)

source code 

Parse a single phylogeny within the phyloXML tree.

Recursively builds a phylogenetic tree with help from parse_clade, then clears the XML event history for the phylogeny element and returns control to the top-level parsing function.


Class Variable Details [hide private]

_clade_complex_types

Value:
['color', 'events', 'binary_characters', 'date']

_clade_list_types

Value:
{'confidence': 'confidences',
 'distribution': 'distributions',
 'property': 'properties',
 'reference': 'references'}

_clade_tracked_tags

Value:
set(['binary_characters',
     'branch_length',
     'color',
     'confidence',
     'date',
     'distribution',
     'events',
     'name',
...