String errormessage;\r
java.io.BufferedReader dataIn=null;\r
public String nextLine() throws IOException {\r
+ if (dataIn==null && newickFile==null)\r
+ throw new IOException("IMPLEMENTATION ERROR: NewickFile has not been initialised for reading a newick string.");\r
if (dataIn==null)\r
{\r
dataIn = new BufferedReader(new StringReader(newickFile));\r
error=false;\r
}\r
- else\r
- throw new IOException("IMPLEMENTATION ERROR: NewickFile has not been initialised for reading a newick string.");\r
if (!error)\r
return dataIn.readLine();\r
throw new IOException("Invalid Source Stream:" + errormessage);\r
System.out.println(trf.print(false, false));\r
System.out.println("With bootstraps and with distances.\n");\r
System.out.println(trf.print(true, true));\r
+ System.out.println("leaves.\n");\r
+ Vector lvs = new Vector();\r
+ trf.findLeaves(trf.root, lvs);\r
+ Enumeration lv =lvs.elements();\r
+ while (lv.hasMoreElements())\r
+ {\r
+ BinaryNode leave = (BinaryNode) lv.nextElement();\r
+ if (leave.getName()!=null)\r
+ {\r
+ System.out.println("Node:'"+leave.getName()+"'");\r
+ }\r
+ } \r
} catch (java.io.IOException e) {\r
System.err.println("Exception\n" + e);\r
e.printStackTrace();\r
/**\r
* make tree node vector from a newick tree structure with associated vamsas objects\r
* @param ntree\r
- * @return\r
+ * @return Treenode definitions for nodes with associated objects\r
+ */\r
+ public Treenode[] makeTreeNodes() {\r
+ return makeTreeNodes(true);\r
+ }\r
+ /**\r
+ * make treenode vector for a parsed tree with/out leaf node associations \r
+ * @param ignoreplaceholders if true means only associated nodes are returned\r
+ * @return treenode vector for associated or all leaves\r
*/\r
- public Treenode[] makeTreeNodes() { \r
+ public Treenode[] makeTreeNodes(boolean ignoreplaceholders) { \r
Vector leaves = new Vector();\r
findLeaves(root, leaves);\r
Vector tnv = new Vector();\r
BinaryNode tnode = (BinaryNode) l.nextElement();\r
if (tnode instanceof SequenceNode)\r
{\r
- if (!((SequenceNode) tnode).isPlaceholder())\r
+ if (!(ignoreplaceholders && ((SequenceNode) tnode).isPlaceholder()))\r
{\r
Object assocseq = ((SequenceNode) tnode).element();\r
if (assocseq instanceof Vobject)\r