Hey,
Is it possible to correct for both a location and batch effect using Limma?
I have 4 surfaces: PET, PE, Glass and Water,
5 locations: A, B, C, D ,E,
and 2 batches: 1, 2
enter OTU<-read.csv("filterotu.csv",header=T,row.names=1)
targets<-read.csv("sample.csv",header=T,row.names=1)
tax<-read.csv("filter_tax.csv", header=T, row.names=1)
tax <- as.matrix(tax)
group<-factor(targets$surface)
location<-factor(targets$location)
batch<-factor(targets$Batch)
dge<- DGEList(counts=OTU,samples=targets, genes=tax, group=group)
keep<- filterByExpr(dge, min.count = 1)
dge <- dge[keep,,keep.lib.sizes=FALSE]
dge <- calcNormFactors(dge)
design <- model.matrix(~0+group)
I tried using batch=batch and batch2=location but that didn't work.
toplot<-(removeBatchEffect(cpm(dge,log=TRUE,prior.count=5),batch=batch,batch2=location,design=design))
error: "Partial NA coefficients for 7319 probe(s)"
Then I tried the duplicatecorrelation function
corfit <- duplicateCorrelation(v,design,block=batch)
toplot <- removeBatchEffect(cpm(dge,log=TRUE,prior.count=5), batch=location, design=design, block=batch, correlation=corfit$consensus)
but when I plotted the MDS it was exactly the same as just removing batch=location alone, as if the block wasn't having any effect.
Anyone got any suggestions?
Hi Katherine, which of your questions do you wish to keep open? You should be able to delete one.