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

mgnify-sourmash-component

v0.3.0

Published

A web component to select FastA file and generate sourmash signatures locally.

Readme

mgnify-sourmash-component

Test and Publish the Demo

A web component that let you select FastA sequence files and creates sketches (KmerMinHash signatures) using Sourmash.

The demo in GH pages can be seen HERE.

Usage

You can add the following inn your HTML:

<mgnify-sourmash-component id="sourmash" ksize="31" scaled="1000" />

And use it via events in your javascript:

document
  .getElementById('sourmash')
  .addEventListener('sketched', (evt) =>
    console.log(`The signature for ${evt.detail.filename} has been created`)
  );
document
  .getElementById('sourmash')
  .addEventListener('sketchedall', (evt) =>
    console.log(
      `Processing of all these files have finished: ${Object.keys(
        evt.detail.signatures
      )}`
    )
  );

API reference

Attributes

General Options

directory: boolean = false

Sets the File chooser to select directories instead of files.

show_directory_checkbox: boolean = false

Displays or not a checkbox to select the mode(directory) of the file chooser

show_signatures: boolean = false

Displays or not the signatures once they are calculated.

KmerMinHash Options

num: number = 0

Create a standard MinHash with no more than <num> k-mers kept. This will produce sketches identical to mash sketches. num is incompatible with scaled.

ksize: number = 31

Create a sketch at this k-mer size; can provide more than one time in a parameter string. Typically ksize is between 4 and 100.

is_protein: boolean = false

Creates a protein kind of sketch.

dayhoff: boolean = false

Creates a dayhoff kind of sketch.

hp: boolean = false

Creates a hp kind of sketch.

seed: number = 42

Murmurhash seed

scaled: number = 1000

Create a scaled MinHash with k-mers sampled deterministically at 1 per <scaled> value.

track_abundance: boolean = false

Create abundance-weighted (or not) sketches.

Properties

selectedFiles: Array<File> = null

The selectedFiles property holds the array of files that are or have been processed by this component.

progress: {[filename: string]: number}

The progress property is an object where the key are the filenames of the selected files and the value is a float from 0 to 100 reporting how much of the file has been read and processed.

`signatures: {[filename: string]: string};

The signatures property is an object where the key are the filenames of the selected files and the value is the calculated signature as a string in JSON format. If a filename is not in this object, means that the signature has not yet been calculated, you can check the progress property to see how far it has been read.

Methods

Events

sketched

The sketched event is fired when a single file read is completed and a signature for has been calculated.

| Bubbles | Yes | | ---------- | --- | | Cancelable | No |

detail: {
  filename: string,
  signature: string, //it is given as a string but it is in JSON format, so you could safely use JSON.parse
}
sketchedall

The sketchedall event is fired when all the requested files have been read and proccessed. If a signature couldn't be generated, its value in the returned object will be null.

| Bubbles | Yes | | ---------- | --- | | Cancelable | No |

detail: {
  signatures: {
    [filename: string]: string;
  };
}