Socket
Socket
Sign inDemoInstall

biojs-io-newick

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    biojs-io-newick

Parses newick strings into JSON and JSON into newick


Version published
Weekly downloads
163
decreased by-40.73%
Maintainers
1
Install size
30.7 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 21 Feb 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc