forked from cjb/libnewicktree
-
Notifications
You must be signed in to change notification settings - Fork 1
A standalone Newick tree reader in Java
jboot/libnewicktree
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
What's this? ============ It's a Newick tree parser: http://en.wikipedia.org/wiki/Newick_format This code is *entirely* taken from the TreeJuxtaposer project at: http://olduvai.sourceforge.net/tj/index.shtml I refactored the code to separate UI drawing from parsing and Tree creation, so this code is purely for Newick parsing and tree generation. How can I use it? ================ You could do something like this: Tree treeoflife; int current_depth = 0; void setup() { BufferedReader r = createReader("treeoflife.tree"); TreeParser tp = new TreeParser(r); treeoflife = tp.tokenize(1, "treeoflife", null); int tree_height = treeoflife.getHeight(); System.out.println("largest tree height is: " + tree_height); recursive_print(0, 0); } void recursive_print (int currkey, int currdepth) { TreeNode currNode = treeoflife.getNodeByKey(currkey); int numChildren = currNode.numberChildren(); for (int i = 0; i < numChildren; i++) { int childkey = currNode.getChild(i).key; TreeNode childnode = treeoflife.getNodeByKey(childkey); System.out.println("child name is: " + childnode.getName() + " depth is: " + currdepth); recursive_print(childkey, currdepth+1); } } Who uses it? ============ The need for a standalone parser came from the tree explorer at: http://exploretree.org/ What license is it available under? =================================== The TreeJuxtaposer code is under the BSD license, so this code is too. Who should I contact with a bug report? ======================================= Since I stripped out anything that wasn't necessary for exploretree, you could first see if what you need is present in the main TreeJuxtaposer source. If the bug is only in this library, please contact me at chris-libnewick@printf.net instead of bugging the TreeJuxtaposer folks.
About
A standalone Newick tree reader in Java
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Java 92.3%
- Perl 4.9%
- Shell 2.8%