Question: How to use Combat in R??
gravatar for madkitty
5.8 years ago by
madkitty620 wrote:

I'm trying to use combat to correct for batch effect in our dataset. The sample csv files contains genes in rows, and samples in columns, and expression value are from different microarray. We have in total 6 batches, and the sif file contains 3 columns arrays, samples, batch (as per the manual). R generates an error message when running combat.. I'm not sure what to do from here. Am I using combat the wrong way? 





dat = read.csv("Combat_matrix_input.csv");

sif = read.csv("sif.csv");

modcombat = model.matrix(~1, data=dat)

newdata = ComBat(dat=dat, batch=sif$Batch, par.prior = TRUE, mod = modcombat)

Found 6 batches

Error in cbind(batchmod, mod) : 

  number of rows of matrices must match (see arg 2)



combat R software error • 12k views
ADD COMMENTlink written 5.8 years ago by madkitty620
gravatar for komal.rathi
5.8 years ago by
Children's Hospital of Philadelphia, Philadelphia, PA
komal.rathi3.7k wrote:

It would be helpful if you could show some data in the input files - sif.csv & combat_matrix_input.csv. But just by looking at the code I think the problem lies in the model.matrix step. While generating the model, use the phenotype file and not the expression file:

mod = model.matrix(~1, data = sif) 
ADD COMMENTlink modified 5.8 years ago • written 5.8 years ago by komal.rathi3.7k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2221 users visited in the last hour