Command line and web utilities for reading .hic contact matrix files
Requires Node (https://nodejs.org)
npm install hic-straw
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
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) {...})
`
See examples/script-es6.js
and examples/script-cjs.js
.
** Usage (run from the examples directory)
-
node -r esm examples/script-es6.js
-
node examples/script.js
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...
straw --meta test/data/test_chr22.hic
straw --norms test/data/test_chr22.hic
straw KR test/data/test_chr22.hic 22:40,000,000-50,000,000 22:40,000,000-50,000,000 BP 100,000
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
``