This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to run combat-seq, strange output?

I ran the combat-seq for my data

The full program was executed, but its output is as follows

I checked the code several times and I do not know where the problem is

Can you help?

files <-list.files(".","*.count")
cnt <- lapply(files,read.delim,header=F)
cnt<- lapply(files,read.delim,header=F,stringsAsFactors=F)
cnt<-do.call(cbind,cnt)
cnt<- cnt[,-seq(1,ncol(cnt),2)]
colnames(cnt)<- sub(".count","",files)
batch<- samplerace
samplecondition <- factor(rep(c('control','control','fibrosis','fibrosis'),84))
covariate_matrix = cbind(group,samplegender)
cntcombat<-ComBat_seq(cnt,batch= batch,full_mod=TRUE,group=NULL, 
                      covar_mod = covariate_matrix)


 head(cntcombat)
[[1]]
[1] 50

[[2]]
[1] 11

[[3]]
   [1] 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  [70] 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 [139] 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 [208] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
 [277] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2 0 0 2 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
r batch-effect combat-seq

1 answer

This could be because class(cnt) is not "matrix" (it is e.g. "data.frame").

So you can do:

ComBat_seq(as.matrix(cnt),batch= batch,full_mod=TRUE,group=NULL, covar_mod = covariate_matrix)

Source: https://github.com/zhangyuqing/ComBat-seq/issues/21

Log in to answer this question.