]> git.donarmstrong.com Git - rsem.git/blobdiff - EBSeq/R/RankNorm.R
Included EBSeq for downstream differential expression analysis
[rsem.git] / EBSeq / R / RankNorm.R
diff --git a/EBSeq/R/RankNorm.R b/EBSeq/R/RankNorm.R
new file mode 100644 (file)
index 0000000..e3b0177
--- /dev/null
@@ -0,0 +1,11 @@
+
+RankNorm=function(Data){
+       RankData=apply(Data, 2, rank)
+       SortData=apply(Data, 2, sort)
+       SortMean=rowMeans(SortData)
+       SortMean[SortMean==0]=1
+       NormMatrix=sapply(1:ncol(Data), function(i)Data[,i]/(SortMean[RankData[,i]]))
+       NormMatrix[NormMatrix==0]=1
+       NormMatrix
+       }
+