[Qpcr-commits] r98 - pkg/NormqPCR/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 15 18:39:22 CET 2010


Author: jperkins
Date: 2010-03-15 18:39:22 +0100 (Mon, 15 Mar 2010)
New Revision: 98

Modified:
   pkg/NormqPCR/R/combineTechReps.R
   pkg/NormqPCR/R/deltaDeltaAvgCt.R
   pkg/NormqPCR/R/deltaDeltaCt.R
Log:
Make it all work & build

Modified: pkg/NormqPCR/R/combineTechReps.R
===================================================================
--- pkg/NormqPCR/R/combineTechReps.R	2010-02-26 11:44:49 UTC (rev 97)
+++ pkg/NormqPCR/R/combineTechReps.R	2010-03-15 17:39:22 UTC (rev 98)
@@ -12,7 +12,7 @@
     NewExpM <- matrix(nrow = length(newDetectors), ncol = dim(expM)[2], dimnames = list(newDetectors,colnames(expM)))
 
     for(detector in newDetectors){
-      dValues <- as.numeric(apply(expM[grepl(detector, origDetectors),],2,mean,na.rm=TRUE))
+      dValues <- as.numeric(apply(expM[grepl(detector, origDetectors),],2,geomMean,na.rm=TRUE))
       NewExpM[detector,] <- dValues
     }
     NewExpM[is.na(NewExpM)] <- NA

Modified: pkg/NormqPCR/R/deltaDeltaAvgCt.R
===================================================================
--- pkg/NormqPCR/R/deltaDeltaAvgCt.R	2010-02-26 11:44:49 UTC (rev 97)
+++ pkg/NormqPCR/R/deltaDeltaAvgCt.R	2010-03-15 17:39:22 UTC (rev 98)
@@ -23,8 +23,8 @@
       sdHkgControl <- NA
     }
     else {
-      meanHkgCase <- mean(hkgVCase, na.rm=TRUE)
-      meanHkgControl <- mean(hkgVControl, na.rm=TRUE)
+      meanHkgCase <- geomMean(hkgVCase, na.rm=TRUE)
+      meanHkgControl <- geomMean(hkgVControl, na.rm=TRUE)
       sdHkgCase <- sd(hkgVCase, na.rm=TRUE)
       sdHkgControl <- sd(hkgVControl, na.rm=TRUE)
     }
@@ -38,8 +38,10 @@
     for (detector in featureNames(qPCRBatch)) {
           VCase <- caseM[detector,]
           VControl <- controlM[detector,]
-          meanCase <- mean(VCase, na.rm=TRUE)
-          meanControl <- mean(VControl, na.rm=TRUE)
+          if(is.na(VCase)) VCase <- rep(NA, length(VCase))
+          else meanCase <- geomMean(VCase, na.rm=TRUE)
+          if(is.na(VControl)) VControl <- rep(NA, length(VControl))
+          else meanControl <- geomMean(VControl, na.rm=TRUE)
           sdCase <- sd(VCase, na.rm=TRUE)
           sdControl <- sd(VControl, na.rm=TRUE)
 
@@ -48,7 +50,7 @@
           sdCase <- NA
         }
         else {
-          meanCase <- mean(VCase, na.rm=TRUE)
+          meanCase <- geomMean(VCase, na.rm=TRUE)
           sdCase <- sd(VCase, na.rm=TRUE)
         }
         if(sum(is.na(VControl)) > maxNAControl) {
@@ -56,7 +58,7 @@
           sdControl <- NA
         }
         else {
-          meanControl <- mean(VControl, na.rm=TRUE)
+          meanControl <- geomMean(VControl, na.rm=TRUE)
           sdControl <- sd(VControl, na.rm=TRUE)
         }
         dCtCase <- meanCase - meanHkgCase

Modified: pkg/NormqPCR/R/deltaDeltaCt.R
===================================================================
--- pkg/NormqPCR/R/deltaDeltaCt.R	2010-02-26 11:44:49 UTC (rev 97)
+++ pkg/NormqPCR/R/deltaDeltaCt.R	2010-03-15 17:39:22 UTC (rev 98)
@@ -26,23 +26,32 @@
     for (detector in featureNames(qPCRBatch)) {
         VCase <- caseM[detector,]
         VControl <- controlM[detector,]
-
+warning("length")
+#stop("length of case is:",VCase,"_",length(VCase))
         if(length(VCase) == 1) {
           warning("Only one Detector for Case")
           dCtCase <- VCase
           sdCase <- NA
-        }
-        else {
-          dCtCase <- mean(VCase - hkgVCase, na.rm=TRUE)
+        } else if(is.na(VCase)) {
+          warning("No Detector for Case")
+          dCtCase <- rep(NA, length = VCase)
+          dCtControl <- NA
+        } else {
+          dCtCase <- geomMean(VCase, na.rm=TRUE) - geomMean(hkgVCase, na.rm=TRUE)
           sdCase <- sd(VCase - hkgVCase, na.rm=TRUE)
         }
+
         if(length(VControl) == 1) {
           warning("Only one Detector for Control")
           dCtControl <- VControl
+          sdControl <- NA
+        } else if(is.na(VControl)) {
+          warning("No Detector for Control")
+          dCtControl <- rep(NA, length = VControl)
+          sdControl <- NA
+        } else {
+          dCtControl <- geomMean(VControl, na.rm=TRUE) - geomMean(hkgVControl, na.rm=TRUE)
         }
-        else {
-          dCtControl <- mean(VControl - hkgVControl, na.rm=TRUE)
-        }
         if(sum(is.na(VCase)) > maxNACase) {
           dCtCase <- NA
         }



More information about the Qpcr-commits mailing list