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

hic-straw

v2.1.2

Published

Utilities for reading .files (contact matrix files)

Downloads

563

Readme

hic-straw

Build Status

Command line and web utilities for reading .hic contact matrix files

Installation

Requires Node (https://nodejs.org)

npm install hic-straw

API

getContactRecords

Return a collection of binned contact counts.

Arguments

  • normalization - string indicating normalization scheme
  • region 1 {chr, start, end} - genomic region in base pair or fragment units. Interval convention is zero based 1/2 open
  • region 2 {chr, start, end}
  • units -- "BP" for base pairs. Currently this is the only unit supported
  • binSize -- size of each bin in base pair or fragment units. Bins are square

Examples

Browser usage

Script tag - see examples/straw.html


<script src="../dist/hic-straw.js"></script>

...

 const straw = new HicStraw({
            url: "https://s3.amazonaws.com/igv.broadinstitute.org/data/hic/intra_nofrag_30.hic"
        })

        straw.getContactRecords(
            "KR",
            {chr: "8",start: 50000000, end: 60000000},
            {chr: "8",start: 50000000, end: 60000000},
            "BP",
            1000000
        )
            .then(function (contactRecords) {...})

ES6 module - see examples/straw-es6.html



    import HicStraw from '../dist/hic-straw_es6.js'

    const straw = new HicStraw({
        url: "https://s3.amazonaws.com/igv.broadinstitute.org/data/hic/intra_nofrag_30.hic"
    })

    straw.getContactRecords(
        "KR",
        {chr: "8",start: 50000000, end: 60000000},
        {chr: "8",start: 50000000, end: 60000000},
        "BP",
        1000000
     )
        .then(function (contactRecords) {...})


`

Node

The hic-straw distributions are built for browser usagae, but can be used in Node with shims.

local file

To use hic-straw with a local file use the NodeLocalFile class as follows

import NodeLocalFile from "src/io/nodeLocalFile.mjs"
const path = "test/data/test_chr22.hic"
const nodeLocalFile = new NodeLocalFile({path})
const straw = new Straw({file: nodeLocalFile})

remote file

For remote file access define a global fetch function

global.fetch = require("node-fetch")
const url = "https://foo.bar/test.hic"
const straw = new Straw({url: url})

See examples/script-es6.js and examples/script-cjs.js for complete examples.

Command line

Note: "straw" is installed in node_modules/.bin/straw. This should be added to the path automatically upon installing hic-straw, however if you get the error straw: command not found try running straw explicitly as

node_modules/.bin/straw...

Extract file metadata (genome identifier, sequences, resolutions)

straw --meta test/data/test_chr22.hic 

Extract normalization options.

straw --norms test/data/test_chr22.hic 

Extract contact records from a local hic file


straw KR test/data/test_chr22.hic 22:40,000,000-50,000,000 22:40,000,000-50,000,000 BP 100,000

Extract contact records from a remote hic file

straw KR https://s3.amazonaws.com/igv.broadinstitute.org/data/hic/intra_nofrag_30.hic 8:48,700,000-48,900,000 8:48700000-48900000 BP 10,000
``