Closed sarah872 closed 3 years ago
That's unusual. Can you provide a subset of matrix.txt
that can reproduce the error? I'll also check my .cool files, but your example will help to speed it up.
the data.table
package is apparently not loaded.
As I have only one chromosome, I can easily add the function directly to my script:
library(data.table)
library(SpectralTAD)
cool_mat = read.table("bwa.txt", header=F, col.names = c("chr1", "start1", "end1", "chr2", "start2", "end2", "IF"))
#Convert to sparse 3-column matrix using cooler2sparse from HiCcompare
#sparse_mats = HiCcompare::cooler2sparse(cool_mat)
cooler <- as.data.table(cool_mat)
colnames(cooler) <- c("chr1", "start1", "end1", "chr2", "start2",
"end2", "IF")
if (is.factor(cooler$chr1)) {
chroms <- levels(cooler$chr1)
}
if (is.character(cooler$chr1)) {
chroms <- unique(cooler$chr1)
}
temp <- cooler[, c("start1", "start2", "IF"), with = FALSE]
colnames(temp) <- c("region1", "region2", "IF")
sparse_mats <- subset(temp, IF != 0)
Yes, this is the problem. I'll add data.table as a required dependency. In a meantime, please, load it separately.
Hi, I cannot read in a matrix from
cooler dump --join
into HiCcompare: