[Gtdb-commits] r56 - in pkg/gt.db: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jun 22 19:53:42 CEST 2010
Author: dahinds
Date: 2010-06-22 19:53:42 +0200 (Tue, 22 Jun 2010)
New Revision: 56
Modified:
pkg/gt.db/R/cluster.R
pkg/gt.db/R/gplot.R
pkg/gt.db/R/misc.R
pkg/gt.db/man/gt.cluster.plot.Rd
pkg/gt.db/man/init.gt.db.Rd
pkg/gt.db/man/load.hapmap.data.Rd
Log:
- added 'by' argument to gt.cluster.plot
- added reference line to manhattan.plot
- changed demos to use in-memory SQLite database
- update to load.hapmap.data help page
Modified: pkg/gt.db/R/cluster.R
===================================================================
--- pkg/gt.db/R/cluster.R 2010-06-01 21:18:50 UTC (rev 55)
+++ pkg/gt.db/R/cluster.R 2010-06-22 17:53:42 UTC (rev 56)
@@ -19,10 +19,19 @@
#
panel.cluster <-
-function(x, y, group.number=1, bounds=c(), min.points=4, ...)
+function(x, y, group.number=1, mark, pch, alpha,
+ subscripts, bounds=c(), min.points=4, ...)
{
require(cluster)
- panel.xyplot(x, y, ...)
+ if (any(mark)) {
+ m <- mark[subscripts]
+ panel.xyplot(x[!m], y[!m], subscripts=subscripts[!m],
+ pch=pch, alpha=alpha, ...)
+ panel.xyplot(x[m], y[m], subscripts=subscripts[m],
+ pch=8, alpha=1, ...)
+ } else
+ panel.xyplot(x, y, subscripts=subscripts,
+ pch=pch, alpha=alpha, ...)
if (!length(bounds))
return()
grp <- function(x,n) lapply(x, function(y) y[(n-1)%%length(y)+1])
@@ -41,20 +50,22 @@
.gt.settings <- list(
superpose.symbol=list(
- pch=c(1,1,1,3),
- col=c('#377db8','#e31a1c','#2daf4a','black')
+ pch=c(1,1,1,3,3),
+ col=c('#377db8','#e31a1c','#2daf4a','black','orange')
),
superpose.line=list(
- lty=c(1,1,1,0),
- col=c('#377db8','#e31a1c','#2daf4a','black')
+ lty=c(1,1,1,0,0),
+ col=c('#377db8','#e31a1c','#2daf4a','black','orange')
)
)
gt.cluster.plot <-
-function(data, rescale=TRUE, bounds=c(0.5,0.95), min.points=4,
- between=list(x=0.5,y=0.5), scales=list(alternating=0),
- xlab=NULL, ylab=NULL, par.settings=.gt.settings, ...)
+function(data, by=assay.name, rescale=TRUE, bounds=c(0.5,0.95),
+ mark=FALSE, min.points=4, between=list(x=0.5,y=0.5),
+ scales=list(alternating=0), xlab=NULL, ylab=NULL,
+ par.settings=.gt.settings, ...)
{
+ mark <- eval(substitute(mark), data, parent.frame())
if ('signal.a' %in% names(data)) {
x <- data$signal.a
y <- data$signal.b
@@ -89,7 +100,7 @@
}
}
- n <- factor(data$assay.name)
+ n <- factor(eval(substitute(by), data, parent.frame()))
if (rescale) {
if (equal) {
q <- tapply(c(x,y), rep(n,2), range, na.rm=TRUE)
@@ -117,7 +128,7 @@
gt[is.na(gt)] <- nn
}
p <- xyplot(y~x|n, groups=gt, bounds=bounds, min.points=min.points,
- scales=scales, prepanel=prepanel, aspect=1,
+ scales=scales, prepanel=prepanel, aspect=1, mark=mark,
panel=panel.superpose, panel.groups=panel.cluster,
xlab=xlab, ylab=ylab, between=between,
par.settings=par.settings, ...)
Modified: pkg/gt.db/R/gplot.R
===================================================================
--- pkg/gt.db/R/gplot.R 2010-06-01 21:18:50 UTC (rev 55)
+++ pkg/gt.db/R/gplot.R 2010-06-22 17:53:42 UTC (rev 56)
@@ -71,7 +71,9 @@
}
}
w <- match(paste('chr',xticks,sep=''), names(len))
+ xlim <- range(pos,na.rm=TRUE) + 50e6*c(-1,1)
+ panel.fn <- function(...) { xyplot(...) ; panel.refline(h=threshold) }
xyplot(val~pos, ..., cex=cex, groups=grp, par.settings=set,
scales=list(x=list(at=mid[w],tck=0,labels=xticks)),
- xlab=xlab, ylab=ylab)
+ panel=panel.fn, xlab=xlab, ylab=ylab, xlim=xlim)
}
Modified: pkg/gt.db/R/misc.R
===================================================================
--- pkg/gt.db/R/misc.R 2010-06-01 21:18:50 UTC (rev 55)
+++ pkg/gt.db/R/misc.R 2010-06-22 17:53:42 UTC (rev 56)
@@ -119,10 +119,9 @@
use.gt.db(db)
} else if (!interactive()) {
require(RSQLite)
- warning("creating temporary demo database...")
- fn <- tempfile()
- db <- dbConnect(dbDriver('SQLite'), fn, loadable.extensions=TRUE)
- unlink(fn)
+ warning("creating in-memory demo database...")
+ db <- dbConnect(dbDriver('SQLite'), ':memory:',
+ loadable.extensions=TRUE)
use.gt.db(db)
init.gt.db(db.mode='hex')
demo('setup.gt.demo')
Modified: pkg/gt.db/man/gt.cluster.plot.Rd
===================================================================
--- pkg/gt.db/man/gt.cluster.plot.Rd 2010-06-01 21:18:50 UTC (rev 55)
+++ pkg/gt.db/man/gt.cluster.plot.Rd 2010-06-22 17:53:42 UTC (rev 56)
@@ -25,15 +25,18 @@
predicted ellipsoid boundary regions.
}
\usage{
-gt.cluster.plot(data, rescale=TRUE, bounds=c(0.5,0.95), min.points=4,
- between=list(x=0.5,y=0.5), scales=list(alternating=0),
- xlab=NULL, ylab=NULL, par.settings=.gt.settings, ...)
+gt.cluster.plot(data, by=assay.name, rescale=TRUE, bounds=c(0.5,0.95),
+ min.points=4, between=list(x=0.5,y=0.5),
+ scales=list(alternating=0), xlab=NULL, ylab=NULL,
+ par.settings=.gt.settings, ...)
\method{xyplot}{gt.data}(x, ...)
}
\arguments{
\item{data}{an unpacked data frame of genotype information from
\code{reshape.gt.data}.}
\item{x}{a data frame of genotypes from \code{fetch.gt.data}.}
+ \item{by}{an expression used to define and label panels within the
+ plot, evaluated in \code{data}.}
\item{rescale}{logical: indicates if each data in each panel should
be scaled to fill the frame.}
\item{bounds}{contours at which to draw ellipsoid boundaries.}
Modified: pkg/gt.db/man/init.gt.db.Rd
===================================================================
--- pkg/gt.db/man/init.gt.db.Rd 2010-06-01 21:18:50 UTC (rev 55)
+++ pkg/gt.db/man/init.gt.db.Rd 2010-06-22 17:53:42 UTC (rev 56)
@@ -54,11 +54,8 @@
\code{\link{demo}(setup.gt.demo)}.
}
\examples{\dontrun{
-# create new SQLite database in a temporary file
-fn <- tempfile()
-dbx <- dbConnect(dbDriver('SQLite'), fn)
-# unlink it so it will go away at the end of the session
-unlink(fn)
+# create temporary in-memory SQLite database
+dbx <- dbConnect(dbDriver('SQLite'), ':memory:')
use.gt.db(dbx)
init.gt.db(db.mode='hex')
demo('setup.gt.demo')
Modified: pkg/gt.db/man/load.hapmap.data.Rd
===================================================================
--- pkg/gt.db/man/load.hapmap.data.Rd 2010-06-01 21:18:50 UTC (rev 55)
+++ pkg/gt.db/man/load.hapmap.data.Rd 2010-06-22 17:53:42 UTC (rev 56)
@@ -42,7 +42,7 @@
files are supported.
It has been tested against Phase II unphased r22 and r24, Phase II
- phased r22, and Phase III unphased r2.
+ phased r22, and Phase III unphased r2 and r3.
In principle, it should be possible to define a \dQuote{Phase II}
platform once, and have multiple HapMap datasets refer to that
More information about the Gtdb-commits
mailing list