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

@gmod/bed

v2.3.1

Published

A BED file format parser with autoSql support

Readme

bed-js

Coverage Status Build Status

Parses BED lines into feature objects, using the file's autoSql schema when it has one. Includes a standalone autoSql parser and the UCSC bigBed schemas.

Install

npm install @gmod/bed

Usage

Feed the parser one line at a time:

import BED from '@gmod/bed'

const parser = new BED()
const features = text
  .split('\n')
  .filter(line => line.trim() && !/^(#|track|browser)/.test(line))
  .map(line => parser.parseLine(line))

parser.parseLine('chr1\t0\t100\tgene1\t50\t+')
// { chrom: 'chr1', chromStart: 0, chromEnd: 100, name: 'gene1',
//   score: 50, strand: 1 }

parseLine has no notion of header or comment lines — filter them out first, or they come back as features with NaN coordinates.

The lines can come from anywhere. A .bed.gz can be queried with @gmod/tabix, and a bigBed can be read with @gmod/bbi. If either file is remote, have that package read through a filehandle from @gmod/range-cache-filehandle, which caches the byte ranges it fetches.

A file whose first line names its columns can hand that line straight back as columnNames, instead of dropping it with the other # lines:

const [header, ...rest] = text.split('\n')
const parser = new BED({ columnNames: header.replace(/^#/, '').split('\t') })
rest.map(line => parser.parseLine(line))

Schemas

Four ways to tell the constructor how to name and type the columns:

new BED() // standard BED columns
new BED({ autoSql }) // an autoSql string, e.g. from a bigBed header
new BED({ type: 'bigGenePred' }) // a builtin UCSC schema
new BED({ columnNames }) // names from a '#chrom start end ...' header

Documentation

  • API — constructor, parseLine, exported types
  • Schemas — the builtin list, autoSql, column-name headers
  • Parsing behavior — strand, missing data, BED12+n, and what the parser guesses when there is no schema
  • Contributing — development and releases

Academic Use

This package was written with funding from the NHGRI as part of the JBrowse project. If you use it in an academic project that you publish, please cite the most recent JBrowse paper, which will be linked from jbrowse.org.

License

MIT © Colin Diesh