chromosight

Computer vision based program for pattern recognition in chromosome (Hi-C) contact maps

https://github.com/koszullab/chromosight

Science Score: 20.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: nature.com
  • Committers with academic emails
    6 of 15 committers (40.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.4%) to scientific vocabulary

Keywords

chromatin-loops genomics hi-c pattern-detection

Keywords from Contributors

bioinformatics sparse-matrix
Last synced: 11 months ago · JSON representation

Repository

Computer vision based program for pattern recognition in chromosome (Hi-C) contact maps

Basic Info
Statistics
  • Stars: 63
  • Watchers: 12
  • Forks: 9
  • Open Issues: 4
  • Releases: 0
Topics
chromatin-loops genomics hi-c pattern-detection
Created about 7 years ago · Last pushed over 3 years ago
Metadata Files
Readme License

README.md

Chromosight

animated logo

PyPI version install with bioconda build Docker Image on Quay codecov Read the docs

Python package to detect chromatin loops (and other patterns) in Hi-C contact maps.

  • Associated publication: https://www.nature.com/articles/s41467-020-19562-7
  • Documentation and analyses examples: https://chromosight.readthedocs.io
  • scripts used for the analysis presented in the article https://github.com/koszullab/chromosightanalysesscripts

Installation

Stable version with pip:

sh pip3 install --user chromosight Stable version with conda: sh conda install -c bioconda -c conda-forge chromosight

or, if you want to get the latest development version:

pip3 install --user -e git+https://github.com/koszullab/chromosight.git@master#egg=chromosight

Usage

The two main subcommands of chromosight are detect and quantify. For more advanced use, there are two additional subcomands: generate-config and list-kernels. To get the list and description of those subcommands, you can always run:

bash chromosight --help Pattern detection is done using the detect subcommand. The quantify subcommand is used to compute pattern matching scores for a list of 2D coordinates on a Hi-C matrix. The generate-config subcommand is used to create a new type of pattern that can then be fed to detect using the --custom-kernel option. The list-kernels command is used to view informations about the available patterns.

Get started

To get a first look at a chromosight run, you can run chromosight test, which will download a test dataset from the github repository and run chromosight detect on it. You can then have a look at the output files generated.

Important options

When running chromosight detect, there are a handful parameters which are especially important:

  • --min-dist: Minimum genomic distance from which to detect patterns. For loops, this means the smallest loop size accepted (i.e. distance between the two anchors).
  • --max-dist: Maximum genomic distance from which to detect patterns. Increasing also increases runtime and memory use.
  • --pearson: Detection threshold. Decrease to allow a greater number of pattern detected (with potentially more false positives). Setting a very low value may actually reduce the number of detected patterns. This is due to the algorithm which might merge neighbouring patterns.
  • --perc-zero: Proportion of zero pixels allowed in a window for detection. If you have low coverage, increasing this value may improve results.

Example

To detect all chromosome loops with sizes between 2kb and 200kb using 8 parallel threads: bash chromosight detect --threads 8 --min-dist 20000 --max-dist 200000 hic_data.cool output_prefix

Options

```

Pattern exploration and detection

Explore and detect patterns (loops, borders, centromeres, etc.) in Hi-C contact maps with pattern matching.

Usage: chromosight detect [--kernel-config=FILE] [--pattern=loops] [--pearson=auto] [--win-size=auto] [--iterations=auto] [--win-fmt={json,npy}] [--norm={auto,raw,force}] [--subsample=no] [--inter] [--tsvd] [--smooth-trend] [--n-mads=5] [--min-dist=0] [--max-dist=auto] [--no-plotting] [--min-separation=auto] [--dump=DIR] [--threads=1] [--perc-zero=auto] [--perc-undetected=auto] chromosight generate-config [--preset loops] [--click contactmap] [--norm={auto,raw,norm}] [--win-size=auto] [--n-mads=5] [--threads=1] chromosight quantify [--inter] [--pattern=loops] [--subsample=no] [--win-fmt=json] [--kernel-config=FILE] [--norm={auto,raw,norm}] [--threads=1] [--n-mads=5] [--win-size=auto] [--perc-undetected=auto] [--perc-zero=auto] [--no-plotting] [--tsvd] <contactmap> chromosight list-kernels [--long] [--mat] [--name=kernel_name] chromosight test

detect:
    performs pattern detection on a Hi-C contact map via template matching
generate-config:
    Generate pre-filled config files to use for detect and quantify.
    A config consists of a JSON file describing parameters for the
    analysis and path pointing to kernel matrices files. Those matrices
    files are tsv files with numeric values as kernel to use for
    convolution.
quantify:
    Given a list of pairs of positions and a contact map, computes the
    correlation coefficients between those positions and the kernel of the
    selected pattern.
list-kernels:
    Prints information about available kernels.
test:
    Download example data and run loop detection on it.

```

Input

Input Hi-C contact maps should be in cool format. The cool format is an efficient and compact format for Hi-C data based on HDF5. It is maintained by the Mirny lab and documented here: https://open2c.github.io/cooler/

Most other Hi-C data formats (hic, homer, hic-pro), can be converted to cool using hicexplorer's hicConvertFormat or hic2cool. Bedgraph2 format can be converted directly using cooler with the command cooler load -f bg2 <chrom.sizes>:<binsize> in.bg2.gz out.cool. For more informations, see the cooler documentation

