[Gtdb-commits] r23 - in pkg/gt.db: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Oct 30 20:33:07 CET 2009


Author: dahinds
Date: 2009-10-30 20:33:06 +0100 (Fri, 30 Oct 2009)
New Revision: 23

Modified:
   pkg/gt.db/R/prcomp.R
   pkg/gt.db/man/gplot.prcomp.Rd
   pkg/gt.db/man/prcomp.gt.data.Rd
   pkg/gt.db/man/snp.loadings.Rd
Log:
Fixed argument bug in gplot.prcomp, improved examples for snp.loadings
and prcomp.gt.data


Modified: pkg/gt.db/R/prcomp.R
===================================================================
--- pkg/gt.db/R/prcomp.R	2009-10-29 20:39:46 UTC (rev 22)
+++ pkg/gt.db/R/prcomp.R	2009-10-30 19:33:06 UTC (rev 23)
@@ -304,7 +304,7 @@
 #---------------------------------------------------------------------
 
 gplot.prcomp <-
-function(x, col=1:5, fn=function(x) sum(x^2), rescale=TRUE,
+function(x, col=1:5, aggr.fn=function(x) sum(x^2), rescale=TRUE,
          xlab=NULL, ylab=NULL, ...)
 {
     d <- x$loadings[col]
@@ -312,8 +312,9 @@
     nc <- ncol(d)
     for (n in 1:nc) {
         gr=list(inside=list(x=0.93,y=0.1,corner=c(1,1)/2,fun=textGrob(cl[n])))
-        print(gplot(~d[cl[n]], x$assays, fn=fn, rescale=rescale, legend=gr,
-                    colorkey=FALSE, xlab=xlab, ylab=ylab, draw.at=FALSE, ...),
+        print(gplot(~d[cl[n]], x$assays, aggr.fn=aggr.fn,
+                    rescale=rescale, legend=gr, colorkey=FALSE,
+                    xlab=xlab, ylab=ylab, draw.at=FALSE, ...),
               newpage=(n==1), split=c(1,n,1,nc))
     }
 }

Modified: pkg/gt.db/man/gplot.prcomp.Rd
===================================================================
--- pkg/gt.db/man/gplot.prcomp.Rd	2009-10-29 20:39:46 UTC (rev 22)
+++ pkg/gt.db/man/gplot.prcomp.Rd	2009-10-30 19:33:06 UTC (rev 23)
@@ -24,13 +24,13 @@
   components analysis.
 }
 \usage{
-gplot.prcomp(x, col=1:5, fn=function(x) sum(x^2),
+gplot.prcomp(x, col=1:5, aggr.fn=function(x) sum(x^2),
              rescale=TRUE, xlab=NULL, ylab=NULL, ...)
 }
 \arguments{
   \item{x}{a data structure returned by \code{\link{snp.loadings}}.}
   \item{col}{a vector of component numbers to plot.}
-  \item{fn}{an aggregating function to apply to data within each bin.}
+  \item{aggr.fn}{an aggregating function to apply to data within each bin.}
   \item{rescale}{logical: indicates if results should be scaled based
     on the genome-wide average bin value.}
   \item{xlab, ylab}{axis labels passed to \code{\link{gplot}}.}

Modified: pkg/gt.db/man/prcomp.gt.data.Rd
===================================================================
--- pkg/gt.db/man/prcomp.gt.data.Rd	2009-10-29 20:39:46 UTC (rev 22)
+++ pkg/gt.db/man/prcomp.gt.data.Rd	2009-10-30 19:33:06 UTC (rev 23)
@@ -67,9 +67,10 @@
 }
 \examples{
 gt.demo.check()
-g <- fetch.gt.data('Demo_1')
-p <- prcomp(subset(g, (ploidy=='A')))
-screeplot(p)
-with(p$loadings, plot(PC1, PC2))
+gt <- fetch.gt.data('Demo_1')
+pt <- fetch.pt.data('Demo_1')
+pc <- prcomp(subset(gt, (ploidy=='A')))
+screeplot(pc)
+xyplot(PC1~PC2, pc$loadings, groups=pt$plate, auto.key=TRUE)
 }
 \keyword{multivariate}

Modified: pkg/gt.db/man/snp.loadings.Rd
===================================================================
--- pkg/gt.db/man/snp.loadings.Rd	2009-10-29 20:39:46 UTC (rev 22)
+++ pkg/gt.db/man/snp.loadings.Rd	2009-10-30 19:33:06 UTC (rev 23)
@@ -64,6 +64,7 @@
 gt.demo.check()
 p <- prcomp(gt.dataset('Demo_1', gt.filter=(ploidy=='A')))
 s <- snp.loadings(p, gt.dataset('Demo_1'))
-head(s)
+p$loadings[1:5,1:5]
+s$loadings[1:5,1:5]
 }
 \keyword{multivariate}



More information about the Gtdb-commits mailing list