Skip to main content

Straw

Straw enables programmatic access to .hic files. .hic files store the contact matrices from Hi-C experiments and the normalization and expected vectors, along with meta-data in the header.

The main function, straw, takes in the normalization, the filename or URL, chromosome1 (and optional range), chromosome2 (and optional range), whether the bins desired are fragment or base pair delimited, and bin size.

It then reads the header, follows the various pointers to the desired matrix and normalization vector, and stores as [x, y, count]

Usage: straw <NONE/VC/VC_SQRT/KR> <hicFile(s)> <chr1>[:x1:x2] <chr2>[:y1:y2] <BP/FRAG> <binsize>

See https://github.com/theaidenlab/straw/wiki/Python for more documentation

Install

Straw uses the requests library for support of URLs. Be sure it is installed.

Examples

  • Extract all reads on chromosome X at 1MB resolution with no normalization in local file "HIC001.hic"

    from straw import straw
    result = straw.straw('NONE', 'HIC001.hic', 'X', 'X', 'BP', 1000000)
    # the values returned are in x / y / counts
    for i in range(len(result[0])):
       print("{0}\t{1}\t{2}".format(result[0][i], result[1][i], result[2][i]))
    
  • Extract all reads from chromosome 4 at 500KB resolution with VC (coverage) normalization from the combined MAPQ 30 map from Rao and Huntley et al. 2014

    from straw import straw
    result = straw.straw('VC', 'https://hicfiles.s3.amazonaws.com/hiseq/gm12878/in-situ/combined_30.hic', '4', '4', 'BP', 500000)
    # the values returned are in x / y / counts
    for i in range(len(result[0])):
       print("{0}\t{1}\t{2}".format(result[0][i], result[1][i], result[2][i]))
    
  • Extract reads between 1MB and 7.5MB on chromosome 1 at 25KB resolution with KR (balanced) normalization and write to a file:

    from straw import straw
    straw.printme("KR", "HIC001.hic", "1:1000000:7500000", "1:1000000:7500000", "BP", 25000, 'out.txt')
    
  • Extract all interchromosomal reads between chromosome 5 and chromosome 12 at 500 fragment resolution with VC (vanilla coverage) normalization:

    from straw import straw
    
    result = straw.straw("VC", "HIC001.hic", "5", "12", "FRAG", 500)
    # the values returned are in results
    for i in range(len(result[0])):
       print("{0}\t{1}\t{2}".format(result[0][i], result[1][i], result[2][i]))
    

See the script straw.py for an example of how to print the results to a file.

Read header

See the file read_hic_header.py for a Python script that reads the header of a hic file and outputs the information (including resolutions).

Release files for hic-straw 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hic-straw 0.0.6
File Size Uploaded
hic-straw-0.0.6.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hic-straw 0.0.6
File Interpreter ABI Platform
hic_straw-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 16.1 kB

Release files / hic-straw-0.0.6.tar.gz

Download URL hic-straw-0.0.6.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bc79be50b076a3820852cd0e3b0d743df719b78d49510bf43ac63241f03ab81a
BLAKE2b-256 checksum
How to use checksums
5812da9e47221a82011797d19832a2dbc8843b0a96c483874f17010b4921c993
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

Release files / hic_straw-0.0.6-py3-none-any.whl

Download URL hic_straw-0.0.6-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd355fddfb43bb7a152125200a96a959bbe2fa3e4f5e1d41d0af8f27ebecf69e
BLAKE2b-256 checksum
How to use checksums
a4891fc2a4e6d9b5379ac4ea0add62658d519095d22a8fef6feb32d1f6d04341
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

Release history Release notifications | RSS feed

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.0

2 release files

This release

0.0.6 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page