Bio.Phylo.NewickIO module¶
I/O function wrappers for the Newick file format.
See: http://evolution.genetics.washington.edu/phylip/newick_doc.html
-
exception
Bio.Phylo.NewickIO.
NewickError
¶ Bases:
Exception
Exception raised when Newick object construction cannot continue.
-
Bio.Phylo.NewickIO.
parse
(handle, **kwargs)¶ Iterate over the trees in a Newick file handle.
- Returns
generator of Bio.Phylo.Newick.Tree objects.
-
Bio.Phylo.NewickIO.
write
(trees, handle, plain=False, **kwargs)¶ Write a trees in Newick format to the given file handle.
- Returns
number of trees written.
-
class
Bio.Phylo.NewickIO.
Parser
(handle)¶ Bases:
object
Parse a Newick tree given a file handle.
Based on the parser in
Bio.Nexus.Trees
.-
__init__
(self, handle)¶ Initialize file handle for the Newick Tree.
-
classmethod
from_string
(treetext)¶ Instantiate the Newick Tree class from the given string.
-
parse
(self, values_are_confidence=False, comments_are_confidence=False, rooted=False)¶ Parse the text stream this object was initialized with.
-
new_clade
(self, parent=None)¶ Return new Newick.Clade, optionally with temporary reference to parent.
-
process_clade
(self, clade)¶ Remove node’s parent and return it. Final processing of parsed clade.
-
-
class
Bio.Phylo.NewickIO.
Writer
(trees)¶ Bases:
object
Based on the writer in Bio.Nexus.Trees (str, to_string).
-
__init__
(self, trees)¶ Initialize parameter for Tree Writer object.
-
write
(self, handle, **kwargs)¶ Write this instance’s trees to a file handle.
-
to_strings
(self, confidence_as_branch_length=False, branch_length_only=False, plain=False, plain_newick=True, ladderize=None, max_confidence=1.0, format_confidence='%1.2f', format_branch_length='%1.5f')¶ Return an iterable of PAUP-compatible tree lines.
-