Comments (2)
Actually, there is no discrepancy.
The "as-pixels" selector clr.matrix(balance=False, as_pixels=True)
only returns the upper triangle portion of the global contact matrix, including the main diagonal, which will correspond to what you see in a pairs file.
clr.matrix(balance=False)
returns a numpy array of the full contact matrix, including the lower triangle portion as well. At lower resolutions, more counts get absorbed into the main diagonal, which naturally changes the way these add up.
You can validate this:
for res in cooler.fileops.list_coolers("test.mcool"):
clr = cooler.Cooler(f"test.mcool::{res}")
df = clr.matrix(balance=False, as_pixels=True).fetch("chrX(mat)")
diag_sum = df[df['bin1_id'] == df['bin2_id']]['count'].sum()
upper_sum = df[df['bin1_id'] != df['bin2_id']]['count'].sum()
array_sum = clr.matrix(balance=False).fetch("chrX(mat)").sum()
assert(array_sum == diag_sum + 2*upper_sum)
Or by inspecting or visualizing the two results.
from cooler.
Oh, I forgot about the issue with the upper triangle, that was really silly of me. Initially, when I saw that the matrix sum was different under different resolutions, I thought there would be some problems. Thank you so much for your help!
from cooler.
Related Issues (20)
- need new feature: subset cool file by chrom start and end to a new cool file HOT 2
- New bug introduced in 0.9.2 in balance --cis-only HOT 4
- Weight column missing HOT 5
- Store marginals (cis, total) in cooler
- compare two cool balance matrices HOT 1
- 4DN Data Portal Warning HOT 2
- Cooler digest with 2 restriction enzymes HOT 2
- convert single-cell Hi-C to bulk Hi-C HOT 1
- question about multiplicative weights HOT 1
- Cooler cloud pairs error HOT 1
- 'IOHandles' object is not subscriptable - cooler 0.9.3 HOT 2
- Biological signal missing from cool files HOT 2
- ValueError: cannot safely convert passed user dtype of int64 for float64 dtyped data in column 4 HOT 2
- RangeSelector1D object has no attribute 'copy' in create_scool HOT 2
- Allow multi enzyme digest
- Can't append new data to existing cool file. HOT 3
- Parsing error in cooler cload pairs HOT 2
- cooler cload does not accept .lz4-compressed .pairs files HOT 1
- cooler cload pairs memory usage error HOT 3
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 cooler.