Giter Club home page Giter Club logo

libnewicktree's Introduction

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 
[email protected] instead of bugging the TreeJuxtaposer folks.

libnewicktree's People

Contributors

cjb avatar

Watchers

Guangchuang Yu avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.