[Qpcr-commits] r93 - pkg/NormqPCR/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Feb 25 18:50:25 CET 2010
Author: jperkins
Date: 2010-02-25 18:50:24 +0100 (Thu, 25 Feb 2010)
New Revision: 93
Added:
pkg/NormqPCR/R/combineTechReps.R
Log:
now can combine technical replicates using mean
Added: pkg/NormqPCR/R/combineTechReps.R
===================================================================
--- pkg/NormqPCR/R/combineTechReps.R (rev 0)
+++ pkg/NormqPCR/R/combineTechReps.R 2010-02-25 17:50:24 UTC (rev 93)
@@ -0,0 +1,20 @@
+setGeneric("combineTechReps",
+ function(qPCRBatch)
+ standardGeneric("combineTechReps")
+)
+setMethod("combineTechReps", signature = "qPCRBatch", definition =
+ function(qPCRBatch) {
+ expM <- exprs(qPCRBatch)
+ origDetectors <- row.names(expM)
+ if (FALSE %in% grepl("_TechReps", origDetectors)) stop("These are not tech reps")
+ newDetectors <- unique(gsub("_TechReps.\\d","", origDetectors))
+
+ 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))
+ NewExpM[detector,] <- dValues
+ }
+ qPCRBatch <- new("qPCRBatch", exprs = NewExpM, phenoData = phenoData(qPCRBatch))
+ }
+)
More information about the Qpcr-commits
mailing list