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

higlass-multi-tileset

v0.1.1

Published

Multi-tileset data fetcher for HiGlass

Downloads

6

Readme

higlass-multi-tileset

Multi-tileset data fetcher for HiGlass

Installation

If you are using NPM:

npm install higlass-multi-tileset

Then you can load it by adding this import to your JavaScript:

import MultiTilesetDataFetcher from 'higlass-multi-tileset';

// Alternatively, if you don't need programmatic access:
import 'higlass-multi-tileset';

Otherwise, load higlass-multi-tileset from a CDN. You can use this script tag:

<script src="https://unpkg.com/higlass-multi-tileset"></script>
<!-- Make sure to load higlass-multi-tileset before hglib.js -->
<script src="hglib.js"></script>

Usage

The multi tileset data fetcher can be used to fetch data from multiple tilesets at once.

{
  "data": {
    // The "type" field tells HiGlass to use this data fetcher
    "type": "multi-tileset",
    // An array of data configs 
    "configs": [
      {
        "server": "http://localhost:8001/api/v1",
        "tilesetUid": "my-bigwig-tileset",
      },
      {
        "server": "https://my-higlass-server.com/api/v1",
        "tilesetUid": "my-fasta-tileset",
        
        // The primary data config will be the source of
        // tileset info, and only tiles that exist in the
        // primary tileset will be returned.

        // Defaults to the first config specified (index 0)
        "primary": true
      },
      {
        "type": "local-tiles",
        "tilesetInfo": { ... },
        "tiles": { ... }
      }
    ]
  },
  // Other options for the track go here
  ...
}

The tiles returned from the data fetcher will have an array for the tileData property that includes the tile data from every config specified.

For example, in your track you might use:

renderTile(tile) {
  const firstTile = tile.tileData[0];
  render(firstTile.dense);
  // The second data config is the source for this tile data
  const secondTile = tile.tileData[1];
}

Features

This data fetcher comes with a special feature: tile ID filters. If you want to filter out some tile IDs from some data configs to avoid fetching them when they aren't needed, you can use the setFilter() function on the dataFetcher.

updateOptions(newOptions) {
  if (
    this.dataFetcher.constructor.config &&
    this.dataFetcher.constructor.config.type == 'multi-tileset'
  ) {
    // Applies to the primary data config (no second argument)
    this.dataFetcher.setFilter(tileId => tileId != 'banned-id');
    // Don't fetch any tiles from the second data config
    // (second argument is index)
    this.dataFetcher.setFilter(_ => false, 1);
  }
}

This can be helpful to improve performance in situations where one of the data configs is not necessary. For example, in higlass-dynseq, a filter is applied to the FASTA data config to avoid fetching the sequence unless it is visible on screen.

Support

File an issue if you have found a bug, would like help resolving a problem, or want to ask a question about using the track.

Alternatively, contact Arjun Barrett for more information.