|
bpp-phyl3 3.0.0
|
The so-called 'ExtendedNewick' parenthetic format for phylogenetic networks, where hybridization nodes are mandatory tagged and appear several times. More...
#include <Bpp/Phyl/Io/ExtendedNewick.h>
Inheritance diagram for bpp::ExtendedNewick:
Collaboration diagram for bpp::ExtendedNewick:Public Member Functions | |
| ExtendedNewick (bool allowComments=false, bool writeId=false, bool verbose=false) | |
| Build a new ExtendedNewick reader/writer. More... | |
| virtual | ~ExtendedNewick () |
| void | writePhyloDAGs (const std::vector< const PhyloDAG * > &dags, std::ostream &out) const override |
| Write dags to a stream. More... | |
| virtual void | writePhyloDAGs (const std::vector< const PhyloDAG * > &dags, std::ostream &out) const=0 |
| Write dags to a stream. More... | |
| virtual void | writePhyloDAGs (const std::vector< const PhyloDAG * > &dags, const std::string &path, bool overwrite) const |
| Write dags to a file. More... | |
| virtual const std::string | getDataType () const |
The IODAGraph interface | |
| const std::string | getFormatName () const override |
| const std::string | getFormatDescription () const override |
The ODAGraph interface | |
| void | writePhyloDAG (const PhyloDAG &dag, std::ostream &out) const override |
| Write a PhyloDAG to a stream. More... | |
| virtual void | writePhyloDAG (const PhyloDAG &dag, std::ostream &out) const=0 |
| Write a PhyloDAG to a stream. More... | |
| virtual void | writePhyloDAG (const PhyloDAG &dag, const std::string &path, bool overwrite) const |
| Write a DAG to a file. More... | |
The IMultiDAGraph interface | |
| void | readPhyloDAGs (std::istream &in, std::vector< std::unique_ptr< PhyloDAG > > &dags) const override |
| Read dags from a stream. More... | |
| virtual void | readPhyloDAGs (std::istream &in, std::vector< std::unique_ptr< PhyloDAG > > &dags) const override=0 |
| Read dags from a stream. More... | |
| virtual void | readPhyloDAGs (const std::string &path, std::vector< std::unique_ptr< PhyloDAG > > &dags) const override |
| Read dags from a file. More... | |
Protected Member Functions | |
| void | write_ (const PhyloDAG &tree, std::ostream &out) const |
| void | write_ (const std::vector< const PhyloDAG * > &dags, std::ostream &out) const |
| Element | getElement (const std::string &elt) const override |
| std::string | edgeToParenthesis (const PhyloDAG &dag, std::shared_ptr< PhyloBranch > edge, std::vector< std::shared_ptr< PhyloNode > > &writtenNodes, bool writeId=false) const |
| Get the ExtendedNewick description of a subdag. More... | |
| std::string | dagToParenthesis (const PhyloDAG &dag, bool writeId=false) const |
| Get the parenthesis description of a tree. More... | |
Protected Attributes | |
| bool | allowComments_ |
| bool | writeId_ |
| bool | verbose_ |
The IDAGraph interface | |
| std::unique_ptr< PhyloDAG > | readPhyloDAG (std::istream &in) const override |
| Read a DAG from a stream. More... | |
| std::unique_ptr< PhyloDAG > | parenthesisToPhyloDAG (const std::string &description, bool withId, bool verbose=false) const |
| std::unique_ptr< PhyloDAG > | readPhyloDAG (std::istream &in) const override=0 |
| Read a DAG from a stream. More... | |
| std::unique_ptr< PhyloDAG > | readPhyloDAG (const std::string &path) const override |
| Read a DAG from a file. More... | |
| std::shared_ptr< PhyloNode > | parenthesisToNode (PhyloDAG &dag, std::shared_ptr< PhyloNode > father, const std::string &description, unsigned int &nodeCounter, unsigned int &branchCounter, std::map< std::string, std::shared_ptr< PhyloNode > > &mapEvent, bool withId, bool verbose) const |
The so-called 'ExtendedNewick' parenthetic format for phylogenetic networks, where hybridization nodes are mandatory tagged and appear several times.
Branch values are supported:
ex: ((A:0.1, ((B:0.2, (C:0.3, (D:0.2)Y::H1:0.2):0.1):0.2, (((Y::H1:0.1, E:0.4)h, 6)f)X::H2)c)a, ((X::H2, 7)d, 8)b)r;
Those values can be lengths, or probabilities for hybridization branches, depending on the biological meaning of the network.
Reference : Cardona, G, รณ, F, Valiente, G (2008). Extended Newick: it is time for a standard representation of phylogenetic networks. BMC Bioinformatics, 9:532.
Definition at line 36 of file ExtendedNewick.h.
|
inline |
Build a new ExtendedNewick reader/writer.
Some extendednewick format allow comments between hooks ('[' ']').
| allowComments | Tell if comments between [] are allowed in file. |
| writeId | If true, nodes ids will be written in place of bootstrap values. |
| verbose | If some info should be displayed, such as progress bar etc. |
Definition at line 57 of file ExtendedNewick.h.
|
inlinevirtual |
Definition at line 63 of file ExtendedNewick.h.
|
protected |
Get the parenthesis description of a tree.
| dag | The dag to convert. |
| writeId | Tells if node ids must be printed. Leaves id will be added to the leave names, separated by a '_' character. |
Definition at line 387 of file ExtendedNewick.cpp.
References edgeToParenthesis(), bpp::AssociationDAGraphImplObserver< class, class, class >::getOutgoingEdges(), bpp::AssociationDAGraphImplObserver< class, class, class >::getRoot(), and bpp::AssociationDAGraphImplObserver< class, class, class >::isRooted().
Referenced by write_().
|
protected |
Get the ExtendedNewick description of a subdag.
| dag | The dag to convert. |
| edge | The top of the subdag to convert. |
| writtenNodes | lists nodes already written. |
| writeId | Tells if node ids must be printed. Leaves id will be added to the leave names, separated by a '_' character. |
Definition at line 340 of file ExtendedNewick.cpp.
References edgeToParenthesis(), bpp::AssociationDAGraphImplObserver< class, class, class >::getNodeIndex(), bpp::AssociationDAGraphImplObserver< class, class, class >::getNumberOfSons(), bpp::AssociationDAGraphImplObserver< class, class, class >::getOutgoingEdges(), bpp::AssociationDAGraphImplObserver< class, class, class >::getSon(), and bpp::AssociationDAGraphImplObserver< class, class, class >::isLeaf().
Referenced by dagToParenthesis(), and edgeToParenthesis().
|
inlinevirtualinherited |
Implements bpp::IOFormat.
|
overrideprotectedvirtual |
Reimplemented from bpp::AbstractIPhyloDAG.
Definition at line 104 of file ExtendedNewick.cpp.
References bpp::IODAG::Element::annotation, bpp::IODAG::Element::content, bpp::TextTools::isEmpty(), bpp::IODAG::Element::isLeaf, bpp::IODAG::Element::length, and bpp::TextTools::removeSurroundingWhiteSpaces().
Referenced by parenthesisToNode().
|
overridevirtual |
Implements bpp::IOFormat.
Definition at line 30 of file ExtendedNewick.cpp.
|
overridevirtual |
Implements bpp::IOFormat.
Definition at line 26 of file ExtendedNewick.cpp.
|
private |
Definition at line 167 of file ExtendedNewick.cpp.
References bpp::IODAG::Element::annotation, bpp::IODAG::Element::content, bpp::AssociationDAGraphImplObserver< class, class, class >::createNode(), bpp::ApplicationTools::displayUnlimitedGauge(), getElement(), bpp::StringTokenizer::getToken(), bpp::NestedStringTokenizer::hasMoreToken(), bpp::AssociationDAGraphImplObserver< class, class, class >::hasNodeIndex(), bpp::NodeEvent::hybridizationEvent, bpp::TextTools::isEmpty(), bpp::IODAG::Element::isLeaf, bpp::IODAG::Element::length, bpp::AssociationDAGraphImplObserver< class, class, class >::link(), bpp::NestedStringTokenizer::nextToken(), bpp::StringTokenizer::numberOfRemainingTokens(), parenthesisToNode(), bpp::TextTools::removeSurroundingWhiteSpaces(), bpp::AssociationDAGraphImplObserver< class, class, class >::setEdgeIndex(), bpp::AssociationDAGraphImplObserver< class, class, class >::setNodeIndex(), bpp::TextTools::toDouble(), and bpp::TextTools::toInt().
Referenced by parenthesisToNode(), and parenthesisToPhyloDAG().
| unique_ptr< PhyloDAG > ExtendedNewick::parenthesisToPhyloDAG | ( | const std::string & | description, |
| bool | withId, | ||
| bool | verbose = false |
||
| ) | const |
Definition at line 286 of file ExtendedNewick.cpp.
References bpp::ApplicationTools::message, and parenthesisToNode().
Referenced by readPhyloDAG(), and readPhyloDAGs().
|
inlineoverridevirtual |
Read a DAG from a file.
| path | The file path. |
Reimplemented from bpp::AbstractIPhyloDAG.
|
overridevirtual |
Read a DAG from a stream.
| in | The input stream. |
Implements bpp::AbstractIPhyloDAG.
Definition at line 40 of file ExtendedNewick.cpp.
References allowComments_, bpp::TextTools::isEmpty(), parenthesisToPhyloDAG(), bpp::TextTools::removeSubstrings(), and verbose_.
|
overridevirtual |
Read a DAG from a stream.
| in | The input stream. |
Implements bpp::AbstractIPhyloDAG.
|
inlineoverridevirtual |
Read dags from a file.
| path | The file path. |
| dags | The output dags vector. |
| Exception | If an error occurred. |
Reimplemented from bpp::AbstractIMultiPhyloDAG.
|
overridevirtual |
Read dags from a stream.
| in | The input stream. |
| dags | The output dags container. |
| Exception | If an error occurred. |
Implements bpp::AbstractIMultiPhyloDAG.
Definition at line 73 of file ExtendedNewick.cpp.
References allowComments_, parenthesisToPhyloDAG(), bpp::TextTools::removeSubstrings(), and verbose_.
|
overridevirtual |
Read dags from a stream.
| in | The input stream. |
| dags | The output dags container. |
| Exception | If an error occurred. |
Implements bpp::AbstractIMultiPhyloDAG.
|
protected |
Definition at line 312 of file ExtendedNewick.cpp.
References dagToParenthesis(), and writeId_.
Referenced by writePhyloDAG(), and writePhyloDAGs().
|
protected |
Definition at line 325 of file ExtendedNewick.cpp.
References dagToParenthesis(), and writeId_.
|
inlinevirtual |
Write a DAG to a file.
| dag | a PhyloDAG 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::AbstractOPhyloDAG.
|
inlineoverridevirtual |
Write a PhyloDAG to a stream.
| dag | A PhyloDAG object. |
| out | The output stream. |
| Exception | If an error occurred. |
Implements bpp::AbstractOPhyloDAG.
Definition at line 113 of file ExtendedNewick.h.
References write_().
|
virtual |
Write a PhyloDAG to a stream.
| dag | A PhyloDAG object. |
| out | The output stream. |
| Exception | If an error occurred. |
Implements bpp::AbstractOPhyloDAG.
|
inlinevirtual |
Write dags to a file.
| dags | A vector of dag objects. |
| path | The file path. |
| overwrite | Tell if existing file must be overwritten. Otherwise append to the file. |
Reimplemented from bpp::AbstractOMultiPhyloDAG.
|
inlineoverridevirtual |
Write dags to a stream.
| dags | A vector of dag objects. |
| out | The output stream. |
| Exception | If an error occurred. |
Implements bpp::AbstractOMultiPhyloDAG.
Definition at line 135 of file ExtendedNewick.h.
References write_().
|
virtual |
Write dags to a stream.
| dags | A vector of dag objects. |
| out | The output stream. |
| Exception | If an error occurred. |
Implements bpp::AbstractOMultiPhyloDAG.
|
protected |
Definition at line 43 of file ExtendedNewick.h.
Referenced by readPhyloDAG(), and readPhyloDAGs().
|
protected |
Definition at line 45 of file ExtendedNewick.h.
Referenced by readPhyloDAG(), and readPhyloDAGs().
|
protected |
Definition at line 44 of file ExtendedNewick.h.
Referenced by write_().