|
bpp-phyl3 3.0.0
|
a simple parser for reading trees from a Nexus file. More...
#include <Bpp/Phyl/Io/NexusIoTree.h>
Inheritance diagram for bpp::NexusIOTree:
Collaboration diagram for bpp::NexusIOTree: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 Element | getElement (const std::string &elt) const |
| virtual const std::string | getDataType () const |
| Element | getElement (const std::string &elt) const |
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 |
| Read a tree from a stream. More... | |
| std::unique_ptr< PhyloTree > | readPhyloTree (const std::string &path) const override |
| Read a tree from a file. More... | |
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 |
| Write a tree to a stream. More... | |
| virtual void | writeTree (const Tree &tree, const std::string &path, bool overwrite) const |
| Write a tree to a file. More... | |
| virtual void | writePhyloTree (const PhyloTree &tree, std::ostream &out) const=0 |
| Write a tree to a stream. More... | |
| virtual void | writePhyloTree (const PhyloTree &tree, const std::string &path, bool overwrite) const |
| Write a tree to a file. More... | |
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 |
| Read trees from a stream. 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 | readPhyloTrees (std::istream &in, std::vector< std::unique_ptr< PhyloTree > > &trees) const override=0 |
| Read trees from a stream. More... | |
| virtual void | readPhyloTrees (const std::string &path, std::vector< std::unique_ptr< PhyloTree > > &trees) const override |
| Read trees from a file. More... | |
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 |
| Write trees to a stream. More... | |
| virtual void | writeTrees (const std::vector< const Tree * > &trees, const std::string &path, bool overwrite) const |
| Write trees to a file. More... | |
| virtual void | writePhyloTrees (const std::vector< const PhyloTree * > &trees, std::ostream &out) const=0 |
| Write trees to a stream. More... | |
| virtual void | writePhyloTrees (const std::vector< const PhyloTree * > &trees, const std::string &path, bool overwrite) const |
| Write trees to a file. More... | |
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::Newick, and bpp::Nhx.
|
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.
|
inlineoverridevirtual |
Read a tree from a file.
| path | The file path. |
| Exception | If an error occurred. |
Reimplemented from bpp::AbstractIPhyloTree.
|
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.
References readPhyloTrees().
|
overridevirtual |
Read a tree from a stream.
| in | The input stream. |
| Exception | If an error occurred. |
Implements bpp::AbstractIPhyloTree.
|
inlineoverridevirtual |
Read trees from a file.
| path | The file path. |
| trees | The output trees container. |
| Exception | If an error occurred. |
Reimplemented from bpp::AbstractIMultiPhyloTree.
|
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().
Referenced by readPhyloTree().
|
overridevirtual |
Read trees from a stream.
| in | The input stream. |
| trees | The output trees container. |
| Exception | If an error occurred. |
Implements bpp::AbstractIMultiPhyloTree.
|
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().
|
inlineoverridevirtual |
Read trees from a file.
| path | The file path. |
| trees | The output trees container. |
| Exception | If an error occurred. |
Reimplemented from bpp::AbstractIMultiTree.
|
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().
Referenced by readTreeTemplate().
|
overridevirtual |
Read trees from a stream.
| in | The input stream. |
| trees | The output trees container. |
| Exception | If an error occurred. |
Implements bpp::AbstractIMultiTree.
|
inlinevirtual |
Reimplemented from bpp::AbstractITree.
|
overridevirtual |
Implements bpp::AbstractITree.
Definition at line 45 of file NexusIoTree.cpp.
References readTrees().
|
virtual |
Implements bpp::AbstractITree.
|
protected |
Definition at line 249 of file NexusIoTree.cpp.
References writePhyloTrees().
|
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.
References writeTrees().
Referenced by writePhyloTree(), writePhyloTrees(), writeTree(), and writeTrees().
|
protected |
Definition at line 259 of file NexusIoTree.cpp.
References writeTrees().
|
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 occurred. |
Reimplemented from bpp::AbstractOPhyloTree.
|
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 |
Write a tree to a stream.
| tree | A tree object. |
| out | The output stream. |
| Exception | If an error occurred. |
Implements bpp::AbstractOPhyloTree.
|
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 occurred. |
Reimplemented from bpp::AbstractOMultiPhyloTree.
|
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_().
Referenced by write_().
|
virtual |
Write trees to a stream.
| trees | A vector of tree objects. |
| out | The output stream. |
| Exception | If an error occurred. |
Implements bpp::AbstractOMultiPhyloTree.
|
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 occurred. |
Reimplemented from bpp::AbstractOTree.
|
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 |
Write a tree to a stream.
| tree | A tree object. |
| out | The output stream. |
| Exception | If an error occurred. |
Implements bpp::AbstractOTree.
|
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 occurred. |
Reimplemented from bpp::AbstractOMultiTree.
|
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_().
Referenced by write_().
|
virtual |
Write trees to a stream.
| trees | A vector of tree objects. |
| out | The output stream. |
| Exception | If an error occurred. |
Implements bpp::AbstractOMultiTree.