Residual Disease Paper ======================================================== Quantifying Public PCR Data -------------------------------------------------------- by Shelley Herbrich ## 1 Executive Summary ### 1.1 Introduction In this report, we present the script used to generate the final PCR quantification summaries for ADH1B and FABP4. ### 1.2 Data & Methods We use the "rawPCRData.RData" file which contains the well-specific source, plate, randomized sample identifier, target gene, baseline-corrected fluorescence measurements for 40 cycles, and baseline coordiantes. For each sample, we have 2 to 3 technical replicates for both ADH1B and FABP4 as well as the control, 18S. Some wells were manually filtered for poor quality. We chose to use a "window-of-linearity" method, as introduced by Ramakers et al (2003), to quantify the PCR results from the baseline-corrected fluorescence measurements obtained from the vendor software. This method fits a linear model to the cycle number versus log fluorescence within a sliding window of defined size within a fixed border. The optimal model is that with the maximum log-linear range. Based on this model, the intercept corresponds to the initial template fluorescence and the slope is an estimate of the PCR efficiency. This algorithm is implemented in **sliwin** (part of the [qpcr](http://www.dr-spiess.de/) package). We require that the model not be fit within the baseline by forcing the lower bound of the border to be greater than the "take-off point" of exponential growth. Because the 18S fluorescence takes off almost immediately, we allow for a smaller window size to fit the optimal linear model. ### 1.3 Results We generate the ADH1B and FABP4 PCR values that correspond to the "PCRResults.RData" object. ## 2 Options and Libraries We load the libraries we will use in this report. ```r library(qpcR) ``` ## 3 Loading Data Next, we load the deidentified raw PCR data. ```r load(file.path("RDataObjects", "rawPCRData.RData")) ``` ## 4 Quantifying PCR Data We quantify the PCR measurements for FABP4 and ADH1B using the method described above and display the results. ```r sampleID <- unique(rawPCRData$Sample.Name) PCRquantifications <- data.frame(Source = rep("", length(sampleID)), Plate = rep("", length(sampleID)), Sample.Name = sampleID, FABP4 = rep(NA, length(sampleID)), ADH1B = rep(NA, length(sampleID)), stringsAsFactors = FALSE) for (i1 in 1:length(sampleID)) { tmp <- rawPCRData[which(rawPCRData$Sample.Name == sampleID[i1]), ] tempNo <- array(NA, length(tmp$Well)) for (i2 in 1:length(tmp$Well)) { subDRn <- cbind(1:40, t(tmp[i2, grep("Cycle", colnames(tmp))])) m <- pcrfit(subDRn, cyc = 1, fluo = 2, model = l3) to <- tryCatch(takeoff(m)$top, error = function(e) NA) border <- c(0, 0) if (to < tmp[i2, "Baseline.End"] & !is.na(to)) border <- c(tmp[i2, "Baseline.End"] - to, 0) if (tmp$Target.Name[i2] == "18S") { sw <- tryCatch(sliwin(m, border = border, wsize = 4:6, plot = FALSE), error = function(e) NULL) } else { sw <- tryCatch(sliwin(m, border = border, plot = FALSE), error = function(e) NULL) } if (!is.null(sw)) tempNo[i2] <- unlist(sw["init"]) } targetMeans <- sapply(split(tempNo, tmp$Target.Name), mean, na.rm = TRUE) PCRquantifications[i1, "Source"] <- as.character(tmp$Source[1]) PCRquantifications[i1, "Plate"] <- tmp$Plate[1] PCRquantifications[i1, "FABP4"] <- log2(targetMeans["FABP4"]) - log2(targetMeans["18S"]) PCRquantifications[i1, "ADH1B"] <- log2(targetMeans["ADH1B"]) - log2(targetMeans["18S"]) } PCRquantifications <- PCRquantifications[order(PCRquantifications$FABP4, decreasing = TRUE), ] ``` ```r head(PCRquantifications) ``` ``` ## Source Plate Sample.Name FABP4 ADH1B ## 25 Washington Plate.4 W20 -13.64 -16.71 ## 61 MDACC Plate.9 M33 -13.71 -20.97 ## 26 Washington Plate.4 W46 -13.99 -14.05 ## 95 MDACC Plate.13 M80 -14.81 -15.26 ## 139 MDACC Plate.29 M71 -15.18 -15.74 ## 72 MDACC Plate.10 M61 -16.16 -15.27 ``` ```r plot(PCRquantifications$FABP4, PCRquantifications$ADH1B, xlab = "FABP4", ylab = "ADH1B") points(PCRquantifications$FABP4[which(PCRquantifications$Source == "MDACC")], PCRquantifications$ADH1B[which(PCRquantifications$Source == "MDACC")], pch = "*", col = "red") legend("topleft", c("MDACC", "Washington"), pch = c(8, 1), col = c("red", "black"), bty = "n", cex = 0.8) abline(v = -20.05) abline(a = -39.5, b = -1, lty = 2) ``` ![plot of chunk plotPCR](figure/plotPCR.png) ## 5 Appendix ```r getwd() ``` ``` ## [1] "/Users/slt/SLT WORKSPACE/EXEMPT/OVARIAN/Ovarian residual disease study 2012/RD manuscript/Web page for paper/Webpage" ``` ```r sessionInfo() ``` ``` ## R version 3.0.2 (2013-09-25) ## Platform: x86_64-apple-darwin10.8.0 (64-bit) ## ## locale: ## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 ## ## attached base packages: ## [1] stats graphics grDevices utils datasets methods base ## ## other attached packages: ## [1] qpcR_1.3-7.1 robustbase_0.9-10 rgl_0.93.963 minpack.lm_1.1-8 ## [5] MASS_7.3-29 knitr_1.5 ## ## loaded via a namespace (and not attached): ## [1] evaluate_0.5.1 formatR_0.9 stringr_0.6.2 tools_3.0.2 ```