bin

biojs-io-newick

Newick Parser in JS - parses newick strings into JSON and JSON into newick

Showing:

Popularity

Downloads/wk

1.2K

GitHub Stars

13

Maintenance

Last Commit

4yrs ago

Contributors

2

Package

Dependencies

0

License

Apache-2.0

Type Definitions

Tree-Shakeable

No?

Categories

Readme

BioJS Newick Parser

How to build it

npm i 
npm start
npm test

Documentation

Now include biojs-io-newick.min.js in the build folder into your html (see example.html). Just call method parse_newick(string) for parsing a newick string into JSON.

var parser = require("biojs-io-newick");
parser.parse_newick('((A,B),C)');

Call the method parse_nhx(string) for parsing an extended newick formats into JSON.

var parser = require("biojs-io-newick");
parser.parse_nhx('((A,B),C)');

Call the method parse_json(string) for parsing a json string back into newick format.

var parser = require("biojs-io-newick");
parser.parse_json(json);

Example tree:

Newick format:

(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5)F

Converted to JSON:

{name : "F",
  children: [
    {name: "A", branch_length: 0.1},
    {name: "B", branch_length: 0.2},
    {
      name: "E",
      length: 0.5,
      children: [
        {name: "C", branch_length: 0.3},
        {name: "D", branch_length: 0.4}
      ]
    }
  ]
}

Contributions

Kudos to @alanrice for the parse_json method

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial