public class TreesBlock extends NexusBlock.Abstract
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
TreesBlock.NewickTreeString
A simple representation of a Newick tree as a single string. 
 | 
NexusBlock.Abstract| Modifier and Type | Field and Description | 
|---|---|
static String | 
TREES_BLOCK
A constant representing the name of Trees blocks. 
 | 
| Constructor and Description | 
|---|
TreesBlock()
Delegates to NexusBlock.Abstract constructor using TreesBlock.TREES_BLOCK
 as the name. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addComment(NexusComment comment)
Adds a comment. 
 | 
void | 
addTranslation(String label,
              String taxa)
Add a translation. 
 | 
void | 
addTree(String label,
       TreesBlock.NewickTreeString tree)
Adds a tree. 
 | 
void | 
addTree(String label,
       org.jgrapht.WeightedGraph<String,org.jgrapht.graph.DefaultWeightedEdge> treegraph)
Deprecated.   
 | 
void | 
addTree(String label,
       org.jgrapht.WeightedGraph<String,org.jgrapht.graph.DefaultWeightedEdge> treegraph,
       String topLabel)
Add a tree, converting weighted graph (JGraphT) to NewickString. 
 | 
boolean | 
containsTranslation(String label)
Checks to see if we contain the given translation. 
 | 
boolean | 
containsTree(String label)
Checks to see if we contain the given tree. 
 | 
List | 
getComments()
Returns all comments. 
 | 
String | 
getNodePrefix()
Returns the node prefix. 
 | 
String | 
getTopNode()
Returns the top node of the previously requested graph. 
 | 
Map | 
getTranslations()
Get the translations added so far. 
 | 
Object | 
getTree(String label)
Returns a tree for given label 
 | 
org.jgrapht.WeightedGraph<String,org.jgrapht.graph.DefaultWeightedEdge> | 
getTreeAsWeightedJGraphT(String label)
Get given (NewickString) tree by label, converts it to weighted graph (JGraphT). 
 | 
Map | 
getTrees()
Returns all trees. 
 | 
String | 
getTreeText(org.jgrapht.UndirectedGraph<String,org.jgrapht.graph.DefaultEdge> treegraph,
           String node,
           String parent)  | 
String | 
getTreeText(org.jgrapht.WeightedGraph<String,org.jgrapht.graph.DefaultWeightedEdge> treegraph,
           String node,
           String parent)  | 
void | 
removeComment(NexusComment comment)
Removes a comment. 
 | 
void | 
removeTranslation(String label)
Removes the given translation. 
 | 
void | 
removeTree(String label)
Removes a tree. 
 | 
void | 
setNodePrefix(String prefix)
Sets the node prefix of intermediate nodes for returned graphs. 
 | 
protected void | 
writeBlockContents(Writer writer)
Implement this to write out block contents, not including the BEGIN
 and END tags. 
 | 
getBlockName, writeObject, writeTokenpublic static final String TREES_BLOCK
public TreesBlock()
public void addTranslation(String label, String taxa)
label - the label to add.taxa - the taxa name this label will represent.public void removeTranslation(String label)
label - the label to remove.public boolean containsTranslation(String label)
label - the label to check for.public Map getTranslations()
public void addTree(String label, TreesBlock.NewickTreeString tree)
label - the label to give the tree.tree - the tree to add.public void removeTree(String label)
label - the label to remove.public boolean containsTree(String label)
label - the label to check for.public Object getTree(String label)
label - the label to select.public String getTreeText(org.jgrapht.UndirectedGraph<String,org.jgrapht.graph.DefaultEdge> treegraph, String node, String parent)
public void addTree(String label, org.jgrapht.WeightedGraph<String,org.jgrapht.graph.DefaultWeightedEdge> treegraph)
label - the label to addtreegraph - the treegraph to convert.public String getTreeText(org.jgrapht.WeightedGraph<String,org.jgrapht.graph.DefaultWeightedEdge> treegraph, String node, String parent)
public void addTree(String label, org.jgrapht.WeightedGraph<String,org.jgrapht.graph.DefaultWeightedEdge> treegraph, String topLabel)
label - the label to addtreegraph - the treegraph to convert.topLabel - the label of the top (root if rooted tree) node.public org.jgrapht.WeightedGraph<String,org.jgrapht.graph.DefaultWeightedEdge> getTreeAsWeightedJGraphT(String label) throws ParseException
label - label for tree selectionParseExceptionpublic void addComment(NexusComment comment)
comment - the comment to add.public void removeComment(NexusComment comment)
comment - the comment to remove.public List getComments()
protected void writeBlockContents(Writer writer) throws IOException
NexusBlock.AbstractwriteBlockContents in class NexusBlock.Abstractwriter - the writer to write to.IOException - if writing failed.public String getTopNode()
#getTreeAsJGraphT(java.lang.String)
 and getTreeAsWeightedJGraphT(java.lang.String) might vary,
 and this function will return the top node of the previously called
 method only. If no method was called, null is returned.
 Note: the top node between graphs, probably does not vary, but,
 just in case, the note is here and the user should get a different
 top for each type of graph.public void setNodePrefix(String prefix)
prefix - The prefixpublic String getNodePrefix()
Copyright © 2020 BioJava. All rights reserved.