[Qpcr-commits] r110 - in pkg/NormqPCR: R inst/doc man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 1 15:02:30 CEST 2010


Author: jperkins
Date: 2010-06-01 15:02:29 +0200 (Tue, 01 Jun 2010)
New Revision: 110

Removed:
   pkg/NormqPCR/man/deltaDeltaAvgCt.Rd
Modified:
   pkg/NormqPCR/R/combineTechReps.R
   pkg/NormqPCR/R/deltaCt.R
   pkg/NormqPCR/R/deltaDeltaCt.R
   pkg/NormqPCR/inst/doc/NormqPCR.Rnw
Log:

make a couple of changes to the normqPCR vignette
make the combination of technical reps be done via arithmetic mean (combineTechReps.R)
make the combination of housekeepers be done by geomMean (deltaDeltaCt)
clean up deltaCt.R


Modified: pkg/NormqPCR/R/combineTechReps.R
===================================================================
--- pkg/NormqPCR/R/combineTechReps.R	2010-05-22 08:45:05 UTC (rev 109)
+++ pkg/NormqPCR/R/combineTechReps.R	2010-06-01 13:02:29 UTC (rev 110)
@@ -10,7 +10,7 @@
     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,geomMean,na.rm=TRUE))
+      dValues <- as.numeric(apply(expM[grepl(detector, origDetectors),],2,mean,na.rm=TRUE))
       NewExpM[detector,] <- dValues
     }
     NewExpM[is.na(NewExpM)] <- NA

Modified: pkg/NormqPCR/R/deltaCt.R
===================================================================
--- pkg/NormqPCR/R/deltaCt.R	2010-05-22 08:45:05 UTC (rev 109)
+++ pkg/NormqPCR/R/deltaCt.R	2010-06-01 13:02:29 UTC (rev 110)
@@ -19,7 +19,7 @@
       hkgV <- vector(length = dim(hkgM)[2])
       for(i in 1:dim(hkgM)[2]) {
           if(! FALSE %in% is.na(hkgM[,i])) next # go to next sequence if we have only NAs
-          hkgV[i] <- geomMean(hkgM[,i], na.rm=TRUE)
+          hkgV[i] <- mean(hkgM[,i], na.rm=TRUE)
       }
     }
     else {
@@ -30,7 +30,7 @@
       hkgV <- hkgM # Because it's a vector really anyway
       cat(hkgV)
     }
-    exprs(qPCRBatch) <- 2^-(t(t(exprs(qPCRBatch)) - hkgV))
+    exprs(qPCRBatch) <- t(t(exprs(qPCRBatch)) - hkgV)
     return(qPCRBatch)
   }
 )

Modified: pkg/NormqPCR/R/deltaDeltaCt.R
===================================================================
--- pkg/NormqPCR/R/deltaDeltaCt.R	2010-05-22 08:45:05 UTC (rev 109)
+++ pkg/NormqPCR/R/deltaDeltaCt.R	2010-06-01 13:02:29 UTC (rev 110)
@@ -27,8 +27,8 @@
     if(combineHkgs == TRUE) {
 	hkgMCase <- caseM[hkgs, ]
         hkgMControl <- controlM[hkgs, ]
-	hkgVCase <- apply(hkgMCase, 2, mean, na.rm=TRUE)
-	hkgVControl <- apply(hkgMControl, 2, mean, na.rm=TRUE)
+	hkgVCase <- apply(hkgMCase, 2, geomMean, na.rm=TRUE)
+	hkgVControl <- apply(hkgMControl, 2, geomMean, na.rm=TRUE)
     } else {
         hkg <- hkgs[1]
     }

Modified: pkg/NormqPCR/inst/doc/NormqPCR.Rnw
===================================================================
--- pkg/NormqPCR/inst/doc/NormqPCR.Rnw	2010-05-22 08:45:05 UTC (rev 109)
+++ pkg/NormqPCR/inst/doc/NormqPCR.Rnw	2010-06-01 13:02:29 UTC (rev 110)
@@ -78,7 +78,7 @@
 @
 
 It is likely that before continuing with the analysis, the user would wish to
-average the technical replicates by finding their geometric mean. This can be
+average the technical replicates by finding their mean. This can be
 achieved using the combineTechReps function, which will produce a new qPCRBatch
 object, with all tech reps reduced to one reading:
 
@@ -289,7 +289,7 @@
 Vand02 recommend a cut-off value of 0.15 for the pairwise variation. Below this
 bound the inclusion of an additional housekeeping gene is not required. 
 %-------------------------------------------------------------------------------
-\subsection{NormFinder} 
+\subsection{NormFinder}
 %-------------------------------------------------------------------------------
 The second method for selection reference/housekeeping genes implemented in 
 package is the method derived by \cite{NormFinder} (in the sequel: And04)
@@ -362,8 +362,13 @@
 <<dCt>>=
 hkgs<-"Actb-Rn00667869_m1"
 qPCRBatch.norm <- deltaCt(qPCRBatch =  qPCRBatch.taqman, hkgs = hkgs)
+head(exprs(qPCRBatch.norm))
 @
 
+This returns a new \code{qPCRBatch}, with new values in the exprs slot. This will be compatible with many other bioconductor and R packages, such as heatmap.
+
+Note these numbers might be negative. For further analysis requiring postive values only, 2^ can be used to transform the data into $2^{\Delta CT}$ values.
+
 %-------------------------------------------------------------------------------
 \subsection{$\Delta Ct$ method using a combination of housekeeping genes}
 %-------------------------------------------------------------------------------
