## 下面这个函数是对每个基因挑选最大表达量探针 rmDupID <-function(a=matrix(c(1,1:5,2,2:6,2,3:7),ncol=6)){
对于其他芯片您里面这个(c(1,1:5,2,2:6,2,3:7),ncol=6需要改不?如若挑选平均表达量需要怎么改您的代码
rmDupID <-function(a=matrix(c(1,1:5,2,2:6,2,3:7),ncol=6)){
exprSet=a[,-1]
rowMeans=apply(exprSet,1,function(x) mean(as.numeric(x),na.rm=T))
a=a[order(rowMeans,decreasing=T),]
exprSet=a[!duplicated(a[,1]),]
#exprSet=apply(exprSet,2,as.numeric)
exprSet=exprSet[!
is.na(exprSet[,1]),]
rownames(exprSet)=exprSet[,1]
exprSet=exprSet[,-1]
return(exprSet)
}
exprSet=rmDupID(a)