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

Module _io

source code

I/O function wrappers for phylogenetic tree formats.

This API follows the same semantics as Biopython's SeqIO and AlignIO.

Functions [hide private]
 
parse(file, format, **kwargs)
Iteratively parse a file and return each of the trees it contains.
source code
 
read(file, format, **kwargs)
Parse a file in the given format and return a single tree.
source code
 
write(trees, file, format, **kwargs)
Write a sequence of trees to file in the given format.
source code
 
convert(in_file, in_format, out_file, out_format, **kwargs)
Convert between two tree file formats.
source code
Variables [hide private]
  supported_formats = {'newick': <module 'Bio.Phylo.NewickIO' fr...
  __package__ = 'Bio.Phylo'
Function Details [hide private]

parse(file, format, **kwargs)

source code 

Iteratively parse a file and return each of the trees it contains.

If a file only contains one tree, this still returns an iterable object that contains one element.

Example

>>> trees = parse('../../Tests/PhyloXML/apaf.xml', 'phyloxml')
>>> for tree in trees:
...     print tree.rooted
True

read(file, format, **kwargs)

source code 

Parse a file in the given format and return a single tree.

Raises a ValueError if there are zero or multiple trees -- if this occurs, use parse instead to get the complete sequence of trees.


Variables Details [hide private]

supported_formats

Value:
{'newick': <module 'Bio.Phylo.NewickIO' from '/home/mandrake/rpm/BUILD\
/biopython-1.58/Bio/Phylo/NewickIO.py'>,
 'nexus': <module 'Bio.Phylo.NexusIO' from '/home/mandrake/rpm/BUILD/b\
iopython-1.58/Bio/Phylo/NexusIO.py'>,
 'phyloxml': <module 'Bio.Phylo.PhyloXMLIO' from '/home/mandrake/rpm/B\
UILD/biopython-1.58/Bio/Phylo/PhyloXMLIO.py'>}