Skip to main content

Reimplementation of the hicrep with added support for sparse matrix and multiple chromosomes.

Project description

hicreppy

cmdoret

PyPI version Build Status codecov Language grade: Python

This is a python reimplementation of hicrep's algorithm with added support for sparse matrices (in .cool format).

hicrep measures similarity between Hi-C samples by computing a stratum-adjusted correlation coefficient (SCC). In this implementation, the SCC is computed separately for each chromosome and the chromosome length-weighted average of SCCs is computed.

hicrep is published at:

HiCRep: assessing the reproducibility of Hi-C data using a stratum-adjusted correlation coefficient. Tao Yang, Feipeng Zhang, Galip Gurkan Yardimci, Ross C Hardison, William Stafford Noble, Feng Yue, Qunhua Li, 2017, Genome Research, doi: 10.1101/gr.220640.117

The original implementation, in R can be found at https://github.com/MonkeyLB/hicrep

Installation

You can install the package using pip:

pip install --user hicreppy

Usage

To find the optimal value for smoothing parameter h, you can use the htrain subcommand:


Usage: hicreppy htrain [OPTIONS] COOL1 COOL2

  Find the optimal value for smoothing parameter h. The optimal h-value is
  printed to stdout. Run informations are printed to stderr.

Options:
  -r, --h-max INTEGER     Maximum value of the smoothing parameter h to
                          explore. All consecutive integer values from 0 to
                          this value will be tested.  [default: 10]
  -m, --max-dist INTEGER  Maximum distance at which to compute the SCC, in
                          basepairs.  [default: 100000]
  -b, --blacklist TEXT    Exclude those chromosomes in the analysis. List of
                          comma-separated chromosome names.
  -w, --whitelist TEXT    Only include those chromosomes in the analysis. List
                          of comma-separated chromosome names.
  --help                  Show this message and exit.

To compute the SCC between two matrices, use the scc subcommand. The optimal h value obtained with htrain should be provided to the flag -v:


Usage: hicreppy scc [OPTIONS] COOL1 COOL2

  Compute the stratum-adjusted correlation coefficient for input matrices

Options:
  -v, --h-value INTEGER    Value of the smoothing parameter h to use. Should
                           be an integer value >= 0.  [default: 10]
  -m, --max-dist INTEGER   Maximum distance at which to compute the SCC, in
                           basepairs.  [default: 100000]
  -s, --subsample INTEGER  Subsample contacts from both matrices to target
                           value. Leave to 0 to disable subsampling.
                           [default: 0]
  -b, --blacklist TEXT     Exclude those chromosomes in the analysis. List of
                           comma-separated chromosome names.
  -w, --whitelist TEXT     Only include those chromosomes in the analysis.
                           List of comma-separated chromosome names.
  --help                   Show this message and exit.

When running multiple pairwise comparisons, compute the optimal h value once between two highly similar samples and reuse the h value for all scc commands

Contributing

All contributions are welcome. We use the numpy standard for docstrings when documenting functions.

The code formatting standard we use is black, with --line-length=79 to follow PEP8 recommendations. We use pytest with the pytest-doctest and pytest-pylint plugins as our testing framework. Ideally, new functions should have associated unit tests, placed in the tests folder.

To test the code, you can run:

pytest --doctest-modules --pylint --pylint-error-types=EF --pylint-rcfile=.pylintrc hicreppy tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hicreppy-0.0.6.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hicreppy-0.0.6-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file hicreppy-0.0.6.tar.gz.

File metadata

  • Download URL: hicreppy-0.0.6.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for hicreppy-0.0.6.tar.gz
Algorithm Hash digest
SHA256 d976927d3eeecfc7dd1c14eb774a6238f841b9bf2005ceef86b0062c9c24fe10
MD5 574329d18c3e83ac349f0454bbd2a4e2
BLAKE2b-256 8f467aeb16532307d20a7db36736c486d74fb5552f4b95d55174d797f1b44e42

See more details on using hashes here.

File details

Details for the file hicreppy-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: hicreppy-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 25.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for hicreppy-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5c907f712f8067835abe92d0195bd397ddfec91edf26cab2d78900f6e5475b04
MD5 b9af73db85406e869b58157d76ea9a79
BLAKE2b-256 910b219f74082ffa2c59cf459829edf7153658f1fd3a9d6413b027c67ded4efa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page