Zhengdeng Lei, PhD
Zhengdeng Lei, PhD
2007 - 2009 High Throughput Computational Analyst, Memorial Sloan-Kettering Cancer Center, New York
2003 - 2007 PhD, Bioinformatics, University of Illinois at Chicago
Wednesday, July 4, 2012
run.ComBat
run.ComBat <- function(exp.file, sample_info_file="batches.info.txt", src.dir=getwd())
{
setwd(src.dir)
if(!file.exists(sample_info_file)) {
print(paste(sample_info_file, " not found in", src.dir))
return()
}
gene.exp <- read.table(exp.file, header=T, sep="\t", row.names=1)
forcombat.exp.file <- sub("txt", "forcombat.txt", exp.file, ignore.case = T)
after.combat.exp.file <- sub("txt", "AFTER.Combat.txt", exp.file, ignore.case = T)
write.table(gene.exp, file=forcombat.exp.file, sep="\t", quote=F, row.names=F)
gene.id <- rownames(gene.exp)
ComBat(expression_xls=forcombat.exp.file, sample_info_file=sample_info_file, type='txt')
file.remove(forcombat.exp.file)
combat.out.file <- paste("Adjusted_", forcombat.exp.file, "_.xls", sep="")
combat.gene.exp <- read.table(combat.out.file, header=T, sep="\t")
rownames(combat.gene.exp) <- gene.id
file.remove(combat.out.file)
write.table(combat.gene.exp, file=after.combat.exp.file, sep="\t", quote=F, col.names=NA)
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment