biopython v1.71.0 Bio.Phylo.PhyloXMLIO

PhyloXML reader/parser, writer, and associated functions.

Instantiates tree elements from a parsed PhyloXML file, and constructs an XML file from a Bio.Phylo.PhyloXML object.

About capitalization:

  • phyloXML means the file format specification
  • PhyloXML means the Biopython module Bio.Phylo.PhyloXML and its classes
  • Phyloxml means the top-level class used by PhyloXMLIO.read (but not Bio.Phylo.read!), containing a list of Phylogenies (objects derived from BaseTree.Tree)

Link to this section Summary

Functions

Create a dictionary from an object’s specified, non-None attributes

Replace all spans of whitespace with a single space character

Find a child node by tag, and pass it through a constructor

Find a child node by tag; pass its text through a constructor

Find child nodes by tag; pass each through a constructor

Find child nodes by tag; pass each node’s text through a constructor

Add line breaks and indentation to ElementTree in-place

Extract the local tag from a namespaced tag name

Format an XML tag with the given namespace

Replace tab, LF and CR characters with spaces, but don’t collapse

Convert a Python primitive to a phyloXML-compatible Unicode string

Split a tag into namespace and local tag strings

Iterate over the phylogenetic trees in a phyloXML file

Parse a phyloXML file or stream and build a tree of Biopython objects

Write a phyloXML file

Link to this section Functions

Link to this function _clean_attrib()

Create a dictionary from an object’s specified, non-None attributes.

Link to this function _collapse_wspace()

Replace all spans of whitespace with a single space character.

Also remove leading and trailing whitespace. See “Collapse Whitespace Policy” in the phyloXML spec glossary: http://phyloxml.org/documentation/version_100/phyloxml.xsd.html

Link to this function _get_child_as()

Find a child node by tag, and pass it through a constructor.

Returns None if no matching child is found.

Link to this function _get_child_text()

Find a child node by tag; pass its text through a constructor.

Returns None if no matching child is found.

Link to this function _get_children_as()

Find child nodes by tag; pass each through a constructor.

Returns an empty list if no matching child is found.

Link to this function _get_children_text()

Find child nodes by tag; pass each node’s text through a constructor.

Returns an empty list if no matching child is found.

Add line breaks and indentation to ElementTree in-place.

Sources:

  • http://effbot.org/zone/element-lib.htm
  • http://infix.se/2007/02/06/gentlemen-indent-your-xml

Extract the local tag from a namespaced tag name.

Format an XML tag with the given namespace.

Link to this function _replace_wspace()

Replace tab, LF and CR characters with spaces, but don’t collapse.

See “Replace Whitespace Policy” in the phyloXML spec glossary: http://phyloxml.org/documentation/version_100/phyloxml.xsd.html

Convert a Python primitive to a phyloXML-compatible Unicode string.

Link to this function _split_namespace()

Split a tag into namespace and local tag strings.

Iterate over the phylogenetic trees in a phyloXML file.

This ignores any additional data stored at the top level, but may be more memory-efficient than the read function.

:returns: a generator of Bio.Phylo.PhyloXML.Phylogeny objects.

Parse a phyloXML file or stream and build a tree of Biopython objects.

The children of the root node are phylogenies and possibly other arbitrary (non-phyloXML) objects.

:returns: a single Bio.Phylo.PhyloXML.Phyloxml object.

Write a phyloXML file.

:Parameters:

obj
    an instance of `Phyloxml`, `Phylogeny` or `BaseTree.Tree`, or an
    iterable of either of the latter two. The object will be converted
    to a Phyloxml object before serialization.
file
    either an open handle or a file name.