[Seqinr-commits] r1561 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 9 19:46:28 CET 2009


Author: lobry
Date: 2009-03-09 19:46:28 +0100 (Mon, 09 Mar 2009)
New Revision: 1561

Modified:
   pkg/R/peakabif.R
   pkg/R/plotladder.R
Log:
peakabif now returns more info

Modified: pkg/R/peakabif.R
===================================================================
--- pkg/R/peakabif.R	2009-02-16 19:56:44 UTC (rev 1560)
+++ pkg/R/peakabif.R	2009-03-09 18:46:28 UTC (rev 1561)
@@ -14,7 +14,8 @@
   method = "monoH.FC", ...) {
   	
 	y[y < thres] <- 0
-	maxis <- starts <- stops <- numeric(npeak)
+	heights <- surfaces <- maxis <- starts <- stops <- numeric(npeak)
+	
 	innoise <- TRUE
 	pkidx <- 1
 	for (i in 1:length(y)) {
@@ -43,6 +44,8 @@
 		}
 		spfun <- splinefun(x, y[x], method = method)
 		maxis[i] <- optimize(spfun, interval = range(x), maximum = TRUE)$maximum
+		heights[i] <- spfun(maxis[i])
+		surfaces[i] <- integrate(spfun, starts[i], stops[i])$value
 		if (fig) {
 			plot(x/tscale + tmin, y[x], type = "p", las = 1, ylim = range(y), ...)
 			abline(h = thres, col = "red")
@@ -52,5 +55,5 @@
 	}
 	if(fig) mtext(paste(deparse(substitute(abifdata)), ",",
 	  DATA, ", tmin =", tmin, ", tmax =", tmax, ", thres =", thres, ", npeak =", npeak, ", yscale = ", yscale), side = 3, outer = TRUE)
-	invisible(maxis + tmin*tscale)
+	invisible(list(maxis = maxis + tmin*tscale, heights = yscale*heights, surfaces = yscale*surfaces))
 }

Modified: pkg/R/plotladder.R
===================================================================
--- pkg/R/plotladder.R	2009-02-16 19:56:44 UTC (rev 1560)
+++ pkg/R/plotladder.R	2009-03-09 18:46:28 UTC (rev 1561)
@@ -6,7 +6,7 @@
   tmp <- get(allele.names)[chanel]
   
   if(is.null(npeak)) npeak <- length(unlist(tmp))
-  x <- calibr(peakabif(abifdata, chanel, npeak = npeak, ...))
+  x <- calibr(peakabif(abifdata, chanel, npeak = npeak, ...)$maxis)
   n <- length(x)
   
   par(mfrow = c(1,1), mar = c(5,0,4,0)+0.1)



More information about the Seqinr-commits mailing list