npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

phylogicianjs

v0.0.4-0

Published

Typescript library for Phylogenetic visualization using d3js and adapted from TnT.

Readme

PhylogicianJS

Node.js module to visualize phylogenetic trees.

Development rational

Phylogician class responsibility distribution

The Phylogician class represents the tree itself.

We can feed the Phylogician class with newick data using .data(). Phylogician then parse the newick using newick-reader npm package.

The newick-reader returns a deeply nested object with the tree structure.

We decided to flatten this scruture and store each tree node as an array of TreeNodes. Phylogician does that with .makeTree() method.

This makes sense, right? A phylogenetic tree is a collection of nodes. Each node should hold all the information to place it on a abstract version of the tree, for example an array.

Thus, an element of the TreeNode class has the following information:

public name: string
public branchLength: number|null
public children: number[]

private id: number|null
private parent: number | null
private root: boolean

private viz: IvizOptions

We do not exposed id, parent and root directly because they are attributes assigned during the construction of the tree by the Phylogician method .makeTree(). That information is needed because we flattened the nested structure of the original ITree object To access these values, there are getters and setters methods in the instances of the TreeNode class. They are designed to protect the developer from accidentally re-assing these values. In particular id that should be only assigned once. parent and root can be reassinged during reroot for example.

The TreeNode is self contained and our philosophy is that each instance of the class should have all information about the node it represents in the phylogenetic tree. For that, TreeNode also have the private property viz with the following interface:

interface Ipos {
    x: number
    y: number
}

interface Idim {
    h: number
    w: number
}

interface IvizOptions {
    nodeSize: number
    nodeColor: string
    pos: Ipos,
    labelDim: Idim,
}

The IvizOptions store the size of the node, its color, position and dimensions of the label. The TreeNode class has the nodeSize and nodeColor set to 3 and black as default. Both pos and labelDim are set to 0 both for x, y in pos and h, m in labelDim.

These attributes are private but can be set and get with the appropriate public methods.

Ok, now that we have the tree on an abstract set that can be publically accessed by the Phylogician attribute .nodes, it is time to pick a representation with .layout(). This is when Phylogician set the labelDim and pos attributes of each node before it draws it.

There is only vertical layout available right now.

and how to represent this data by picking a layout using .layout().

Only vertical layout is available.

So the tree itself is a collection of TreeNodes and a Layout.

This helps us to distribute responsibility between the classes.

For instance, TreeNode has:

TODO:

  • [ ] Fix CI https://medium.com/@ali.dev/how-to-setup-chrome-headless-on-gitlab-ci-with-puppeteer-docker-fbb562cbaee1
  • [ ] Tooltip builder (its own class)
    • [ ] Laderizer
    • [ ] branch opacity based on uncertainty
    • [ ] collapse
  • [ ] Resolve overlapping names.
  • [ ] ReadMe