Bio.Phylo.NeXMLIO module

I/O function wrappers for the NeXML file format.



Given a prefixed URI, return the full URI.


Optionally converts a CDAO-prefixed URI into an OBO-prefixed URI.


Check for matches in both CDAO and OBO namespaces.

exception Bio.Phylo.NeXMLIO.NeXMLError

Bases: Exception

Exception raised when NeXML object construction cannot continue.

Bio.Phylo.NeXMLIO.parse(handle, **kwargs)

Iterate over the trees in a NeXML file handle.


generator of Bio.Phylo.NeXML.Tree objects.

Bio.Phylo.NeXMLIO.write(trees, handle, plain=False, **kwargs)

Write a trees in NeXML format to the given file handle.


number of trees written.

class Bio.Phylo.NeXMLIO.Parser(handle)

Bases: object

Parse a NeXML tree given a file handle.

Based on the parser in Bio.Nexus.Trees.

__init__(self, handle)

Initialize parameters for NeXML file parser.

classmethod from_string(treetext)

Convert file handle to StringIO object.

add_annotation(self, node_dict, meta_node)

Add annotations for the NeXML parser.

parse(self, values_are_confidence=False, rooted=False)

Parse the text stream this object was initialized with.

class Bio.Phylo.NeXMLIO.Writer(trees)

Bases: object

Based on the writer in Bio.Nexus.Trees (str, to_string).

__init__(self, trees)

Initialize parameters for NeXML writer.

new_label(self, obj_type)

Create new labels for the NeXML writer.

write(self, handle, cdao_to_obo=True, **kwargs)

Write this instance’s trees to a file handle.