zhangyuqing / ComBat-seq

Batch effect adjustment based on negative binomial regression for RNA sequencing count data
154 stars 39 forks source link

Keep getting the error that rows do not match #30

Open sameet-sema4 opened 2 years ago

sameet-sema4 commented 2 years ago

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.

akira8451 commented 1 year ago

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