hansenlab / bnbc

1 stars 0 forks source link

the length of `rowData` should be equal to the number of rows of the matrices in `contacts` #5

Closed Gemma-Zhang-326 closed 11 months ago

Gemma-Zhang-326 commented 11 months ago

Hi, Hansen, thanks for your effort in developing this excellent tool. I am using this tool to remove batch effect when handling my own cool data. However, something awkward happened to me when executing the getChrCGFromCools function. Do you have any ideas about this error? Many thanks, looking forward to your early reply. Here I paste my code

colData <- read.csv(file = "./bnbc_col.csv",header = T, row.names = 1,
                    encoding = 'UTF-8')
str(colData)
colData <- as(colData, "DataFrame")
coolerDir <- "hicrep/"
cools <- list.files(coolerDir, pattern="cool$", full.names=TRUE)
step <- 50000
bin.ixns.list <- bnbc:::getGenomeIdx(cools[1], step)
cool.cg <- bnbc:::getChrCGFromCools(bin.ixns,
                                    files = cools[1:2],
                                    chr = "chr1",
                                    colData = colData[1:2,])

It keeps throwing this error

Error in validObject(.Object) : 
  类别为“ContactGroup”的对象不对: the length of `rowData` should be equal to the number of rows of the matrices in `contacts`
cafletezbrant commented 11 months ago

This error happens when you have more genomic bins listed as existing (this is rowData) than you have rows in your matrix. Probably this is coming from a mismatch in the dimensionality of each matrix in the cooler file.

Gemma-Zhang-326 commented 11 months ago

Thank you for your prompt reply, as you say, that's the problem. It has been solved in the way that I transform the cooler file into the matrix by using the function named cool2matrix in hicrep package.

Thanks a lot!

Gemma