bpp-phyl
2.2.0
|
The so-called 'newick' parenthetic format. More...
#include <Bpp/Phyl/Io/Newick.h>
Public Member Functions | |
Newick (bool allowComments=false, bool writeId=false) | |
Build a new Newick reader/writer. More... | |
virtual | ~Newick () |
void | enableExtendedBootstrapProperty (const std::string &propertyName) |
void | disableExtendedBootstrapProperty () |
virtual const std::string | getDataType () const |
The IOTree interface | |
const std::string | getFormatName () const |
const std::string | getFormatDescription () const |
The ITree interface | |
TreeTemplate< Node > * | read (const std::string &path) const throw (Exception) |
Read a tree from a file. More... | |
TreeTemplate< Node > * | read (std::istream &in) const throw (Exception) |
Read a tree from a stream. More... | |
The OTree interface | |
void | write (const Tree &tree, const std::string &path, bool overwrite=true) const throw (Exception) |
Write a tree to a file. More... | |
void | write (const Tree &tree, std::ostream &out) const throw (Exception) |
Write a tree to a stream. More... | |
The IMultiTree interface | |
void | read (const std::string &path, std::vector< Tree *> &trees) const throw (Exception) |
Read trees from a file. More... | |
void | read (std::istream &in, std::vector< Tree *> &trees) const throw (Exception) |
Read trees from a stream. More... | |
The OMultiTree interface | |
void | write (const std::vector< Tree *> &trees, const std::string &path, bool overwrite=true) const throw (Exception) |
Write trees to a file. More... | |
void | write (const std::vector< Tree *> &trees, std::ostream &out) const throw (Exception) |
Write trees to a stream. More... | |
Protected Member Functions | |
void | write_ (const Tree &tree, std::ostream &out) const throw (Exception) |
template<class N > | |
void | write_ (const TreeTemplate< N > &tree, std::ostream &out) const throw (Exception) |
void | write_ (const std::vector< Tree *> &trees, std::ostream &out) const throw (Exception) |
template<class N > | |
void | write_ (const std::vector< TreeTemplate< N > *> &trees, std::ostream &out) const throw (Exception) |
Protected Attributes | |
bool | allowComments_ |
bool | writeId_ |
bool | useBootstrap_ |
std::string | bootstrapPropertyName_ |
The so-called 'newick' parenthetic format.
Branch lengths and bootstraps are supported:
ex: ((A:0.1, B:0.15)90:0.2, C:0.27);
Code example:
Bootstrap values are stored as node properties, as Number<double> objects and with the tag TreeTools::BOOTSTRAP.
This is also possible to read a "tagged" tree, where additional info is provided in place of bootstrap values: ((A,B)N2,(C,D)N3)N1; This is achieved by calling the enableExtendedBootstrapProperty method, and providing a property name to use. The additional information will be stored at each node as a property, in a String object. The disableExtendedBootstrapProperty method restores the default behavior.
|
inline |
|
inline |
Definition at line 120 of file Newick.h.
References bpp::TreeTools::BOOTSTRAP, bootstrapPropertyName_, and useBootstrap_.
|
inline |
Definition at line 115 of file Newick.h.
References bootstrapPropertyName_, and useBootstrap_.
|
inlinevirtualinherited |
const string Newick::getFormatDescription | ( | ) | const |
Definition at line 61 of file Newick.cpp.
const string Newick::getFormatName | ( | ) | const |
Definition at line 57 of file Newick.cpp.
|
inlinevirtual |
Read a tree from a file.
path | The file path. |
Exception | If an error occured. |
Reimplemented from bpp::AbstractITree.
Definition at line 140 of file Newick.h.
References bpp::AbstractITree::read().
|
virtual |
Read a tree from a stream.
in | The input stream. |
Exception | If an error occured. |
Implements bpp::AbstractITree.
Definition at line 74 of file Newick.cpp.
References bpp::TreeTemplateTools::parenthesisToTree().
|
inlinevirtual |
Read trees from a file.
path | The file path. |
trees | The output trees container. |
Exception | If an error occured. |
Reimplemented from bpp::AbstractIMultiTree.
Definition at line 169 of file Newick.h.
References bpp::AbstractIMultiTree::read().
|
virtual |
Read trees from a stream.
in | The input stream. |
trees | The output trees container. |
Exception | If an error occured. |
Implements bpp::AbstractIMultiTree.
Definition at line 134 of file Newick.cpp.
References bpp::TreeTemplateTools::parenthesisToTree().
|
inlinevirtual |
Write a tree to a file.
tree | A tree object. |
path | The file path. |
overwrite | Tell if existing file must be overwritten. Otherwise append to the file. |
Exception | If an error occured. |
Reimplemented from bpp::AbstractOTree.
Definition at line 153 of file Newick.h.
References bpp::AbstractOTree::write().
|
inlinevirtual |
Write a tree to a stream.
tree | A tree object. |
out | The output stream. |
Exception | If an error occured. |
Implements bpp::AbstractOTree.
Definition at line 158 of file Newick.h.
References write_().
|
inlinevirtual |
Write trees to a file.
trees | A vector of tree objects. |
path | The file path. |
overwrite | Tell if existing file must be overwritten. Otherwise append to the file. |
Exception | If an error occured. |
Reimplemented from bpp::AbstractOMultiTree.
Definition at line 181 of file Newick.h.
References bpp::AbstractOMultiTree::write().
|
inlinevirtual |
Write trees to a stream.
trees | A vector of tree objects. |
out | The output stream. |
Exception | If an error occured. |
Implements bpp::AbstractOMultiTree.
Definition at line 185 of file Newick.h.
References write_().
|
protected |
Definition at line 101 of file Newick.cpp.
References bpp::TreeTools::treeToParenthesis().
Referenced by write().
|
protected |
Definition at line 118 of file Newick.cpp.
References bpp::TreeTemplateTools::treeToParenthesis().
|
protected |
Definition at line 160 of file Newick.cpp.
References bpp::TreeTools::treeToParenthesis().
|
protected |
Definition at line 180 of file Newick.cpp.
References bpp::TreeTemplateTools::treeToParenthesis().
|
protected |
Definition at line 93 of file Newick.h.
Referenced by disableExtendedBootstrapProperty(), and enableExtendedBootstrapProperty().
|
protected |
Definition at line 92 of file Newick.h.
Referenced by disableExtendedBootstrapProperty(), and enableExtendedBootstrapProperty().