[med-svn] [r-bioc-biocgenerics] 01/03: Imported Upstream version 0.16.0
Andreas Tille
tille at debian.org
Thu Oct 29 16:02:41 UTC 2015
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository r-bioc-biocgenerics.
commit 247f3d32e843f204b0bd9dd6143fa14d77dadb19
Author: Andreas Tille <tille at debian.org>
Date: Thu Oct 29 16:29:27 2015 +0100
Imported Upstream version 0.16.0
---
DESCRIPTION | 25 ++++-----
NAMESPACE | 20 +++++++-
R/IQR.R | 6 +++
R/dbconn.R | 8 +++
R/grep.R | 11 ++++
R/is.unsorted.R | 5 +-
R/lengths.R | 10 ++++
R/mad.R | 8 +++
R/rep.R | 37 +-------------
R/{update-utils.R => replaceSlots.R} | 17 +++++--
R/show-utils.R | 99 ------------------------------------
R/subset.R | 8 +++
R/testPackage.R | 69 +++++++++++++++++++++----
TODO | 4 --
man/BiocGenerics-package.Rd | 7 +++
man/IQR.Rd | 58 +++++++++++++++++++++
man/cbind.Rd | 2 +-
man/dbconn.Rd | 60 ++++++++++++++++++++++
man/grep.Rd | 70 +++++++++++++++++++++++++
man/is.unsorted.Rd | 2 +-
man/lengths.Rd | 99 ++++++++++++++++++++++++++++++++++++
man/mad.Rd | 60 ++++++++++++++++++++++
man/order.Rd | 2 +-
man/organism_species.Rd | 2 +-
man/rank.Rd | 2 +-
man/rep.Rd | 10 ++--
man/sort.Rd | 2 +-
man/subset.Rd | 69 +++++++++++++++++++++++++
man/testPackage.Rd | 79 ++++++++++++++++++++++++++++
man/unsplit.Rd | 2 +-
30 files changed, 669 insertions(+), 184 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index 07c1d61..8168ee6 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
Package: BiocGenerics
Title: S4 generic functions for Bioconductor
Description: S4 generic functions needed by many Bioconductor packages.
-Version: 0.14.0
+Version: 0.16.0
Author: The Bioconductor Dev Team
Maintainer: Bioconductor Package Maintainer <maintainer at bioconductor.org>
biocViews: Infrastructure
@@ -11,15 +11,16 @@ Suggests: Biobase, S4Vectors, IRanges, GenomicRanges, AnnotationDbi,
oligoClasses, oligo, affyPLM, flowClust, affy, DESeq2, MSnbase,
annotate, RUnit
License: Artistic-2.0
-Collate: S3-classes-as-S4-classes.R normarg-utils.R update-utils.R
- show-utils.R append.R as.data.frame.R as.list.R as.vector.R
- cbind.R do.call.R duplicated.R eval.R Extremes.R funprog.R
- get.R is.unsorted.R lapply.R mapply.R match.R nrow.R order.R
- paste.R rank.R rep.R row_colnames.R sets.R sort.R start.R
- table.R tapply.R unique.R unlist.R unsplit.R relist.R boxplot.R
- image.R density.R residuals.R weights.R xtabs.R clusterApply.R
- annotation.R combine.R dge.R fileName.R normalize.R
- organism_species.R plotMA.R plotPCA.R score.R strand.R
- updateObject.R testPackage.R test_BiocGenerics_package.R zzz.R
+Collate: S3-classes-as-S4-classes.R normarg-utils.R replaceSlots.R
+ append.R as.data.frame.R as.list.R as.vector.R cbind.R
+ do.call.R duplicated.R eval.R Extremes.R funprog.R get.R grep.R
+ IQR.R is.unsorted.R lapply.R lengths.R mad.R mapply.R match.R
+ nrow.R order.R paste.R rank.R rep.R row_colnames.R sets.R
+ sort.R start.R subset.R table.R tapply.R unique.R unlist.R
+ unsplit.R relist.R boxplot.R image.R density.R residuals.R
+ weights.R xtabs.R clusterApply.R annotation.R combine.R
+ dbconn.R dge.R fileName.R normalize.R organism_species.R
+ plotMA.R plotPCA.R score.R strand.R updateObject.R
+ testPackage.R test_BiocGenerics_package.R zzz.R
NeedsCompilation: no
-Packaged: 2015-04-17 03:42:27 UTC; biocbuild
+Packaged: 2015-10-14 02:13:19 UTC; biocbuild
diff --git a/NAMESPACE b/NAMESPACE
index f52baab..4584ade 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -57,12 +57,18 @@ export(
## from R/get.R:
get, mget,
+ ## from R/grepl.R:
+ grep, grepl,
+
## from R/is.unsorted.R:
is.unsorted,
-
+
## from R/lapply.R:
lapply, sapply,
+ ## from R/lengths.R:
+ lengths,
+
## from R/mapply.R:
mapply,
@@ -98,6 +104,9 @@ export(
end, "end<-",
width, "width<-",
+ ## from R/subset.R:
+ subset,
+
## from R/table.R:
table,
@@ -134,6 +143,12 @@ export(
## from R/density.R:
density,
+ ## from R/IQR.R:
+ IQR,
+
+ ## from R/mad.R:
+ mad,
+
## from R/residuals.R:
residuals,
@@ -166,6 +181,9 @@ export(
## from R/combine.R:
combine,
+ ## from R/dbconn.R:
+ dbconn, dbfile,
+
## from R/fileName.R:
fileName,
diff --git a/R/IQR.R b/R/IQR.R
new file mode 100644
index 0000000..38e3200
--- /dev/null
+++ b/R/IQR.R
@@ -0,0 +1,6 @@
+### =========================================================================
+### The IQR() generic
+### -------------------------------------------------------------------------
+###
+
+setGeneric("IQR", signature="x")
diff --git a/R/dbconn.R b/R/dbconn.R
new file mode 100644
index 0000000..9c40f86
--- /dev/null
+++ b/R/dbconn.R
@@ -0,0 +1,8 @@
+### =========================================================================
+### The dbconn() and dbfile() generics
+### -------------------------------------------------------------------------
+###
+
+setGeneric("dbconn", function(x) standardGeneric("dbconn"))
+
+setGeneric("dbfile", function(x) standardGeneric("dbfile"))
diff --git a/R/grep.R b/R/grep.R
new file mode 100644
index 0000000..deeee02
--- /dev/null
+++ b/R/grep.R
@@ -0,0 +1,11 @@
+### =========================================================================
+### The grep() and grepl() generics
+### -------------------------------------------------------------------------
+###
+### Need to explicitly define those generics otherwise the implicit generics
+### in package "base" would dispatch on all their arguments. Here we set
+### dispatch on the first 2 args ('pattern', 'x').
+
+setGeneric("grep", signature = c("pattern", "x"))
+
+setGeneric("grepl", signature = c("pattern", "x"))
diff --git a/R/is.unsorted.R b/R/is.unsorted.R
index abb6dce..9f9abe9 100644
--- a/R/is.unsorted.R
+++ b/R/is.unsorted.R
@@ -2,7 +2,4 @@
### The is.unsorted() generic
### -------------------------------------------------------------------------
-setGeneric("is.unsorted",
- function(x, na.rm = FALSE, strictly = FALSE)
- standardGeneric("is.unsorted"),
- signature = "x")
+setGeneric("is.unsorted", signature = "x")
diff --git a/R/lengths.R b/R/lengths.R
new file mode 100644
index 0000000..ea74ef2
--- /dev/null
+++ b/R/lengths.R
@@ -0,0 +1,10 @@
+### =========================================================================
+### The lengths() generic
+### -------------------------------------------------------------------------
+###
+### Need to explicitly define this generic otherwise the implicit generic in
+### package "base" would dispatch on all its arguments. Here we set dispatch
+### on the first arg ('x') only.
+
+setGeneric("lengths", signature="x")
+
diff --git a/R/mad.R b/R/mad.R
new file mode 100644
index 0000000..e43eef6
--- /dev/null
+++ b/R/mad.R
@@ -0,0 +1,8 @@
+### =========================================================================
+### The mad() generic
+### -------------------------------------------------------------------------
+###
+### Dispatches only on 'x'
+###
+
+setGeneric("mad", signature="x")
diff --git a/R/rep.R b/R/rep.R
index fd71dec..9e42383 100644
--- a/R/rep.R
+++ b/R/rep.R
@@ -1,39 +1,6 @@
### =========================================================================
-### The rep() and rep.int() generics
+### The rep.int() generic
### -------------------------------------------------------------------------
-### Actually, rep() seems to be already a generic function (that's what the
-### man page claims) but the reality is confusing. On a fresh R session (this
-### is with R-2.14.0):
-###
-### > isGeneric("rep")
-### [1] FALSE
-### > showMethods("rep")
-### Function: rep (package base)
-###
-### > isGeneric("rep")
-### [1] TRUE
-###
-#setGeneric("rep")
-
-### A more natural (and cleaner) thing to do for this generic would be to
-### use the same arguments as base::rep.int() (i.e. 'x', 'times') but then
-### 'R CMD check' would get confused and think that we are trying to define
-### an S3 method for base::rep and would complain (observed with R <= 2.12):
-###
-### * checking S3 generic/method consistency ... WARNING
-### rep:
-### function(x, ...)
-### rep.int:
-### function(x, times)
-###
-### so we use the arguments of base::rep() (i.e. 'x', '...') just to make
-### 'R CMD check' happy :-) ... Kind of an ugly/silly hack though :-(
-
-.rep.int.useAsDefault <- function(x, ...) base::rep.int(x, ...)
-
-setGeneric("rep.int",
- function(x, ...) standardGeneric("rep.int"),
- useAsDefault=.rep.int.useAsDefault
-)
+setGeneric("rep.int")
diff --git a/R/update-utils.R b/R/replaceSlots.R
similarity index 77%
rename from R/update-utils.R
rename to R/replaceSlots.R
index 40fda6b..cd5b60e 100644
--- a/R/update-utils.R
+++ b/R/replaceSlots.R
@@ -1,5 +1,5 @@
### =========================================================================
-### Efficient update behavior for S4 objects
+### Efficient multiple slots replacement of an S4 object
### -------------------------------------------------------------------------
###
### NOTE: The stuff in this file (not exported) doesn't really belong to
@@ -8,7 +8,7 @@
### TODO: This stuff would need to be moved to a more appropriate place (when
### we have one).
-unsafe_updateS4 <- function(object, ..., .slotList = list()) {
+unsafe_replaceSlots <- function(object, ..., .slotList = list()) {
valid_argnames <- slotNames(object)
args <- extraArgsAsList(valid_argnames, ...)
firstTime <- TRUE
@@ -34,14 +34,21 @@ unsafe_updateS4 <- function(object, ..., .slotList = list()) {
listUpdate(listUpdate(object, args), .slotList)
}
-### 'updateS4' is essentially a more efficient initialize for (value) S4
+### 'replaceSlots' is essentially a more efficient initialize for (value) S4
### objects.
-updateS4 <- function(object, ..., check = TRUE) {
+replaceSlots <- function(object, ..., check = TRUE) {
if (!isTRUEorFALSE(check))
stop("'check' must be TRUE or FALSE")
- object <- unsafe_updateS4(object, ...)
+ object <- unsafe_replaceSlots(object, ...)
if (check) {
validObject(object)
}
object
}
+
+updateS4 <- function(...)
+{
+ .Deprecated("replaceSlots")
+ replaceSlots(...)
+}
+
diff --git a/R/show-utils.R b/R/show-utils.R
deleted file mode 100644
index 37e8407..0000000
--- a/R/show-utils.R
+++ /dev/null
@@ -1,99 +0,0 @@
-### =========================================================================
-### Utilities for showing object components in a systematic way
-### -------------------------------------------------------------------------
-###
-
-labeledLine <-
- function(label, els, count = TRUE, labelSep = ":", sep = " ", ellipsis = "...",
- ellipsisPos = c("middle", "end", "start"))
-{
- if (count && !is.null(els))
- label <- paste(label, "(", length(els), ")", sep = "")
- label <- paste(label, labelSep, sep, sep = "")
- width <- getOption("width") - nchar(label)
- line <- ellipsize(els, width, sep, ellipsis, ellipsisPos)
- paste(label, line, "\n", sep = "")
-}
-
-ellipsize <-
- function(obj, width = getOption("width"), sep = " ", ellipsis = "...",
- pos = c("middle", "end", "start"))
-{
- pos <- match.arg(pos)
- if (is.null(obj))
- obj <- "NULL"
- if (is.factor(obj))
- obj <- as.character(obj)
- ## get order selectSome() would print
- if (pos == "middle") {
- if (length(obj) > 2 * width)
- obj <- c(head(obj, width), tail(obj, width))
- half <- seq_len(ceiling(length(obj) / 2L))
- ind <- as.vector(rbind(half, length(obj) - half + 1L))
- } else if (pos == "end") {
- obj <- head(obj, width)
- ind <- seq_len(length(obj))
- } else {
- obj <- tail(obj, width)
- ind <- rev(seq_len(length(obj)))
- }
- str <- encodeString(obj)
- nc <- cumsum(nchar(str[ind]) + nchar(sep)) - nchar(sep)
- last <- findInterval(width, nc)
- if (length(obj) > last) {
- ## make sure ellipsis fits
- while (last &&
- (nc[last] + nchar(sep)*2^(last>1) + nchar(ellipsis)) > width)
- last <- last - 1L
- if (last == 0) { ## have to truncate the first/last element
- if (pos == "start") {
- str <-
- paste(ellipsis,
- substring(tail(str, 1L),
- nchar(tail(str, 1L))-(width-nchar(ellipsis))+1L,
- nchar(ellipsis)),
- sep = "")
- } else {
- str <-
- paste(substring(str[1L], 1, width - nchar(ellipsis)), ellipsis,
- sep = "")
- }
- }
- else if (last == 1) { ## can only show the first/last
- if (pos == "start")
- str <- c(ellipsis, tail(str, 1L))
- else str <- c(str[1L], ellipsis)
- }
- else {
- str <- selectSome(str, last + 1L, ellipsis, pos)
- }
- }
- paste(str, collapse = sep)
-}
-
-## taken directly from Biobase, then added 'ellipsisPos' argument
-selectSome <- function(obj, maxToShow = 5, ellipsis = "...",
- ellipsisPos = c("middle", "end", "start"), quote=FALSE)
-{
- if(is.character(obj) && quote)
- obj <- sQuote(obj)
- ellipsisPos <- match.arg(ellipsisPos)
- len <- length(obj)
- if (maxToShow < 3)
- maxToShow <- 3
- if (len > maxToShow) {
- maxToShow <- maxToShow - 1
- if (ellipsisPos == "end") {
- c(head(obj, maxToShow), ellipsis)
- } else if (ellipsisPos == "start") {
- c(ellipsis, tail(obj, maxToShow))
- } else {
- bot <- ceiling(maxToShow/2)
- top <- len - (maxToShow - bot - 1)
- nms <- obj[c(1:bot, top:len)]
- c(as.character(nms[1:bot]), ellipsis, as.character(nms[-c(1:bot)]))
- }
- } else {
- obj
- }
-}
diff --git a/R/subset.R b/R/subset.R
new file mode 100644
index 0000000..065fedb
--- /dev/null
+++ b/R/subset.R
@@ -0,0 +1,8 @@
+### =========================================================================
+### The subset() generic
+### -------------------------------------------------------------------------
+###
+### base::subset is an S3 generic.
+
+setGeneric("subset")
+
diff --git a/R/testPackage.R b/R/testPackage.R
index 460870d..05fc7d1 100644
--- a/R/testPackage.R
+++ b/R/testPackage.R
@@ -1,6 +1,33 @@
-###
+###
-testPackage <- function(pkgname, subdir="unitTests", pattern="^test_.*\\.R$")
+packageRoot <- function(path)
+{
+ hasDescription <- function(path) {
+ file.exists(file.path(path, "DESCRIPTION"))
+ }
+ isRoot <- function(path) {
+ identical(path, dirname(path))
+ }
+ while (!hasDescription(path) && !isRoot(path)) {
+ path <- dirname(path)
+ }
+ if (isRoot(path)) {
+ NULL
+ } else {
+ path
+ }
+}
+
+packageInfo <- function(path)
+{
+ as.data.frame(read.dcf(file.path(path, "DESCRIPTION")),
+ stringsAsFactors=FALSE)
+}
+
+testPackage <- function(pkgname = NULL,
+ subdir="unitTests",
+ pattern="^test_.*\\.R$",
+ path = getwd())
{
.failure_details <- function(result) {
res <- result[[1L]]
@@ -14,17 +41,38 @@ testPackage <- function(pkgname, subdir="unitTests", pattern="^test_.*\\.R$")
} else list()
}
- require(pkgname, quietly=TRUE, character.only=TRUE) ||
- stop("package '", pkgname, "' not found")
- dir <- system.file(subdir, package=pkgname)
- if (nchar(dir) == 0L)
- stop("unable to find unit tests, no '", subdir, "' dir")
- require("RUnit", quietly=TRUE) || stop("RUnit package not found")
+ if (is.null(pkgname)) {
+ root <- packageRoot(path)
+ if (is.null(root))
+ stop("could not infer package root directory")
+
+ pkgname0 <- packageInfo(root)$Package
+ if (is.null(pkgname)) {
+ pkgname <- pkgname0
+ } else if (!identical(pkgname, pkgname0)) {
+ stop("'pkgname' and inferred DESCRIPTION 'Package' differ")
+ }
+ } else {
+ root <- system.file(package=pkgname)
+ }
+
+ library(pkgname, character.only = TRUE, quietly=TRUE)
+
+ dir <- file.path(root, subdir)
+ if (!file.exists(dir)) { # try inst/subdir
+ dir <- file.path(root, "inst", subdir)
+ }
+ if (!file.exists(dir)) {
+ stop("unable to find unit tests, no subdir ", sQuote(subdir))
+ }
+
+ library("RUnit", quietly=TRUE)
RUnit_opts <- getOption("RUnit", list())
RUnit_opts$verbose <- 0L
RUnit_opts$silent <- TRUE
RUnit_opts$verbose_fail_msg <- TRUE
- options(RUnit = RUnit_opts)
+ oopt <- options(RUnit = RUnit_opts)
+ on.exit(options(oopt))
suite <- RUnit::defineTestSuite(name=paste(pkgname, "RUnit Tests"),
dirs=dir,
testFileRegexp=pattern,
@@ -33,7 +81,7 @@ testPackage <- function(pkgname, subdir="unitTests", pattern="^test_.*\\.R$")
result <- RUnit::runTestSuite(suite)
cat("\n\n")
RUnit::printTextProtocol(result, showDetails=FALSE)
- if (length(details <- .failure_details(result)) >0) {
+ if (length(details <- .failure_details(result)) > 0) {
cat("\nTest files with failing tests\n")
for (i in seq_along(details)) {
cat("\n ", basename(names(details)[[i]]), "\n")
@@ -46,4 +94,3 @@ testPackage <- function(pkgname, subdir="unitTests", pattern="^test_.*\\.R$")
}
result
}
-
diff --git a/TODO b/TODO
index 3c03858..95164ba 100644
--- a/TODO
+++ b/TODO
@@ -3,8 +3,6 @@ o Functions defined in base R that would need to be explicitly promoted
made generics by the IRanges package):
From package base:
- - is.unsorted(): implicit generic dispatches on (x, na.rm, strictly).
- Explicit generic should dispatch on (x) only.
- split(): implicit generic dispatches on (x, f, drop).
Explicit generic should dispatch on (x, f) only.
- which(): implicit generic dispatches on (x, arr.ind, useNames).
@@ -45,6 +43,4 @@ o Functions defined in base R that would need to be explicitly promoted
- runmed(): implicit generic dispatches on (x, k, endrule, algorithm,
print.level). Explicit generic should dispatch on (x) only.
-o Move all the generics for count datasets defined in Biobase (and used by the
- DESeq and DEXSeq packages) to BiocGenerics.
diff --git a/man/BiocGenerics-package.Rd b/man/BiocGenerics-package.Rd
index aacf8f6..b0e6d7a 100644
--- a/man/BiocGenerics-package.Rd
+++ b/man/BiocGenerics-package.Rd
@@ -58,6 +58,8 @@
\item \code{BiocGenerics::\link[BiocGenerics]{lapply}},
\code{BiocGenerics::\link[BiocGenerics]{sapply}}
+ \item \code{BiocGenerics::\link[BiocGenerics]{lengths}}
+
\item \code{BiocGenerics::\link[BiocGenerics]{mapply}}
\item \code{BiocGenerics::\link[BiocGenerics]{match}}
@@ -94,6 +96,8 @@
\code{BiocGenerics::\link[BiocGenerics]{width}},
\code{BiocGenerics::\link[BiocGenerics]{width<-}}
+ \item \code{BiocGenerics::\link[BiocGenerics]{subset}}
+
\item \code{BiocGenerics::\link[BiocGenerics]{table}}
\item \code{BiocGenerics::\link[BiocGenerics]{tapply}}
@@ -152,6 +156,9 @@
\item \code{\link[BiocGenerics]{combine}}
+ \item \code{\link[BiocGenerics]{dbconn}},
+ \code{\link[BiocGenerics]{dbfile}}
+
\item \code{\link[BiocGenerics]{fileName}}
\item \code{\link[BiocGenerics]{normalize}}
diff --git a/man/IQR.Rd b/man/IQR.Rd
new file mode 100644
index 0000000..cc4180b
--- /dev/null
+++ b/man/IQR.Rd
@@ -0,0 +1,58 @@
+\name{IQR}
+
+\alias{IQR}
+
+\title{The Interquartile Range}
+
+\description{
+ Compute the interquartile range for a vector.
+
+ NOTE: This man page is for the \code{IQR} \emph{S4 generic function}
+ defined in the \pkg{BiocGenerics} package.
+ See \code{?stats::\link[stats]{IQR}} for the default method
+ (defined in the \pkg{stats} package).
+ Bioconductor packages can define specific methods for objects
+ not supported by the default method.
+}
+
+\usage{
+IQR(x, na.rm = FALSE, type = 7)
+}
+
+\arguments{
+ \item{x, na.rm, type}{
+ See \code{?stats::\link[stats]{IQR}}.
+ }
+}
+
+\value{
+ See \code{?stats::\link[stats]{IQR}} for the value returned by the
+ default method.
+
+ Specific methods defined in Bioconductor packages should
+ behave as consistently as possible with the default method.
+}
+
+\seealso{
+ \itemize{
+ \item \code{stats::\link[stats]{IQR}} for the default
+ \code{IQR} method.
+
+ \item \code{\link[methods]{showMethods}} for displaying a summary of the
+ methods defined for a given generic function.
+
+ \item \code{\link[methods]{selectMethod}} for getting the definition of
+ a specific method.
+
+ \item \link{BiocGenerics} for a summary of all the generics defined
+ in the \pkg{BiocGenerics} package.
+ }
+}
+
+\examples{
+IQR
+showMethods("IQR")
+selectMethod("IQR", "ANY") # the default method
+}
+
+\keyword{methods}
diff --git a/man/cbind.Rd b/man/cbind.Rd
index 6399258..b062f84 100644
--- a/man/cbind.Rd
+++ b/man/cbind.Rd
@@ -53,7 +53,7 @@ rbind(..., deparse.level=1)
\item \code{\link[methods]{selectMethod}} for getting the definition of
a specific method.
- \item \link[IRanges]{cbind,DataFrame-method} in the \pkg{IRanges}
+ \item \link[S4Vectors]{cbind,DataFrame-method} in the \pkg{S4Vectors}
package for an example of a specific \code{cbind} method (defined
for \link[S4Vectors]{DataFrame} objects).
diff --git a/man/dbconn.Rd b/man/dbconn.Rd
new file mode 100644
index 0000000..bc995ef
--- /dev/null
+++ b/man/dbconn.Rd
@@ -0,0 +1,60 @@
+\name{dbconn}
+
+\alias{dbconn}
+\alias{dbfile}
+
+\title{Accessing SQLite DB information}
+
+\description{
+ Get a connection object or file path for a SQLite DB
+}
+
+\usage{
+dbconn(x)
+dbfile(x)
+}
+
+\arguments{
+ \item{x}{
+ An object with a SQLite connection.
+ }
+}
+
+\value{
+ \code{dbconn} returns a connection object to the SQLite DB containing
+ \code{x}'s data.
+
+ \code{dbfile} returns a path (character string) to the SQLite DB (file)
+ containing \code{x}'s data.
+}
+
+\seealso{
+ \itemize{
+ \item \code{\link[methods]{showMethods}} for displaying a summary of the
+ methods defined for a given generic function.
+
+ \item \code{\link[methods]{selectMethod}} for getting the definition of
+ a specific method.
+
+ \item \link[AnnotationDbi]{dbconn,AnnotationDb-method} in the
+ \pkg{AnnotationDbi} package for an example of a specific
+ \code{dbconn} method (defined for \link[AnnotationDbi]{dbconn}
+ objects).
+
+ \item \link{BiocGenerics} for a summary of all the generics defined
+ in the \pkg{BiocGenerics} package.
+ }
+}
+
+\examples{
+dbconn
+showMethods("dbconn")
+dbfile
+showMethods("dbfile")
+
+library(AnnotationDbi)
+showMethods("dbconn")
+selectMethod("dbconn", "AnnotationDb")
+}
+
+\keyword{methods}
diff --git a/man/grep.Rd b/man/grep.Rd
new file mode 100644
index 0000000..6bb25e9
--- /dev/null
+++ b/man/grep.Rd
@@ -0,0 +1,70 @@
+\name{grep}
+
+\alias{grep}
+\alias{grepl}
+
+\title{Pattern Matching and Replacement}
+
+\description{
+ Search for matches to argument 'pattern' within each element of a character
+ vector.
+
+ NOTE: This man page is for the \code{grep} and \code{grepl}
+ \emph{S4 generic functions} defined in the \pkg{BiocGenerics} package.
+ See \code{?base::\link[base]{grep}} for the default methods
+ (defined in the \pkg{base} package).
+ Bioconductor packages can define specific methods for objects
+ not supported by the default method.
+}
+
+\usage{
+grep(pattern, x, ignore.case = FALSE, perl = FALSE, value = FALSE,
+ fixed = FALSE, useBytes = FALSE, invert = FALSE)
+grepl(pattern, x, ignore.case = FALSE, perl = FALSE,
+ fixed = FALSE, useBytes = FALSE)
+}
+
+\arguments{
+ \item{pattern}{
+ The pattern for searching in \code{x}, such as a regular expression.
+ }
+ \item{x}{
+ The character vector (in the general sense) to search.
+ }
+ \item{ignore.case, perl, value, fixed, useBytes, invert}{
+ See \code{?base::\link[base]{grep}} for a description of
+ these arguments.
+ }
+}
+
+\value{
+ See \code{?base::\link[base]{grep}} for the value returned
+ by the default method.
+
+ Specific methods defined in Bioconductor packages should
+ behave as consistently as possible with the default method.
+}
+
+\seealso{
+ \itemize{
+ \item \code{base::\link[base]{grep}} for the default
+ \code{grep} and \code{grepl} methods.
+
+ \item \code{\link[methods]{showMethods}} for displaying a summary of the
+ methods defined for a given generic function.
+
+ \item \code{\link[methods]{selectMethod}} for getting the definition of
+ a specific method.
+
+ \item \link{BiocGenerics} for a summary of all the generics defined
+ in the \pkg{BiocGenerics} package.
+ }
+}
+
+\examples{
+grep # note the dispatch on 'pattern' and 'x' args only
+showMethods("grep")
+selectMethod("grep", "ANY") # the default method
+}
+
+\keyword{methods}
diff --git a/man/is.unsorted.Rd b/man/is.unsorted.Rd
index 71364c9..332a86d 100644
--- a/man/is.unsorted.Rd
+++ b/man/is.unsorted.Rd
@@ -38,7 +38,7 @@ is.unsorted(x, na.rm=FALSE, strictly=FALSE)
}
\note{
- TO DEVELOPPERS:
+ TO DEVELOPERS:
The \code{is.unsorted} method for specific vector-like objects should
adhere to the same underlying order used by the
diff --git a/man/lengths.Rd b/man/lengths.Rd
new file mode 100644
index 0000000..06c0a0b
--- /dev/null
+++ b/man/lengths.Rd
@@ -0,0 +1,99 @@
+\name{lengths}
+
+\alias{lengths}
+
+\title{Lengths of the list elements of a list-like object}
+
+\description{
+ Get the length of each list element of a list-like object.
+
+ NOTE: This man page is for the \code{lengths} \emph{S4 generic
+ function} defined in the \pkg{BiocGenerics} package.
+ See \code{?base::\link[base]{lengths}} for the default method
+ (defined in the \pkg{base} package).
+ Bioconductor packages can define specific methods for list-like
+ objects not supported by the default method.
+}
+
+\usage{
+lengths(x, use.names=TRUE)
+}
+
+\arguments{
+ \item{x}{
+ A list-like object. Can also be a vector-like object that is not
+ list-like, in which case the result is trivial.
+ }
+ \item{use.names}{
+ See \code{?base::\link[base]{lengths}} for a description of
+ this argument.
+ }
+}
+
+\value{
+ See \code{?base::\link[base]{lengths}} for the value returned by the
+ default method.
+
+ Specific methods defined in Bioconductor packages should
+ behave as consistently as possible with the default method.
+}
+
+\note{
+ IMPORTANT: The default method (\code{base::\link[base]{lengths}})
+ is equivalent to \code{sapply(x, length)}. However, because the
+ \code{lengths} method for \link[S4Vectors]{Vector} objects is currently
+ defined as an alias for \code{S4Vectors::\link[S4Vectors]{elementLengths}},
+ it's equivalent to \code{sapply(x, NROW)}, not to \code{sapply(x, length)}.
+
+ This makes a difference if \code{x} has array-like list elements.
+ See \code{?base::\link[base]{NROW}} for the difference between
+ \code{length()} and \code{NROW()}.
+ This difference is illustrated in the Examples section below.
+
+ This is a temporary situation that will be addressed in BioC 3.3.
+}
+
+\seealso{
+ \itemize{
+ \item \code{base::\link[base]{lengths}} for the default \code{lengths}
+ method.
+
+ \item \code{\link[methods]{showMethods}} for displaying a summary of the
+ methods defined for a given generic function.
+
+ \item \code{\link[methods]{selectMethod}} for getting the definition of
+ a specific method.
+
+ \item \link[S4Vectors]{lengths,Vector-method} in the \pkg{S4Vectors}
+ package for an example of a specific \code{lengths} method (defined
+ for \link[S4Vectors]{Vector} objects).
+
+ \item \link{BiocGenerics} for a summary of all the generics defined
+ in the \pkg{BiocGenerics} package.
+ }
+}
+
+\examples{
+lengths # note the dispatch on the 'x' arg only
+showMethods("lengths")
+selectMethod("lengths", "ANY") # the default method
+
+library(S4Vectors)
+showMethods("lengths")
+selectMethod("lengths", "Vector") # the "lengths" method for Vector
+ # objects
+
+## Difference between default method and method for Vector objects:
+groups <- c("group1", "group2")
+df <- data.frame(
+ a=letters[1:10],
+ i=101:110,
+ group=rep(factor(groups, levels=groups), c(6, 4))
+)
+x1 <- split(df, df$group)
+x2 <- split(DataFrame(df), df$group)
+lengths(x1) # dispatch on default method
+lengths(x2) # dispatch on method for Vector objects
+}
+
+\keyword{methods}
diff --git a/man/mad.Rd b/man/mad.Rd
new file mode 100644
index 0000000..c02f207
--- /dev/null
+++ b/man/mad.Rd
@@ -0,0 +1,60 @@
+\name{mad}
+
+\alias{mad}
+
+\title{Median Absolute Deviation}
+
+\description{
+ Compute the median absolute deviation for a vector, dispatching only
+ on the first argument, \code{x}.
+
+ NOTE: This man page is for the \code{mad} \emph{S4 generic function}
+ defined in the \pkg{BiocGenerics} package.
+ See \code{?stats::\link[stats]{mad}} for the default method
+ (defined in the \pkg{stats} package).
+ Bioconductor packages can define specific methods for objects
+ not supported by the default method.
+}
+
+\usage{
+mad(x, center = median(x), constant = 1.4826,
+ na.rm = FALSE, low = FALSE, high = FALSE)
+}
+
+\arguments{
+ \item{x, center, constant, na.rm, low, high}{
+ See \code{?stats::\link[stats]{mad}}.
+ }
+}
+
+\value{
+ See \code{?stats::\link[stats]{mad}} for the value returned by the
+ default method.
+
+ Specific methods defined in Bioconductor packages should
+ behave as consistently as possible with the default method.
+}
+
+\seealso{
+ \itemize{
+ \item \code{stats::\link[stats]{mad}} for the default
+ \code{mad} method.
+
+ \item \code{\link[methods]{showMethods}} for displaying a summary of the
+ methods defined for a given generic function.
+
+ \item \code{\link[methods]{selectMethod}} for getting the definition of
+ a specific method.
+
+ \item \link{BiocGenerics} for a summary of all the generics defined
+ in the \pkg{BiocGenerics} package.
+ }
+}
+
+\examples{
+mad
+showMethods("mad")
+selectMethod("mad", "ANY") # the default method
+}
+
+\keyword{methods}
diff --git a/man/order.Rd b/man/order.Rd
index 47ed5ca..fdfc50b 100644
--- a/man/order.Rd
+++ b/man/order.Rd
@@ -43,7 +43,7 @@ order(..., na.last=TRUE, decreasing=FALSE)
}
\note{
- TO DEVELOPPERS:
+ TO DEVELOPERS:
Specific \code{order} methods should preferably be made "stable" for
consistent behavior across platforms and consistency with
diff --git a/man/organism_species.Rd b/man/organism_species.Rd
index fd2f636..877884f 100644
--- a/man/organism_species.Rd
+++ b/man/organism_species.Rd
@@ -42,7 +42,7 @@ species(object) <- value
}
\note{
- TO DEVELOPPERS:
+ TO DEVELOPERS:
\code{species} has been historically misused in many places in Bioconductor
and is redundant with \code{organism}. So implementing the \code{species}
diff --git a/man/rank.Rd b/man/rank.Rd
index 04d003b..b1bb4bd 100644
--- a/man/rank.Rd
+++ b/man/rank.Rd
@@ -40,7 +40,7 @@ rank(x, na.last=TRUE,
}
\note{
- TO DEVELOPPERS:
+ TO DEVELOPERS:
See note in \code{?BiocGenerics::\link[BiocGenerics]{order}}
about "stable" order.
diff --git a/man/rep.Rd b/man/rep.Rd
index ec5a17a..b7c42b8 100644
--- a/man/rep.Rd
+++ b/man/rep.Rd
@@ -16,18 +16,16 @@
}
\usage{
-## Unlike the standard rep.int() function defined in base (default method),
-## the generic function described here have a '...' argument (instead of
-## 'times').
-rep.int(x, ...)
+rep.int(x, times)
}
\arguments{
\item{x}{
The object to replicate (typically vector-like).
}
- \item{...}{
- Additional arguments, for use in specific \code{rep.int} methods.
+ \item{times}{
+ See \code{?base::\link[base]{rep.int}} for a description of
+ this argument.
}
}
diff --git a/man/sort.Rd b/man/sort.Rd
index d26124e..aeb9a1a 100644
--- a/man/sort.Rd
+++ b/man/sort.Rd
@@ -38,7 +38,7 @@ sort(x, decreasing=FALSE, ...)
}
\note{
- TO DEVELOPPERS:
+ TO DEVELOPERS:
See note in \code{?BiocGenerics::\link[BiocGenerics]{order}}
about "stable" order.
diff --git a/man/subset.Rd b/man/subset.Rd
new file mode 100644
index 0000000..4e3d391
--- /dev/null
+++ b/man/subset.Rd
@@ -0,0 +1,69 @@
+\name{subset}
+
+\alias{subset}
+
+\title{Subsetting vector-like, matrix-like and data-frame-like objects}
+
+\description{
+ Return subsets of vector-like, matrix-like or data-frame-like objects
+ which meet conditions.
+
+ NOTE: This man page is for the \code{subset} \emph{S4 generic function}
+ defined in the \pkg{BiocGenerics} package.
+ See \code{?base::\link[base]{subset}} for the \code{subset} S3 generic
+ defined in the \pkg{base} package.
+}
+
+\usage{
+subset(x, ...)
+}
+
+\arguments{
+ \item{x}{
+ A vector-like, matrix-like or data-frame-like object to be subsetted.
+ }
+ \item{...}{
+ Additional arguments (e.g. \code{subset}, \code{select}, \code{drop}),
+ for use in specific methods. See \code{?base::\link[base]{subset}} for
+ more information.
+ }
+}
+
+\value{
+ An object similar to \code{x} containing just the selected elements (for a
+ vector-like object), or the selected rows and columns (for a matrix-like or
+ data-frame-like object).
+}
+
+\seealso{
+ \itemize{
+ \item \code{base::\link[base]{subset}} in the \pkg{base} package
+ for the \code{subset} S3 generic.
+
+ \item \code{\link[methods]{showMethods}} for displaying a summary of the
+ methods defined for a given generic function.
+
+ \item \code{\link[methods]{selectMethod}} for getting the definition of
+ a specific method.
+
+ \item \link[S4Vectors]{subset,DataTable-method} in the \pkg{S4Vectors}
+ package for an example of a specific \code{subset} method (defined
+ for \link[S4Vectors]{DataTable} objects).
+
+ \item \link{BiocGenerics} for a summary of all the generics defined
+ in the \pkg{BiocGenerics} package.
+ }
+}
+
+\examples{
+subset
+showMethods("subset")
+selectMethod("subset", "ANY") # the default method
+
+library(S4Vectors)
+showMethods("subset")
+selectMethod("subset", "DataTable") # the "subset" method for
+ # DataTable objects
+}
+
+\keyword{methods}
diff --git a/man/testPackage.Rd b/man/testPackage.Rd
new file mode 100644
index 0000000..b527111
--- /dev/null
+++ b/man/testPackage.Rd
@@ -0,0 +1,79 @@
+\name{testPackage}
+
+\alias{testPackage}
+
+\title{Run RUnit package unit tests}
+
+\description{
+ \code{testPackage} helps developers implement unit tests using the
+ \pkg{RUnit} testing conventions.
+}
+
+\usage{
+testPackage(pkgname=NULL, subdir="unitTests", pattern="^test_.*\\\\.R$",
+ path=getwd())
+}
+
+\arguments{
+ \item{pkgname}{
+ The name of the package whose installed unit tests are to be run. A
+ missing or NULL value implies that the \code{testPackage} command
+ will look for tests within the package source directory indicated by
+ \code{path}.
+ }
+ \item{subdir}{
+ A character(1) vector providing the subdirectory in which unit tests
+ are located. The directory is searched first in the (installed or
+ source) package root, or in a subdirectory \code{inst/} below the
+ root.
+ }
+ \item{pattern}{
+ A character(1) regular expression describing the file names to be
+ evaluated; typically used to restrict tests to a subset of all test
+ files.
+ }
+ \item{path}{
+ A character(1) directory path indicating, when \code{pkgname} is
+ missing or NULL, where unit tests will be searched. \code{path} can
+ be any location at or below the package root.
+ }
+}
+
+\details{
+ This function is not exported from the package namespace, and must be
+ invoked using triple colons, \code{BiocGenerics:::testPackage()}; it
+ is provided primarily for the convenience of developers.
+
+ When invoked with missing or NULL \code{pkgname} argument, the
+ function assumes that it has been invoked from within the package
+ source tree (or that the source tree is located above \code{path}),
+ and finds unit tests in \code{subdir="unitTests"} in either the base
+ or \code{inst/} directories at the root of the package source
+ tree. This mode is useful when developing unit tests, since the
+ package does not have to be re-installed to run an updated test.
+
+ When invoked with \code{pkgname} set to the name of an installed
+ package, unit tests are searched for in the installed package
+ directory.
+}
+
+\value{
+ The function returns the result of \code{RUnit::runTestSuite} invoked
+ on the unit tests specified in the function call.
+}
+
+\seealso{
+ \url{http://bioconductor.org/developers/how-to/unitTesting-guidelines/}
+}
+
+\examples{
+## Run unit tests found in the library location where
+## BiocGenerics is installed
+BiocGenerics:::testPackage("BiocGenerics")
+\dontrun{## Run unit tests for the package whose source tree implied
+## by getwd()
+BiocGenerics:::testPackage()
+}
+}
+
+\keyword{methods}
diff --git a/man/unsplit.Rd b/man/unsplit.Rd
index 7f84ac2..36604b6 100644
--- a/man/unsplit.Rd
+++ b/man/unsplit.Rd
@@ -18,7 +18,7 @@
}
\usage{
-unsplit(x, recursive=TRUE, use.names=TRUE)
+unsplit(value, f, drop=FALSE)
}
\arguments{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-bioc-biocgenerics.git
More information about the debian-med-commit
mailing list