Entering edit mode
13 months ago
SKY
▴
60
I need some help.
I have raw counts matrix from feature counts and want to perform batch effect correction using ComBat-seq
I am confused about batch <- c(rep(1, 4), rep(2, 4))
?
What does 1,4
and 2,4
mean? are they columns/samples belonging to the different batches? How do I specify to ComBat to consider my column 7,8,9 as one batch and 10,11 as another?
Code Taken from https://github.com/zhangyuqing/ComBat-seq
count_matrix <- matrix(rnbinom(400, size=10, prob=0.1), nrow=50, ncol=8)
batch <- c(rep(1, 4), rep(2, 4))
adjusted <- ComBat_seq(count_matrix, batch=batch, group=NULL)
Thanks in advance
You can bring up the help documentation for the
rep
function with eitherhelp(rep)
or?rep
. If you look at the documentation you'll seerep(1, 4)
means to repeat the number 1 four times, soc(rep(1, 4), rep(2, 4))
means repeat the number 1 four times, and the number 2 four times. For the purpose ofComBat_seq
it's a way to specify that the first four samples are one batch, and the last four samples are another batch. For your data make a similar vector specifying which batch each of your samples is in.Adding to rpolicastro's comment, you cannot use a set of columns to specify the batch vector, you need it at least as a single data.frame column which in effect is a vector.