[BioC] Error when applying ComBat in SCAN.UPC

Peter Langfelder peter.langfelder at gmail.com
Sun Jun 8 22:55:14 CEST 2014

On Sun, Jun 8, 2014 at 10:24 AM, Joel Ma <jzma at unimelb.edu.au> wrote:
> Hi Peter
> Thanks for the reply.
> What if I used ComBat separate after SCAN.UPC? I have tried that but I couldn't get ComBat right.
> This is what I have typed in after going through forums on ComBat.
>> Sdata <- SCAN("*.CEL", convThreshold = 0.01, verbose = TRUE)
>> Bdata = ComBat(dat=Sdata, batch=batch, mod=batchtargets.txt, numCovs = 3, par.prior = TRUE, prior.plots = FALSE)
> Error in cbind(mod, batch) : object 'batchtargets.txt' not found
>> Bdata = ComBat(dat=Sdata, batch=batchtargets.txt, numCovs = 3, par.prior = TRUE, prior.plots = FALSE)
> Error in cbind(mod, batch) : argument "mod" is missing, with no default
>> Bdata <- ComBat(Sdata, sample$Batch, c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1))
> Error in sample$Batch : object of type 'closure' is not subsettable

Don't take this the wrong way, but your code simply doesn't make
sense, so much so that I don't even know what is it you are trying to
achieve, so I cannot suggest corrections.

Here are a few suggestions:

1. Read the help file for SCAN (type help("SCAN") in R). It returns an
object of type ExpressionSet; to get the actual expression data from
it, use the function (method) 'exprs' on it. Call the resulting object
say 'normData'.

2. The object 'normData' can be fed to ComBat; read the help file and
maybe try to find some examples of use for ComBat.

3. For ComBat, you need the batch variable (call it, for example,
'batch'); this is a vector with one element for each sample and you
can code the batches say 1 and 2. Make sure the order of the vector
'batch' corresponds to the order of the samples in 'normData'.

4. You also need a model matrix that specifies covariates you want
ComBat to take into account. If you have none, use the argument mod =
model.matrix(~1, data = data.frame(batch)).

5. Run ComBat and see if you get any errors; if you do, copy and paste
the relevant part of the error into your favorite search engine and
read the suggestions on how to solve it.

6. If you still can't get it to work, email the list again.

Hope this helps,


More information about the Bioconductor mailing list