This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Combat For Batch Effect Correction In Known Batches

Hi everyone,

I have an expressionSet eset containing 12 samples & 21000 genes of cardiac tissue from Mouse. The samples' information is as follows:

                               chip sampleid   label strain treat       batch
   4769_48479_WTGFP_MoGene2.0st.CEL    48479   WTGFP     WT   GFP           1
  4769_48480_WTCRE1_MoGene2.0st.CEL    48480   WTCRE     WT   CRE           1
  4769_48481_WTCRE2_MoGene2.0st.CEL    48481   WTCRE     WT   CRE           1
  4769_48483_WTCRE4_MoGene2.0st.CEL    48483   WTCRE     WT   CRE           1
4769_48484_P1P4GFP1_MoGene2.0st.CEL    48484 P1P4GFP    DKO   GFP           1
4769_48485_P1P4GFP2_MoGene2.0st.CEL    48485 P1P4GFP    DKO   GFP           1
4769_48486_P1P4GFP3_MoGene2.0st.CEL    48486 P1P4GFP    DKO   GFP           1
4769_48487_P1P4CRE1_MoGene2.0st.CEL    48487 P1P4CRE    DKO   CRE           1
4769_48488_P1P4CRE2_MoGene2.0st.CEL    48488 P1P4CRE    DKO   CRE           1
4769_48490_P1P4CRE4_MoGene2.0st.CEL    48490 P1P4CRE    DKO   CRE           1
   4922_52242_WTGFP_MoGene2.0st.CEL    52242   WTGFP     WT   GFP           2
   4922_52243_WTGFP_MoGene2.0st.CEL    52243   WTGFP     WT   GFP           2

As you can see there are two batches, the first 10 samples belong to batch 1 and last two samples belong to batch 2. I tried to batch correct the samples using:

pheno <- pData(eset) #get the phenotypic data from eset (expressionSet)

pheno$batch <- c(rep(1,10),rep(2,2)) #define batches

expr.test <- exprs(eset) #extract expression data into a double matrix

mod = model.matrix(~1, data=pheno) #Model matrix for other covariates besides batch

combat.expr<-ComBat(expr.test,pheno$batch,mod)

I did my PCA on this but doesn't look right. I think it is because in the samples with label WTGFP, one comes from batch 1 and other two come from batch 2.

How can I incorporate this information in my model.matrix function so that it corrects for different batches but does not differentiate between similarly labeled groups?

r

What you did should be right, and I wouldn't look for the cause of the confusion in the processing, but rather in the data themselves (maybe labelling errors or they just don't cluster together).

However, I don't understand what you mean with this: " but does not differentiate between similarly labeled groups?". You want ComBat to ignore the fact that your samples have different labels? In this case, just remove the label column from pheno.

2 answers

Just for clarity, I believe you performed following steps:

  1. Read and Normalized CEL files.
  2. Did box plot for sanity check of normalization
  3. PCA plot on normalized dataset
  4. Combat on normalized dataset (as mentioned above)
  5. PCA on the Batch Corrected matrix.

What are the changes do you see ? Can you share before and after PCA plots ? Did you check for other principal components ? I could be wrong; but it seems that from your info sample table the PC1 and PC2 should be genotype and treatment (not on the same order but depends upon the effect). Also, did you do the PCA on batch 1 dataset and how it looks ?

PS: You don't have to perform batch correction if the samples cluster based on genotype and conditions; you perform batch correction if the sample are confounded due to batch or in other words samples cluster based on batch.

Just an FYI. This question was posted 2.6 years ago. I obviously don't work on it anymore and cannot answer your questions because they are very project specific. Thank you for taking out your time to answer it, but I believe if you answered more recent questions or older questions that are not project specific, you will be making better use of your time.

I didn't see the timeline (or 2.6 years) and just saw it on the message board -- may be because of the answer of anjalianjali . Anyways, thanks for your suggestion.

i don't know the answer, but i want to know how you read phenotypic data?

pData(expressionSet object)

I used this command and it gives me the sample name and its serial number and no other detail. my codes after setting my working directory are:

getGEOSuppFiles("GSE3524")

untar("GSE3524_RAW.tar", exdir="data3524")

cels <- list.files("data3524/", pattern = "[gz]")

sapply(paste("data3524", cels, sep="/"), gunzip)

cels

library(affy)

setwd("F:/project/data3524")

raw.data3524 <- ReadAffy()

eset<-rma(raw.data3524)

pData(eset)

result of this is: sample GSM80460.CEL 1 GSM80461.CEL 2 GSM80462.CEL 3 GSM80463.CEL 4 GSM80464.CEL 5 GSM80465.CEL 6 GSM80466.CEL 7 GSM80467.CEL 8 GSM80468.CEL 9 GSM80469.CEL 10 GSM80470.CEL 11 GSM80471.CEL 12 GSM80472.CEL 13 GSM80473.CEL 14 GSM80474.CEL 15 and so on............

Log in to answer this question.