ComBat-seq icon indicating copy to clipboard operation
ComBat-seq copied to clipboard

Keep getting the error that rows do not match

Open sameet-sema4 opened this issue 4 years ago • 1 comments

I have a matrix with 2300 samples, and about 34 batches. I am trying to use ComBat_Seq on this matrix. The matrix is arranged by genes in the rows, and samples in the columns. I have a vector to be used a batches that has same length as the number of columns in the count matrix. But I keep getting the following error:

    > length(use_batch)
    [1] 2312 
    > ncol(ori_matrix)
    [1] 2312
    > corrected_mat <- ComBat_seq(ori_matrix, batch = use_batch)
    Found 34 batches
    Using null model in ComBat-seq.
    Error in cbind(batchmod, mod) : 
      number of rows of matrices must match (see arg 2)

Am I missing something? What is the way around this. The ori_matrix of the original count values is a matrix.

sameet-sema4 avatar Dec 21 '21 18:12 sameet-sema4

maybe ori_matrix <- t(orimatrix) can solve this problem

akira8451 avatar Feb 28 '23 07:02 akira8451