dozmorovlab / HiCcompare

Joint normalization of two Hi-C matrices, visualization and detection of differential chromatin interactions. See multiHiCcompare for the analysis of multiple Hi-C matrices
https://dozmorovlab.github.io/HiCcompare/
Other
19 stars 3 forks source link

cooler2bedpe index issue #14

Closed jemilianosf closed 4 years ago

jemilianosf commented 4 years ago

Hi,

I noticed that in the cooler2bedpe function, in the part

ids <- data.frame(chr = dump$bins$chrom, start = dump$bins$start, end = dump$bins$end, id = seq(1, length(dump$bins$chrom), by = 1))

mat <- data.frame(bin1 = dump$pixels$bin1_id, bin2 = dump$pixels$bin2_id, IF = dump$pixels$count) The ids start with 1, and in mat the ids start at 0.

I think this might be an issue because I was trying to import a cool file and the sum of IF didn't match the cooler info size.

After changing

seq(1, length(dump$bins$chrom), by = 1))

to

seq(0, length(dump$bins$chrom)-1, by = 1))

the issue was solved.

mdozmorov commented 4 years ago

Thanks, @jemilianosf , for noticing this. @jstansfield0, what are your thoughts?

jstansfield0 commented 4 years ago

I don't have any cooler files at hand on my computer so I can't check for sure, but I think that I started the sequence at one because it is assumed that the chromosome numbers will start at 1. And typically counting in R starts at 1. I guess with your file it starts at 0 for some reason. Not sure if this typical for cooler files now or not. But basically that line is just assigning an ID value for each chromosome in the dataset.

mdozmorov commented 4 years ago

Closing due to inactivity.