44 #include "../TreeTemplate.h" 128 Property(
const std::string& pptName,
const std::string& pptTag,
bool pptOnBranch =
false,
short pptType = 0):
151 Nhx(
bool useTagsAsPptNames =
true);
183 void write(
const Tree& tree,
const std::string& path,
bool overwrite =
true)
const throw (Exception)
188 void write(
const Tree& tree, std::ostream& out)
const throw (Exception)
199 void read(
const std::string& path, std::vector<Tree*>& trees)
const throw (Exception)
203 void read(std::istream& in, std::vector<Tree*>& trees)
const throw (Exception);
211 void write(
const std::vector<Tree*>& trees,
const std::string& path,
bool overwrite =
true)
const throw (Exception)
215 void write(
const std::vector<Tree*>& trees, std::ostream& out)
const throw (Exception)
255 void write_(
const Tree& tree, std::ostream& out)
const throw (Exception);
260 void write_(
const std::vector<Tree*>& trees, std::ostream& out)
const throw (Exception);
265 Element
getElement(
const std::string& elt)
const throw (IOException);
275 static std::string
propertyToString_(
const Clonable* pptObject,
short type)
throw (Exception);
276 static Clonable*
stringToProperty_(
const std::string& pptDesc,
short type)
throw (Exception);
void write(const std::vector< Tree *> &trees, std::ostream &out) const =0
Write trees to a stream.
short type
The type of the property. 0 is string, 1 is integer, 2 is double, 3 is boolean.
void changeNamesToTags(Node &node) const
Convert property names from names to tags.
Element getElement(const std::string &elt) const
void write(const Tree &tree, std::ostream &out) const =0
Write a tree to a stream.
Partial implementation of the ITree interface.
The so-called 'Nhx - New Hampshire eXtended' parenthetic format.
bool onBranch
Tells if the property is a branch property instead of a node property.
TreeTemplate< Node > * parenthesisToTree(const std::string &description) const
The phylogenetic tree class.
Interface for phylogenetic tree objects.
void registerProperty(const Property &property)
std::string nodeToParenthesis(const Node &node) const
void write(const Tree &tree, const std::string &path, bool overwrite=true) const
Write a tree to a file.
bool useTagsAsPropertyNames_
std::string tag
The tag of the property, as it will be found in the tree file.
void useTagsAsPropertyNames(bool yn)
const std::string getFormatDescription() const
std::set< Property > supportedProperties_
std::string name
The name of the property, which will be used in parsed trees.
void write(const std::vector< Tree *> &trees, std::ostream &out) const
Write trees to a stream.
const std::string getFormatName() const
void write(const Tree &tree, std::ostream &out) const
Write a tree to a stream.
Node * parenthesisToNode(const std::string &description) const
std::string propertiesToParenthesis(const Node &node) const
void changeTagsToNames(Node &node) const
Convert property names from tag to names.
std::string treeToParenthesis(const TreeTemplate< Node > &tree) const
The phylogenetic node class.
void read(const std::string &path, std::vector< Tree *> &trees) const
Read trees from a file.
virtual Tree * read(std::istream &in) const =0
Read a tree from a stream.
virtual void read(std::istream &in, std::vector< Tree *> &trees) const =0
Read trees from a stream.
TreeTemplate< Node > * read(const std::string &path) const
Read a tree from a file.
Nhx(bool useTagsAsPptNames=true)
Build a new Nhx reader/writer.
void write_(const Tree &tree, std::ostream &out) const
bool setNodeProperties(Node &node, const std::string properties) const
Property(const std::string &pptName, const std::string &pptTag, bool pptOnBranch=false, short pptType=0)
bool useTagsAsPropertyNames() const
Partial implementation of the OTree interface.
void write(const std::vector< Tree *> &trees, const std::string &path, bool overwrite=true) const
Write trees to a file.
bool operator<(const Property &ppt) const
Partial implementation of the OTree interface.
Partial implementation of the IMultiTree interface.
static Clonable * stringToProperty_(const std::string &pptDesc, short type)
static std::string propertyToString_(const Clonable *pptObject, short type)