ComBat error: "The covariate is confounded with batch! "
0
0
Entering edit mode
@sharvari-gujja-6614
Last seen 19 months ago
United States

Hi,

I am trying run ComBat on methylation data to correct by plate and using experimental group as cancer type.

However, I get an error

> mMat = model.matrix(~as.factor(cancer), data=pheno) cbMat =
> ComBat(dat=as.matrix(hmMat), batch=pheno$plate, mod=mMat,
> par.prior=TRUE, prior.plot=F) 
Found29batches Note: one batch has only one sample, setting mean.only=TRUE Adjusting for1covariate(s) or covariate level(s) 
Error in ComBat(dat = as.matrix(hmMat), batch = pheno$plate, mod = mMat,  :  
The covariate is confounded with batch! Remove the covariate and rerun ComBat

Looking at the source code from where the error is thrown, the values for ncol(design) and n.batch are:

> ncol(design) [1] 31
> (n.batch+1) [1] 30

These two values are not equal. The breakdown for the cancers by plate is:

           p1   p2  p3  p4  p5  p6  p6  p8  p9  p10 p11 p12 p13 p14 p15 p16
    cancer1 2   5   8   1   6   32  16  4   0   26  16  0   0   4   0   0
    cancer2 0   0   0   0   0   0   0   0   29  0   0   22  19  0   39  24

            p17 p18 p19 p20 p21 p22 p23 p24 p25 p26 p27 p28 p29         
    cancer1 0   0   0   0   0   0   0   0   0   0   0   0   1           
    cancer2 36  39  10  15  24  26  11  60  39  33  24  55  0   

Can you please help with this error.

Thanks Sharvari

#combat • 3.0k views
ADD COMMENT
0
Entering edit mode

The error is pretty clear: non of your plates have a mix of your covariate (i.e. cancer type). So your only option is to run ComBat without accounting for cancer type.

ADD REPLY

Login before adding your answer.

Traffic: 747 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6