@gmod/nclist
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

nclist-js

Read legacy JBrowse 1 nested containment list JSON.

Status

Build Status Coverage Status NPM version

Usage

import { RemoteFile } from 'generic-filehandle'
import NCList from '@gmod/nclist'
;(async () => {
  const store = new NCList({
    baseUrl: `http://my.server/path/to/data/dir/`,
    urlTemplate: 'volvox_genes/{refseq}/trackData.json',
    readFile: url => new RemoteFile(url).readFile(),
  })

  for await (const feature of store.getFeatures({
    refName: 'ctgA',
    start: 0,
    end: 50000,
  })) {
    console.log(
      `got feature at ${feature.get('seq_id')}:${feature.get(
        'start',
      )}-${feature.get('end')}`,
    )
  }
})()

API

Table of Contents

NCListStore

Sequence feature store using nested containment lists held in JSON files that are lazily read.

Parameters

  • args object constructor args

    • args.baseUrl string base URL for resolving relative URLs
    • args.urlTemplate string Template string for the root file of each reference sequence. The reference sequence name will be interpolated into this string where {refseq} appears.
    • args.readFile function function to use for reading remote from URLs.
    • args.cacheSize (optional, default 10)

getRegionFeatureDensities

fetch binned counts of feature coverage in the given region.

Parameters
  • query object

    • query.refName string reference sequence name
    • query.start number region start
    • query.end number region end
    • query.numBins number number of bins desired in the feature counts
    • query.basesPerBin number number of bp desired in each feature counting bin

Returns object as: { bins: hist, stats: statEntry }

getFeatures

Fetch features in a given region. This method is an asynchronous generator yielding feature objects.

Parameters
  • args object

    • args.refName string reference sequence name
    • args.start number start of region. 0-based half-open.
    • args.end number end of region. 0-based half-open.

Package Sidebar

Install

npm i @gmod/nclist

Weekly Downloads

407

Version

1.0.2

License

MIT

Unpacked Size

154 kB

Total Files

50

Last publish

Collaborators

  • teresam856
  • nathandunn
  • rbuels
  • enuggetry
  • cmdcolin
  • garrettjstevens