Question: How to use Combat in R??
0
gravatar for madkitty
3.7 years ago by
madkitty580
Canada
madkitty580 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? 

 

 

 

Library(sva)

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 • 7.5k views
ADD COMMENTlink written 3.7 years ago by madkitty580
1
gravatar for komal.rathi
3.6 years ago by
komal.rathi3.3k
Children's Hospital of Philadelphia, Philadelphia, PA
komal.rathi3.3k 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 3.6 years ago • written 3.6 years ago by komal.rathi3.3k
Please log in to add an answer.

Help
Access

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