@@ -372,8 +377,12 @@
 algorithms described above, they can. This is implemented by calculating the
 average of these values to form a "pseudo-housekeeper" which is subtracted from the other values. So using the same dataset as above, using housekeeping genes GAPDH, Beta-2-microglobulin and Beta-actin, the following steps would be taken:
 
+<<dCt many genes>>=
+hkgs<-c("Actb-Rn00667869_m1", "B2m-Rn00560865_m1", "Gapdh-Rn99999916_s1")
+qPCRBatch.norm <- deltaCt(qPCRBatch =  qPCRBatch.taqman, hkgs = hkgs)
+head(exprs(qPCRBatch.norm))
+@
 
-
 %-------------------------------------------------------------------------------
 \subsection{$2^{-\Delta \Delta Ct}$ method using a single housekeeper}
 %-------------------------------------------------------------------------------
@@ -456,7 +465,7 @@
 If the user wishes to normalise by more than one housekeeping gene, for example
 if they have found a more than one housekeeping gene using the NormFinder/geNorm
 algorithms described above, they can. This is implemented by calculating the
-average of these values to form a "pseudo-housekeeper" which is subtracted from the other values. For the dataset above, using housekeeping genes GAPDH, Beta-2-microglobulin and Beta-actin:
+average of these values using the geometric mean to form a "pseudo-housekeeper" which is subtracted from the other values. For the dataset above, using housekeeping genes GAPDH, Beta-2-microglobulin and Beta-actin:
 
 <<taqman gM>>=
 path <- system.file("exData", package = "ReadqPCR")
@@ -466,14 +475,13 @@
 colnames(contM) <- c("interestingPhenotype","wildTypePhenotype")
 rownames(contM) <- sampleNames(qPCRBatch.taqman)
 hkgs<-c("Actb-Rn00667869_m1", "B2m-Rn00560865_m1", "Gapdh-Rn99999916_s1")
-#ddCt.gM.taqman <- deltaDeltaCt(qPCRBatch = qPCRBatch.taqman, maxNACase=1, maxNAControl=1, hkgs=hkgs, contrastM=contM, case="interestingPhenotype", control="wildTypePhenotype", combineHkgs=TRUE)
-#head(ddCt.gM.taqman)
+ddCt.gM.taqman <- deltaDeltaCt(qPCRBatch = qPCRBatch.taqman, maxNACase=1, maxNAControl=1, hkgs=hkgs, contrastM=contM, case="interestingPhenotype", control="wildTypePhenotype", combineHkgs=TRUE)
+head(ddCt.gM.taqman)
 @
 
-There is also the option of using the geometric mean method using shared
+There is also the option of using the mean housekeeper method using shared
 variance between the samples being compared, similar
-to the second \code{deltaDeltaCt} method shown above, intended for use when the samples
-are being compared from different experiments.
+to the second \code{deltaDeltaCt} method shown above.
 <<taqman gM Avg>>=
 path <- system.file("exData", package = "ReadqPCR")
 taqman.example <- paste(path, "/example.txt", sep="")

Deleted: pkg/NormqPCR/man/deltaDeltaAvgCt.Rd
===================================================================
--- pkg/NormqPCR/man/deltaDeltaAvgCt.Rd	2010-05-22 08:45:05 UTC (rev 109)
+++ pkg/NormqPCR/man/deltaDeltaAvgCt.Rd	2010-06-01 13:02:29 UTC (rev 110)
@@ -1,41 +0,0 @@
-\name{deltaDeltaAvgCt}
-\alias{deltaDeltaAvgCt}
-\alias{deltaDeltaAvgCt,qPCRBatch-method}
-\title{ Perform normalization and differential expression with given housekeeping gene. Stats calculated by averaging values}
-\description{
-Normalise qPCR eset using housekeeping genes as control, then perform differential expression analysis using the delta delta Ct method.
-Differs from the deltaDeltaCt method in that the values are pooled and standard deviation calculated between the case and hkg value.
-Suitable when housekeeping genes are from different wells/samples to the other detectors.
-}
-\usage{
-deltaDeltaAvgCt(qPCRBatch, maxNACase=0, maxNAControl=0, hkg, contrastM, case, control)
-}
-\arguments{
-  \item{qPCRBatch}{ Expression set containing qPCR data. 
-}
-  \item{maxNACase}{ Maximum number of NA values allowed before a detector's reading is discarded for samples designated as case
-}
-  \item{maxNAControl}{ Maximum number of NA values allowed before a detector's reading is discarded for samples designated as control
-}
-  \item{hkg}{ String containing the name of th name of the housekeeping gene which will be used to normalise the rest of the genes.
-}
-  \item{contrastM}{ A binary matrix which designates case and control samples
-}
-  \item{case}{ The name of the column in contrastM that corresponds to the case samples
-}
-  \item{control}{ The name of the column in contrastM that corresponds to the control samples
-}
-}
-\details{
-  Takes expression set of qPCR values and normalises them using different housekeeping genes. Returns seperate sets of values for each housekeeping gene given.
-}
-\value{
-  matrix with columns containing the detector ids, the 2^delta delta Ct values and the minimum and maximum values (ie the values that are 1 sd away )
-}
-%\references{ }
-\author{ James Perkins \email{jperkins at biochem.ucl.ac.uk}}
-%\note{}
-%\seealso{}
-%\examples{
-%}
-\keyword{data}



More information about the Qpcr-commits mailing list