bpp-phyl3
3.0.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 () |
std::unique_ptr< Tree > | readTree (std::istream &in) const override |
Read a tree from a stream. More... | |
std::unique_ptr< Tree > | readTree (const std::string &path) const override |
Read a tree from a file. More... | |
virtual std::unique_ptr< TreeTemplate< Node > > | readTreeTemplate (const std::string &path) const |
virtual Element | getElement (const std::string &elt) const |
virtual const std::string | getDataType () const |
virtual void | writeTree (const Tree &tree, const std::string &path, bool overwrite) const |
Write a tree to a file. More... | |
virtual void | readTrees (const std::string &path, std::vector< std::unique_ptr< Tree >> &trees) const override |
Read trees from a file. More... | |
virtual void | writeTrees (const std::vector< const Tree * > &trees, const std::string &path, bool overwrite) const |
Write trees to a file. More... | |
std::unique_ptr< PhyloTree > | readPhyloTree (const std::string &path) const override |
Read a tree from a file. More... | |
Element | getElement (const std::string &elt) const |
virtual void | writePhyloTree (const PhyloTree &tree, const std::string &path, bool overwrite) const |
Write a tree to a file. More... | |
virtual void | readPhyloTrees (const std::string &path, std::vector< std::unique_ptr< PhyloTree >> &trees) const override |
Read trees from a file. More... | |
virtual void | writePhyloTrees (const std::vector< const PhyloTree * > &trees, const std::string &path, bool overwrite) const |
Write trees to a file. More... | |
The IOTree interface | |
const std::string | getFormatName () const override |
const std::string | getFormatDescription () const override |
The ITree interface | |
std::unique_ptr< TreeTemplate< Node > > | readTreeTemplate (std::istream &in) const override |
std::unique_ptr< PhyloTree > | readPhyloTree (std::istream &in) const override |
Read a tree from a stream. More... | |
virtual std::unique_ptr< TreeTemplate< Node > > | readTreeTemplate (std::istream &in) const=0 |
virtual std::unique_ptr< TreeTemplate< Node > > | readTreeTemplate (const std::string &path) const |
std::unique_ptr< PhyloTree > | readPhyloTree (std::istream &in) const override=0 |
std::unique_ptr< PhyloTree > | readPhyloTree (const std::string &path) const override |
The OTree interface | |
void | writeTree (const Tree &tree, std::ostream &out) const override |
Write a tree to a stream. More... | |
void | writePhyloTree (const PhyloTree &tree, std::ostream &out) const override |
Write a tree to a stream. More... | |
virtual void | writeTree (const Tree &tree, std::ostream &out) const=0 |
virtual void | writeTree (const Tree &tree, const std::string &path, bool overwrite) const |
virtual void | writePhyloTree (const PhyloTree &tree, std::ostream &out) const=0 |
virtual void | writePhyloTree (const PhyloTree &tree, const std::string &path, bool overwrite) const |
The IMultiTree interface | |
void | readTrees (std::istream &in, std::vector< std::unique_ptr< Tree >> &trees) const override |
Read trees from a stream. More... | |
void | readPhyloTrees (std::istream &in, std::vector< std::unique_ptr< PhyloTree >> &trees) const override |
Read trees from a stream. More... | |
virtual void | readTrees (std::istream &in, std::vector< std::unique_ptr< Tree >> &trees) const override=0 |
virtual void | readTrees (const std::string &path, std::vector< std::unique_ptr< Tree >> &trees) const override |
virtual void | readPhyloTrees (std::istream &in, std::vector< std::unique_ptr< PhyloTree >> &trees) const override=0 |
virtual void | readPhyloTrees (const std::string &path, std::vector< std::unique_ptr< PhyloTree >> &trees) const override |
The OMultiTree interface | |
void | writeTrees (const std::vector< const Tree * > &trees, std::ostream &out) const override |
Write trees to a stream. More... | |
void | writePhyloTrees (const std::vector< const PhyloTree * > &trees, std::ostream &out) const override |
Write trees to a stream. More... | |
virtual void | writeTrees (const std::vector< const Tree * > &trees, std::ostream &out) const=0 |
virtual void | writeTrees (const std::vector< const Tree * > &trees, const std::string &path, bool overwrite) const |
virtual void | writePhyloTrees (const std::vector< const PhyloTree * > &trees, std::ostream &out) const=0 |
virtual void | writePhyloTrees (const std::vector< const PhyloTree * > &trees, const std::string &path, bool overwrite) const |
Protected Member Functions | |
void | write_ (const Tree &tree, std::ostream &out) const |
void | write_ (const PhyloTree &tree, std::ostream &out) const |
template<class N > | |
void | write_ (const TreeTemplate< N > &tree, std::ostream &out) const |
void | write_ (const std::vector< const Tree * > &trees, std::ostream &out) const |
void | write_ (const std::vector< const PhyloTree * > &trees, std::ostream &out) const |
template<class N > | |
void | write_ (const std::vector< TreeTemplate< N > * > &trees, std::ostream &out) const |
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 27 of file NexusIoTree.h.
|
inline |
Build a new Nexus tree parser.
Definition at line 41 of file NexusIoTree.h.
|
inlinevirtual |
Definition at line 43 of file NexusIoTree.h.
|
inlinevirtualinherited |
Implements bpp::IOFormat.
|
inlinevirtualinherited |
Reimplemented in bpp::Nhx, and bpp::Newick.
|
inlineinherited |
|
overridevirtual |
Implements bpp::IOFormat.
Definition at line 36 of file NexusIoTree.cpp.
|
overridevirtual |
Implements bpp::IOFormat.
Definition at line 32 of file NexusIoTree.cpp.
|
inlineoverridevirtualinherited |
Read a tree from a file.
path | The file path. |
Exception | If an error occurred. |
Implements bpp::IPhyloTree.
Definition at line 235 of file IoTree.h.
References bpp::AbstractIPhyloTree::readPhyloTree().
|
inlineoverride |
|
overridevirtual |
Read a tree from a stream.
in | The input stream. |
Exception | If an error occurred. |
Implements bpp::AbstractIPhyloTree.
Definition at line 140 of file NexusIoTree.cpp.
|
override |
|
inlineoverridevirtualinherited |
Read trees from a file.
path | The file path. |
trees | The output trees container. |
Exception | If an error occurred. |
Implements bpp::IMultiPhyloTree.
Definition at line 485 of file IoTree.h.
References bpp::AbstractIMultiPhyloTree::readPhyloTrees().
|
inlineoverride |
|
overridevirtual |
Read trees from a stream.
in | The input stream. |
trees | The output trees container. |
Exception | If an error occurred. |
Implements bpp::AbstractIMultiPhyloTree.
Definition at line 151 of file NexusIoTree.cpp.
References bpp::NexusTools::getNextCommand(), bpp::FileTools::getNextLine(), bpp::StringTokenizer::hasMoreToken(), bpp::NestedStringTokenizer::nextToken(), bpp::StringTokenizer::nextToken(), bpp::NestedStringTokenizer::numberOfRemainingTokens(), bpp::Newick::readPhyloTree(), bpp::TextTools::removeSurroundingWhiteSpaces(), and bpp::TextTools::toUpper().
|
override |
|
inlineoverridevirtualinherited |
Read a tree from a file.
path | The file path. |
Exception | If an error occurred. |
Implements bpp::ITree.
Definition at line 201 of file IoTree.h.
References bpp::AbstractITree::readTree().
|
inlineoverridevirtualinherited |
Read a tree from a stream.
in | The input stream. |
Exception | If an error occurred. |
Implements bpp::ITree.
Definition at line 195 of file IoTree.h.
References bpp::AbstractITree::readTreeTemplate().
Referenced by bpp::AbstractITree::readTree().
|
inlineoverridevirtualinherited |
Read trees from a file.
path | The file path. |
trees | The output trees container. |
Exception | If an error occurred. |
Implements bpp::IMultiTree.
Definition at line 464 of file IoTree.h.
References bpp::AbstractIMultiTree::readTrees().
|
inlineoverride |
|
overridevirtual |
Read trees from a stream.
in | The input stream. |
trees | The output trees container. |
Exception | If an error occurred. |
Implements bpp::AbstractIMultiTree.
Definition at line 57 of file NexusIoTree.cpp.
References bpp::NexusTools::getNextCommand(), bpp::FileTools::getNextLine(), bpp::StringTokenizer::hasMoreToken(), bpp::NestedStringTokenizer::nextToken(), bpp::StringTokenizer::nextToken(), bpp::NestedStringTokenizer::numberOfRemainingTokens(), bpp::TreeTemplateTools::parenthesisToTree(), bpp::TextTools::removeSurroundingWhiteSpaces(), and bpp::TextTools::toUpper().
|
override |
|
inlinevirtualinherited |
Definition at line 211 of file IoTree.h.
References bpp::AbstractITree::readTreeTemplate().
|
inline |
|
overridevirtual |
Implements bpp::AbstractITree.
Definition at line 45 of file NexusIoTree.cpp.
virtual std::unique_ptr<TreeTemplate<Node> > bpp::AbstractITree::readTreeTemplate |
|
protected |
Definition at line 249 of file NexusIoTree.cpp.
|
protected |
Definition at line 335 of file NexusIoTree.cpp.
References bpp::PhyloTree::clone(), count(), bpp::AssociationTreeGraphImplObserver< class, class, class >::getNode(), bpp::TextTools::toString(), bpp::VectorTools::vectorUnion(), and bpp::Newick::writePhyloTree().
|
protected |
Definition at line 268 of file NexusIoTree.cpp.
References count(), bpp::Tree::getNodeName(), bpp::Tree::setNodeName(), bpp::TextTools::toString(), bpp::TreeTools::treeToParenthesis(), and bpp::VectorTools::vectorUnion().
|
protected |
Definition at line 409 of file NexusIoTree.cpp.
References count(), bpp::Tree::getNodeName(), bpp::Tree::setNodeName(), bpp::TextTools::toString(), bpp::TreeTemplateTools::treeToParenthesis(), and bpp::VectorTools::vectorUnion().
|
protected |
Definition at line 240 of file NexusIoTree.cpp.
Referenced by writePhyloTree(), writePhyloTrees(), writeTree(), and writeTrees().
|
protected |
Definition at line 259 of file NexusIoTree.cpp.
|
inlinevirtualinherited |
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 occurred. |
Implements bpp::OPhyloTree.
Definition at line 297 of file IoTree.h.
References bpp::IOException::what(), and bpp::AbstractOPhyloTree::writePhyloTree().
|
inline |
|
inlineoverridevirtual |
Write a tree to a stream.
tree | A tree object. |
out | The output stream. |
Exception | If an error occurred. |
Implements bpp::AbstractOPhyloTree.
Definition at line 84 of file NexusIoTree.h.
References write_().
virtual void bpp::AbstractOPhyloTree::writePhyloTree |
|
inlinevirtualinherited |
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 occurred. |
Implements bpp::OMultiPhyloTree.
Definition at line 528 of file IoTree.h.
References bpp::AbstractOMultiPhyloTree::writePhyloTrees().
|
inline |
|
inlineoverridevirtual |
Write trees to a stream.
trees | A vector of tree objects. |
out | The output stream. |
Exception | If an error occurred. |
Implements bpp::AbstractOMultiPhyloTree.
Definition at line 118 of file NexusIoTree.h.
References write_().
virtual void bpp::AbstractOMultiPhyloTree::writePhyloTrees |
|
inlinevirtualinherited |
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 occurred. |
Implements bpp::OTree.
Definition at line 263 of file IoTree.h.
References bpp::IOException::what(), and bpp::AbstractOTree::writeTree().
|
inlineoverridevirtual |
Write a tree to a stream.
tree | A tree object. |
out | The output stream. |
Exception | If an error occurred. |
Implements bpp::AbstractOTree.
Definition at line 77 of file NexusIoTree.h.
References write_().
virtual void bpp::AbstractOTree::writeTree |
|
inlinevirtualinherited |
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 occurred. |
Implements bpp::OMultiTree.
Definition at line 505 of file IoTree.h.
References bpp::AbstractOMultiTree::writeTrees().
|
inlineoverridevirtual |
Write trees to a stream.
trees | A vector of tree objects. |
out | The output stream. |
Exception | If an error occurred. |
Implements bpp::AbstractOMultiTree.
Definition at line 111 of file NexusIoTree.h.
References write_().
virtual void bpp::AbstractOMultiTree::writeTrees |