Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

petrie

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

petrie

a graph-based phylogenetic tree, implemented in Javascript.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Petrie

petrie

a Graph-based phylogenetic tree, implemented in Javascript.

Phylogeny and Taxonomy

Whether your purposes are phylogenetic or taxonomic in nature doesn't matter. That is, whether you are making a evolutional tree, or a species classification tree. Your source of graph data will determine the utility.

  • https://en.wikipedia.org/wiki/Phylogenetic_tree
  • https://en.wikipedia.org/wiki/Taxonomic_rank

Graph

Implementation

todo

Nepenthes Example

I chose Nepenthes, because I grow them at home! This project is part of a bigger one related to carnivorous plants and terraria that I'm breaking apart.

I'm a hobbiest, so if youre actually in a scientific field and have favorite phylogenetic database, data structure, protocol to share this kind of data, or other research I know nothing about!, I'd love to hear about it in the issues.

Getting started

Install package.

yarn add petrie

Import module.

import Tree from 'petrie';

Create a cached tree from the ICPS Carnivorous Plant Names Database.

Create a cached tree using NCBS.

Creating your own tree.

Import your data.

import data from './data'; // default export location

Initialize a new Tree instance.

const tree = new Tree(data);

Searching.

tree.find('nepenthes');

tree.find('nepenthes a');

Taxonomy

const ampullaria = tree.find('nepenthes ampullaria')[0];

ampullaria.name // binomial name
ampullaria.domain
ampullaria.order
ampullaria.species

ampullaria.divisions // synonymous with Species.prototype.children
ampullaria.order.divisions

// using HAMT methods to determine parents and children
ampullaria.children
const nepenthes = tree.find('nepenthes')[0]
ampullaria.isParent(nepenthes);
// false
nepenthes.isParent(ampullaria);
// true

Phylogeny

const nepenthes
ampullaria.geneticDistance();

HAMT

Using HAMT means that we have an entire tree-searching algorithm at our hands. Let's use it to create a binomial name searching autocomplete.

Graphing

D3 is an optional dependency to try to keep this project footprint small, and because not everybody needs graphing. If you like other chart libraries, please feel free to let me know in the issues.

import d3 from 'd3';

Contributing

Issues and pull requests are very welcome!

Tests

yarn test

License

MIT

FAQs

Package last updated on 04 Jun 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc