How to use Combat in R??
1
0
Entering edit mode
7.0 years ago
madkitty ▴ 650

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 • 13k views
ADD COMMENT
2
Entering edit mode
7.0 years ago
komal.rathi ★ 4.0k

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 COMMENT

Login before adding your answer.

Traffic: 1382 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6