Multi-sample change detection in Hi-C patterns
Project description
Multi-sample change detection in Hi-C patterns
Pareidolia detects changes in intensities for a specific pattern (e.g. chromatin loops and domain borders) from Hi-C maps. It can be used to compare samples from different conditions and use multiple replicates to improve results.
This toolkit exploits Chromosight correlation maps, allowing the same method to detect changes in different Hi-C patterns (e.g. loops or borders).
Installation
Pareidolia is available on Pypi and can be installed using:
pip3 install --user pareidolia
Usage
Pareidolia can be used both as a python package and as a command line tool:
import pareidolia.hic_utils as pah
pah.change_detection_pipeline(
["ctrl1.cool", "ctrl2.cool", "treat1.cool", "treat2.cool"],
["control", "control", "treatment", "treatment"],
kernel='loops',
subsample=True,
n_cpus=8,
)
We can also use the CLI to execute the same instruction:
pareidolia -n 8 \
-k loops \
ctrl1.cool,ctrl2.cool,treat1.cool,treat2.cool \
control,control,treatment,treatment \
output.tsv
Pareidolia can either detect changes de-novo, or compute the change intensity at a set of input positions. The input positions can be provided as a bed2d (=bedpe) file, containing a list of 2D genomic coordinates. This file can be provided with the –bed2d-file option on the CLI, or using the bed2d_file parameter in the python API.
Pareidolia accepts chromosight kernels as kernel names. A list of valid kernels can be displayed using chromosight list-kernels.
Alternatively, when using the API, an arbitrary 2D numpy array can be provided as kernels.
The options shown below allow to customize pareidolia’s behavior. These options are further discussed in the tutorial, available on the documentation website .
Usage: pareidolia [OPTIONS] COOL_FILES CONDITIONS OUTFILE
Run the pattern change detection pipeline. Given a list of cool files and
associated conditions, compute pattern intensity change from one condition
relative to the control. The first condition occuring in the list is the
control. For all patterns that pass the quality filters, a differential
score (condition - control) and a contrast-to-noise ratio are returned.
Options:
-b, --bed2d-file PATH Optional bed2d file containing pattern positions
where changes should be measured (instead of
detecting).
-c, --cnr FLOAT Contrast to-noise-ratio threshold used to filter out
positions with high technical variations relative to
biological variations. [default: 1.0]
-k, --kernel TEXT A kernel name or a tab-separated text file
containing a square kernel matrix. Valid kernel
names are: loops, borders, centromeres, hairpins.
[default: loops]
-r, --region TEXT Optional comma-separated list of regions in UCSC
format (e.g. chr1:1000-40000) at which detection
should operate.
-M, --max-dist INTEGER Maximum interaction distance (in basepairs) at which
patterns should be detected. Reduce to accelerate
detection and reduce memory usage.
-p, --pearson FLOAT Threshold to apply when detecting pattern changes. A
default value is selected based on the kernel.
-D, --density FLOAT Minimum proportion of nonzero pixels required to
consider a region. Smaller values allows lower
coverage regions, but increase false positives.
[default: 0.1]
-S, --no-subsample Disable subsampling of input matrices to the same
coverage.
-F, --no-filter Completely disable pearson, cnr and density
filtering. Mostly for debugging. All input positions
are returned, but results will be noisy.
-n, --n-cpus INTEGER Number of CPUs to use for parallel tasks. It is
recommended to set at most to the number of input
samples.
--version Show the version and exit.
--help Show this message and exit.
Algorithm
Pareidolia starts by running Chromosight’s convolution algorithm on each input sample to compute a matrix of correlation coefficients to the target pattern. Each position represents the similarity of the region to that pattern. For each condition, a median background is generated by averaging correlation matrices from replicates.
A differential background matrix is computed by subtracting backgrounds from the different conditions. Pareidolia then applies a series of filtering steps to discard noisy regions. Three filters are applied, each with their respective threshold:
Pearson threshold: Only regions where at least one input sample has a pearson coefficient above this threshold are considered.
CNR threshold: Contrast-to-noise-ratio filter to discard regions where the intra-condition variability is low compared to the inter-condition difference.
Density threshold: Coverage-based filter to remove very sparse regions. If the proportion of non-empty pixels used to compute the correlation score is below that threshold, the value is discarded.
Each filter can be selectively disabled, or its threshold adapted using command line options.
If a list of positions was provided, the filtered differential scores are returned at those positions. Otherwise, de-novo differential pattern detection is performed using connected component labelling on the matrix as in Chromosight.
Citation
If you use Pareidolia in your research, you can cite the software as follows (see the Zenodo page to cite a specific version):
Cyril Matthey-Doret. (2021, July 2). koszullab/pareidolia. Zenodo. https://doi.org/10.5281/zenodo.5062484
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pareidolia-1.2.0.tar.gz
.
File metadata
- Download URL: pareidolia-1.2.0.tar.gz
- Upload date:
- Size: 20.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae9d864f96363390e65cf623e5cdd04255fb5ec2dcbd4524274693d1376fb081 |
|
MD5 | 695e853b98905098e9be57e7b97a8186 |
|
BLAKE2b-256 | 8355461c9c7c2b6b5d6e2dff35f903204c631762b74238975033d3ced79607a7 |
File details
Details for the file pareidolia-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: pareidolia-1.2.0-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c6a1d666b9a4d947682e4131f97b149d01b5359d3457568a1759de50ed18395 |
|
MD5 | f5db1c346117afd615510b96fdf907a5 |
|
BLAKE2b-256 | 318bed33ab8104cb79c05d7ba529825a2f6da8494e8b07ef4e4fd93eebce9906 |