I have RNA seq data and I need to use combat to remove the batch effects. Somehow when I run it, it isnt actually doing anything.

The code:

dds <- DESeq(dds, betaPrior=TRUE)
normalized_counts <- counts(dds, normalized=TRUE)
log2 = log2(normalized_counts+1)

modcombat = model.matrix(~dex, metadata)# - with metadata being a variable containing treatment or control (under dex column) and batch and name of each patient.

com<-ComBat(log2, metadata$Batch, mod = modcombat)

Its supposed to be 4 different batches, but in the com variable I can see that the values have stayed the same as in log2.

What could be wrong? Would appreciate any help!

  • $\begingroup$ side note: combat is a linear batch correction method and does not perform optimally on all datasets $\endgroup$ Mar 10 at 19:28
  • $\begingroup$ Are you completely sure that you can make the model matrix with a mix of column names as strings and object names like that? $\endgroup$
    – swbarnes2
    Mar 10 at 20:39
  • $\begingroup$ No I am not sure about that, I havent found a good explanation for how to make the model matrix. I suspect my problem is there maybe. $\endgroup$
    – emma
    Mar 12 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.