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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jbrowse/bandage-core

v20.1.0

Published

Pangenome graph layout and drawing with no host: GFA in, the Bandage force-directed engine and reference-anchored layouts, a Canvas2D renderer, hit testing and labels out

Readme

@jbrowse/bandage-core

@jbrowse/bandage-core is the code that lays out and draws pangenome graphs in the JBrowse graph plugin, BandageJS and ggbandage, packaged so you can build your own viewer or figures with it.

  • In: a pangenome graph as GFA, or a region of one read from a gfa-to-tabix walk file with @gmod/gfa-tabix
  • Out: a layout of the graph, drawn on an HTML canvas (as in the JBrowse plugin and BandageJS), to an SVG file, or as tables of coordinates for another plotting library (ggbandage plots them with ggplot2)
  • Layouts: Bandage's force-directed layout, which shows the graph's loops and bubbles, or layouts along the reference genome, such as one bar per haplotype or a tube map

Install

npm install @jbrowse/bandage-core

Reading walk files also needs @gmod/gfa-tabix.

Usage

The example below reads LPA's KIV-2 repeat from the HPRC release 2.1 walk file on jbrowse.org and draws it with one panel per haplotype. It keeps three haplotypes besides GRCh38 and draws two of them:

import { WalkFile } from '@gmod/gfa-tabix'
import {
  figureSvg,
  forceLayout,
  layoutEngine,
  loadGraph,
} from '@jbrowse/bandage-core'

const walks = new WalkFile({
  walksUrl:
    'https://jbrowse.org/demos/hprc/hprc-v2.1-mc-grch38-f8.GRCh38.walks.gz',
})
const refName = 'GRCh38#0#chr6'
const { tables } = await walks.getGraphForRange(
  'chr6',
  160_614_798,
  160_647_758,
  {
    haplotypes: ['HG00097', 'HG01960', 'HG00133'],
  },
)
const graph = loadGraph(tables, 'KIV-2')
const spec = {
  walks: [
    { name: refName },
    { name: 'HG00097#1#JBIRDD010000043.1' },
    { name: 'HG00133#1#CM090050.1' },
  ],
  facet: { field: 'walk', columns: 3 },
}
const { result } = await forceLayout(graph, spec, layoutEngine)
const svg = figureSvg(graph, result, { spec })

GRCh38, HG00097 and HG00133 at LPA's KIV-2 repeat, a panel each, colored yellow to red along each haplotype. HG00097 is 22.2 kb longer than GRCh38, with one extra small loop, and HG00133 is 116 kb longer, with two extra small loops and the large loop

Haplotype threads

Leave out facet in the example above, and figureSvg draws the same three haplotypes on the same graph, but on one layout, each in a different color along the nodes it passes through. Where haplotypes pass through the same nodes, their threads run side by side, so a loop drawn in one color is a loop only that haplotype passes through. On a canvas, passing walkLift(graph, resolvedSpecOf(spec, graph)) to buildGeometry as highlight draws the same threads. A haplotype colored by pass splits into one thread per trip round a repeat; see Threading by pass.

The same graph as above with GRCh38 in grey, HG00097 in blue and HG00133 in orange on one layout. The three run side by side through the shared loops. HG00097 also passes through one small loop that GRCh38 skips, and HG00133 through two other small loops and the large loop below

Docs

  • API: the main exports, by task: loading, layouts, drawing to a canvas, figures, haplotypes, and genes and variants
  • Walk rows and departures: where a haplotype leaves the reference, what the text beside each walk row means, and what a host app does
  • Drawing reference: fitting a drawing to a pane, labels, small sites and threading by pass, for an app that draws with bandage-core
  • Command-line tools: bandage-figure draws a figure from a JSON graph spec, and bandage-fold merges small variants into the reference for viewing zoomed out

See also

Similar project for tubemaps

JBrowse tutorials;

License

GPL-3.0-or-later, as Bandage and OGDF are.