For chromosight quantify, the bed2d file is a text file with at least 6 tab-separated columns containing pairs of coordinates. The first 6 columns should be chrom start end chrom start end and have no header. Alternatively, the output text file generated by chromosight detect is also accepted. Instructions to generate a bed2d file from a bed file are given in the documentation.

Output

Three files are generated by chromosight's detect and quantify commands. Their filenames are determined by the value of the <prefix> argument: * prefix.tsv: List of genomic coordinates, bin ids and correlation scores for the pattern identified * prefix.json: JSON file containing the windows (of the same size as the kernel used) around the patterns from pattern.txt * prefix.pdf: Plot showing the pileup (average) window of all detected patterns. Plot generation can be disabled using the --no-plotting option.

Alternatively, one can set the --win-fmt=npy option to dump windows into a npy file instead of JSON. This format can easily be loaded into a 3D array using numpy's np.load function.

Note: the p-values and q-values provided in prefix.tsv should not be used as a criterion for filtering and are only useful for ranking calls. Their values are obtained from a Pearson correlation test and could be biased due to the dependence between contact values in the window.

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 nose2 as our testing framework. Ideally, new functions should have associated unit tests, placed in the tests folder.

To test the code, you can run:

bash nose2 -s tests/

FAQ

Questions from previous users are available in the github issues. You can open a new issue for your question if it is not already covered.

Citation

When using Chromosight in you research, please cite the pubication: https://www.nature.com/articles/s41467-020-19562-7

Owner

  • Name: Romain Koszul Laboratory
  • Login: koszullab
  • Kind: organization
  • Location: Institut Pasteur, Paris

GitHub Events

Total
  • Issues event: 1
  • Watch event: 5
  • Member event: 5
  • Fork event: 1
Last Year
  • Issues event: 1
  • Watch event: 5
  • Member event: 5
  • Fork event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 635
  • Total Committers: 15
  • Avg Commits per committer: 42.333
  • Development Distribution Score (DDS): 0.254
Past Year
  • Commits: 3
  • Committers: 2
  • Avg Commits per committer: 1.5
  • Development Distribution Score (DDS): 0.333
Top Committers
Name Email Commits
cmdoret c****t@g****m 474
Cyril Matthey-Doret c****t@u****h 61
axelcournac a****c@p****r 50
baudrly l****y@p****r 18
Remi-Montagne r****1@g****m 12
baudrly l****y@p****r 5
cyril c****l@w****e 4
axelcournac a****c@p****r 3
baudrly l****y@u****h 2
aye a****e@f****r 1
Cyril Matthey-Doret v****h@w****e 1
Guiglielmoni Nadege d****z@m****e 1
Amaury a****d@p****r 1
baudrly l****y@u****h 1
LGTM Migrator l****r 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: almost 3 years ago

All Time
  • Total issues: 40
  • Total pull requests: 24
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 27 minutes
  • Total issue authors: 23
  • Total pull request authors: 2
  • Average comments per issue: 3.18
  • Average comments per pull request: 0.67
  • Merged pull requests: 23
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 3
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: about 3 hours
  • Issue authors: 3
  • Pull request authors: 1
  • Average comments per issue: 2.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 1
Top Authors
Issue Authors
  • cmdoret (6)
  • jazberna1 (5)
  • PerrineLacour (4)
  • Linhua-Sun (4)
  • Phlya (2)
  • HongguiWu1 (2)
  • jessakay (1)
  • sarah872 (1)
  • yizhang-zoey (1)
  • Elphege-Nora (1)
  • gdolsten (1)
  • zhang-jiankun (1)
  • ysora (1)
  • WanyingX (1)
  • axelcournac (1)
Pull Request Authors
  • cmdoret (23)
  • lgtm-com[bot] (1)
Top Labels
Issue Labels
question (14) enhancement (4) bug (3) help wanted (3) documentation (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 563 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 2
  • Total versions: 55
  • Total maintainers: 3
pypi.org: chromosight

Detect loops (and other patterns) in Hi-C contact maps.

  • Versions: 55
  • Dependent Packages: 0
  • Dependent Repositories: 2
  • Downloads: 563 Last month
Rankings
Stargazers count: 8.9%
Dependent packages count: 10.0%
Forks count: 11.4%
Average: 11.5%
Dependent repos count: 11.6%
Downloads: 15.3%
Maintainers (3)
Last synced: 11 months ago

Dependencies

docs/environment.yml conda
  • chromosight
  • nbsphinx
  • notebook
  • recommonmark
  • sphinx
.github/workflows/build.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/codeql.yml actions
  • actions/checkout v3 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/autobuild v2 composite
  • github/codeql-action/init v2 composite
.github/workflows/python-publish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite
Dockerfile docker
  • continuumio/miniconda3 4.8.2 build
docs/requirements.txt pypi
  • chromosight *
  • nbsphinx *
  • notebook *
  • recommonmark *
  • sphinx *
requirements.txt pypi
  • cooler *
  • docopt *
  • jsonschema *
  • matplotlib *
  • numpy *
  • scikit-learn *
  • scipy >=1.3