bpp-phyl
2.2.0
|
a simple parser for reading trees from a Nexus file. More...
#include <Bpp/Phyl/Io/NexusIoTree.h>
Public Member Functions | |
NexusIOTree () | |
Build a new Nexus tree parser. More... | |
virtual | ~NexusIOTree () |
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) |
a simple parser for reading trees from a Nexus file.
This reader is not supposed to be a full parser of the Nexus files, but only extract the tree data. Only a basic subset of the options are and will be supported.
This format is described in the following paper: Maddison D, Swofford D, and Maddison W (1997), Syst Biol 46(4):590-621
Definition at line 61 of file NexusIoTree.h.
|
inline |
Build a new Nexus tree parser.
Definition at line 72 of file NexusIoTree.h.
|
inlinevirtual |
Definition at line 74 of file NexusIoTree.h.
|
inlinevirtualinherited |
const string NexusIOTree::getFormatDescription | ( | ) | const |
Definition at line 68 of file NexusIoTree.cpp.
const string NexusIOTree::getFormatName | ( | ) | const |
Definition at line 64 of file NexusIoTree.cpp.
|
inlinevirtual |
Read a tree from a file.
path | The file path. |
Exception | If an error occured. |
Reimplemented from bpp::AbstractITree.
Definition at line 98 of file NexusIoTree.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 80 of file NexusIoTree.cpp.
|
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 132 of file NexusIoTree.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 93 of file NexusIoTree.cpp.
References bpp::TreeTemplate< N >::getLeaves(), and 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 117 of file NexusIoTree.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 121 of file NexusIoTree.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 144 of file NexusIoTree.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 148 of file NexusIoTree.h.
References write_().
|
protected |
Definition at line 172 of file NexusIoTree.cpp.
Referenced by write().
|
protected |
Definition at line 182 of file NexusIoTree.cpp.
|
protected |
Definition at line 191 of file NexusIoTree.cpp.
References bpp::Tree::getNodeName(), bpp::Tree::setNodeName(), and bpp::TreeTools::treeToParenthesis().
|
protected |
Definition at line 256 of file NexusIoTree.cpp.
References bpp::Tree::getNodeName(), bpp::Tree::setNodeName(), and bpp::TreeTemplateTools::treeToParenthesis().