Comments (2)
The convolution operation (implemented in the xcorr2 function) is used multiple times to compute the map Pearson coefficient at the end.
The normxcorr2 function is where the Pearson correlation is computed. The code is hard to read because 1) it was written to work on sparse matrices and 2) we avoided temporary variables as much as possible to limit memory usage.
tl;dr: We compute the map of Pearson correlations at the very end by plugging the results of correlation products into the different terms of the formula described in the paper methods. We are vectorizing the pearson formula over the whole matrix.
More details below:
Note: This is a slightly simplified version of what we do, because in practice we also account for missing bins (NaNs) by adjusting the denominator.
The basic concept is the following: A Pearson correlation coefficient is computed between each position of an image
Assuming
Where
Given that X represents the image around a pixel of the Hi-C matrix and Y represents the template, $E[Y] $ and
The other values to compute are:
-
$E[XY]$ : The convolution of the image and the kernel. -
$E[X]$ : The convolution of the image by the uniform (mean) kernel. Each pixel (i, j) of the resulting map give the mean of the window $ (i: i+M_{TMP}, j: j+N_{TMP})$ . Values in this matrix can just be squared to obtain$E[X]^2$ -
$E[X^2]$ : The convolution of the squared signal by the uniform (mean) kernel.
Which means there are 3 convolution products to compute in order to obtain a map of Pearson coefficients.
from chromosight.
As for the kernel of a TAD corner, in principle you'd like to use a simple kernel. It should have a decent correlation with most TAD corners (i.e. 1 quarter dark, 3 quarters light) in your dataset.
The problem might be the size: If the kernel is too large, you will miss small TADs (as the corner only fills a tiny portion of the kernel and will show poor correlation). If the kernel is too small, you will get many false positives due to noise being picked up as corners.
from chromosight.
Related Issues (20)
- Different score values between chromosight detect and chromosight quantify on borders pattern HOT 2
- How to compare loops of Hi-C from different conditions like DEG in RNA-Seq? HOT 4
- Questions about resolution in loop json file HOT 2
- Chromosight for single-cell Hi-C HOT 8
- Point and click mode HOT 8
- Different number of patterns for the same Hi-C matrix HOT 3
- How to evaluate the detected loops? HOT 4
- Different number of loops on GM12878 Hi-C map HOT 2
- chromosight detects hairpin, the numer is too large HOT 1
- Can chromosight detect loops based on restriction fragments level (1f, 2f, etc) HI-C matrix. HOT 2
- Bus error in chromosight quantify HOT 2
- Is there a way to use multiresolution .mcool files directly? HOT 1
- Where do these kernels come from? HOT 5
- Loop score calculation HOT 4
- Pattern = TAD? HOT 1
- Recommend parameters of borders detect HOT 1
- Tuning the parameters (perc-zero, perc-undetected, pearson) for a relatively small dataset HOT 2
- HicMatrix generated cool file not supported - possible solution HOT 6
- Handle variable bin size
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chromosight.