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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@datagrok/dendrogram

v1.2.33

Published

Computation and visualization of hierarchical data clustering. [Learn more](https://github.com/datagrok-ai/public/blob/master/packages/Dendrogram/README.md)

Downloads

129

Readme

Dendrogram

Dendrogram is a package for the Datagrok platform for phylogenetic trees visualization.

Notations

Now only the Newick tree format is supported.

Viewers

Dendrogram viewer is a pure typescript component derived from DG.JsViewer to be used as a Datagrok viewer. Exposed properties allow customizing the viewer appearance for the line width and color, the node size and fill color.

Dendrogram properties

The viewer expects a data frame with the tag '.newick' (data frame tree data tag name can be customized with the property 'newickTag') containing tree data, but also allowing to set the 'newick' property for data (the 'newick' property value has higher priority over data frame tag).

//name: Dendrogram
//language: javascript
const csv = await grok.dapi.files.readAsText("System:AppData/Dendrogram/data/tree95df.csv");
const newick = await grok.dapi.files.readAsText("System:AppData/Dendrogram/data/tree95.nwk");
const df = DG.DataFrame.fromCsv(csv);
df.setTag('.newick', newick);
const tv = grok.shell.addTableView(df);
const viewer = await df.plot.fromType('Dendrogram', {});
tv.dockManager.dock(viewer, DG.DOCK_TYPE.RIGHT); // TypeError: Cannot read properties of undefined (reading 'H')

Optimized for large trees

The Dendrogram viewer is highly optimized to render trees with hundreds of thousands of nodes.

Large tree

File handlers

Opening file with .nwk, .newick extension will be transformed to a DataFrame of nodes (node, parent, leaf, distance columns) with a DendrogramViewer docked on the right side of the grid. The dendrogram viewer interacts with the data frame on which it is opened on the column with the node names specified in the Node[ColumnName] property. Current state, hover, and selection are supported and displayed with specific styles in the dendrogram and data frame grid.

.nwk file handler with interactivity

Dendrogram injected to grid, hierarchical clustering

An application developer can inject Dendrogram viewer to a grid linked by row number or leaves' column name. For example Top menu function ML | Hierarchical Clustering calculates the tree on selected features/columns set with specified pairwise distance metric and aggregation method. Mouse over, current, selected and filtered states, row height are synchronized between grid and injected tree in both directions.

ML | Hierarchical Clustering

Hierarchical clustering supports numeric columns, as well as Macromolecule columns and combination of those. Different distance functions will be used depending on the type of macromolecule. Levenstein distance for DNA/RNA/Unknown, Needleman-Wunsch for Proteins and Hamming for pre-aligned columns. Distance matrix calculation is paralellized on web-workers, which yields very fast and efficient compute times. Hierarchical clustering is performed in web-assembly and supports multiple linkage methods, like ward, average, centroid, complete, single, weighted and median. For dataset of 2000 sequences, it takes less than 2 seconds to calculate the tree and render it.

ML | Hierarchical Clustering Sequences

There is also an option to close the dendrogram viewer and restore the original grid view, by clicking on the X button on the top rigth corner of the tree view.

Close dendrogram

When clustering is performed, the tree aplies its own sorting to the table. Therefore, any external sorting will not be alowed. If however, the user wants to sort the table by a specific column, the tree viewer will be hidden, and a message will be displayed to the user. From there, the user can either restore sorting and continue working with the tree, or click on the X button to close the tree and restore the original grid view.

Restore sorting