├── R ├── zzz.R ├── plotPCA.R ├── mean.R ├── rep.R ├── which.R ├── IQR.R ├── t.R ├── mad.R ├── toTable.R ├── Ontology.R ├── fileName.R ├── image.R ├── relist.R ├── subset.R ├── as.list.R ├── boxplot.R ├── density.R ├── weights.R ├── longForm.R ├── residuals.R ├── normalize.R ├── dbconn.R ├── var.R ├── score.R ├── unsplit.R ├── nrow.R ├── annotation.R ├── unlist.R ├── as.vector.R ├── unique.R ├── xtabs.R ├── do.call.R ├── tapply.R ├── paste.R ├── append.R ├── order.R ├── row_colnames.R ├── aperm.R ├── sort.R ├── lapply.R ├── cbind.R ├── as.data.frame.R ├── grep.R ├── mapply.R ├── dims.R ├── plotMA.R ├── get.R ├── duplicated.R ├── organism_species.R ├── strand.R ├── funprog.R ├── is.unsorted.R ├── setops.R ├── match.R ├── start.R ├── rank.R ├── utils.R ├── eval.R ├── Extremes.R ├── saveRDS.R ├── table.R ├── format.R ├── which.min.R ├── S3-classes-as-S4-classes.R ├── dge.R ├── containsOutOfMemoryData.R ├── normarg-utils.R ├── type.R ├── replaceSlots.R └── testPackage.R ├── tests └── run_unitTests.R ├── inst ├── unitTests │ ├── test_paste.R │ ├── test_Extremes.R │ ├── test_order.R │ ├── test_mapply.R │ ├── test_format.R │ └── test_updateObject.R └── CITATION ├── README.md ├── man ├── Ontology.Rd ├── fileName.Rd ├── plotPCA.Rd ├── evalq.Rd ├── annotation.Rd ├── S3-classes-as-S4-classes.Rd ├── longForm.Rd ├── dbconn.Rd ├── score.Rd ├── toTable.Rd ├── plotMA.Rd ├── IQR.Rd ├── mad.Rd ├── residuals.Rd ├── format.Rd ├── normalize.Rd ├── t.Rd ├── as.list.Rd ├── mean.Rd ├── density.Rd ├── var.Rd ├── weights.Rd ├── rep.Rd ├── boxplot.Rd ├── relist.Rd ├── table.Rd ├── aperm.Rd ├── paste.Rd ├── dge.Rd ├── image.Rd ├── subset.Rd ├── mapply.Rd ├── unlist.Rd ├── grep.Rd ├── nrow.Rd ├── unsplit.Rd ├── append.Rd ├── as.vector.Rd ├── which.Rd ├── unique.Rd ├── as.data.frame.Rd ├── saveRDS.Rd ├── xtabs.Rd ├── sort.Rd ├── do.call.Rd ├── Extremes.Rd ├── eval.Rd ├── is.unsorted.Rd ├── cbind.Rd ├── testPackage.Rd ├── lapply.Rd ├── tapply.Rd ├── get.Rd ├── rank.Rd ├── dims.Rd ├── which.min.Rd ├── match.Rd ├── duplicated.Rd ├── strand.Rd ├── row_colnames.Rd ├── order.Rd ├── organism_species.Rd ├── start.Rd ├── funprog.Rd └── type.Rd ├── NEWS ├── TODO └── DESCRIPTION /R/zzz.R: -------------------------------------------------------------------------------- 1 | .test <- function() testPackage("BiocGenerics") 2 | 3 | -------------------------------------------------------------------------------- /R/plotPCA.R: -------------------------------------------------------------------------------- 1 | setGeneric("plotPCA", function(object, ...) { 2 | standardGeneric("plotPCA") 3 | }) 4 | -------------------------------------------------------------------------------- /tests/run_unitTests.R: -------------------------------------------------------------------------------- 1 | require("BiocGenerics") || stop("unable to load BiocGenerics package") 2 | BiocGenerics:::.test() 3 | -------------------------------------------------------------------------------- /R/mean.R: -------------------------------------------------------------------------------- 1 | ### ------------------------------------------------------------------------- 2 | ### The mean() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | 6 | setGeneric("mean") 7 | -------------------------------------------------------------------------------- /R/rep.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The rep.int() generic 3 | ### ------------------------------------------------------------------------- 4 | 5 | setGeneric("rep.int") 6 | 7 | -------------------------------------------------------------------------------- /R/which.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The which() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | 6 | setGeneric("which") 7 | 8 | -------------------------------------------------------------------------------- /R/IQR.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The IQR() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | 6 | setGeneric("IQR", signature="x") 7 | -------------------------------------------------------------------------------- /R/t.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The t() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that base::t is an S3 generic. 6 | 7 | setGeneric("t") 8 | -------------------------------------------------------------------------------- /R/mad.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The mad() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Dispatches only on 'x' 6 | ### 7 | 8 | setGeneric("mad", signature="x") 9 | -------------------------------------------------------------------------------- /R/toTable.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The toTable() generic 3 | ### ------------------------------------------------------------------------- 4 | 5 | setGeneric("toTable", function(x, ...) standardGeneric("toTable")) 6 | 7 | -------------------------------------------------------------------------------- /R/Ontology.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The Ontology() generic 3 | ### ------------------------------------------------------------------------- 4 | 5 | setGeneric("Ontology", function(object) standardGeneric("Ontology")) 6 | 7 | -------------------------------------------------------------------------------- /R/fileName.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The fileName() generic 3 | ### ------------------------------------------------------------------------- 4 | 5 | setGeneric("fileName", function(object, ...) standardGeneric("fileName")) 6 | 7 | -------------------------------------------------------------------------------- /R/image.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The image() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that graphics::image is an S3 generic. 6 | 7 | setGeneric("image") 8 | 9 | -------------------------------------------------------------------------------- /R/relist.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The relist() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that utils::relist is an S3 generic. 6 | 7 | setGeneric("relist") 8 | 9 | -------------------------------------------------------------------------------- /R/subset.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The subset() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that base::subset is an S3 generic. 6 | 7 | setGeneric("subset") 8 | 9 | -------------------------------------------------------------------------------- /R/as.list.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The as.list() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that base::as.list is an S3 generic. 6 | 7 | setGeneric("as.list") 8 | 9 | -------------------------------------------------------------------------------- /R/boxplot.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The boxplot() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that graphics::boxplot is an S3 generic. 6 | 7 | setGeneric("boxplot") 8 | 9 | -------------------------------------------------------------------------------- /R/density.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The density() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that stats::density is an S3 generic. 6 | 7 | setGeneric("density") 8 | 9 | -------------------------------------------------------------------------------- /R/weights.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The weights() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that stats::weights is an S3 generic. 6 | 7 | setGeneric("weights") 8 | 9 | -------------------------------------------------------------------------------- /R/longForm.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The longForm() generic 3 | ### ------------------------------------------------------------------------- 4 | 5 | setGeneric("longForm", 6 | function(object, ...) standardGeneric("longForm") 7 | ) 8 | 9 | -------------------------------------------------------------------------------- /R/residuals.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The residuals() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that stats::residuals is an S3 generic. 6 | 7 | setGeneric("residuals") 8 | 9 | -------------------------------------------------------------------------------- /R/normalize.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The normalize() generic 3 | ### ------------------------------------------------------------------------- 4 | 5 | setGeneric("normalize", 6 | function(object, ...) standardGeneric("normalize") 7 | ) 8 | 9 | -------------------------------------------------------------------------------- /R/dbconn.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The dbconn() and dbfile() generics 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | 6 | setGeneric("dbconn", function(x) standardGeneric("dbconn")) 7 | 8 | setGeneric("dbfile", function(x) standardGeneric("dbfile")) 9 | -------------------------------------------------------------------------------- /inst/unitTests/test_paste.R: -------------------------------------------------------------------------------- 1 | 2 | test_ellipsis_forwarding_for_paste <- function() 3 | { 4 | x <- list(letters, LETTERS) 5 | 6 | target <- sapply(x, base::paste) 7 | checkIdentical(target, sapply(x, paste)) 8 | 9 | target <- sapply(x, base::paste, collapse="") 10 | checkIdentical(target, sapply(x, paste, collapse="")) 11 | } 12 | 13 | -------------------------------------------------------------------------------- /R/var.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The var() and sd() generics 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Dispatches only on 'x' (and 'y' for var) 6 | ### 7 | 8 | setGeneric("var", signature=c("x", "y")) 9 | 10 | setGeneric("sd", signature="x") 11 | -------------------------------------------------------------------------------- /R/score.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The score() and `score<-`() generics 3 | ### ------------------------------------------------------------------------- 4 | 5 | setGeneric("score", function(x, ...) standardGeneric("score")) 6 | 7 | setGeneric("score<-", signature="x", 8 | function(x, ..., value) standardGeneric("score<-") 9 | ) 10 | 11 | -------------------------------------------------------------------------------- /R/unsplit.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The unsplit() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### unsplit should not dispatch on 'drop' 6 | 7 | setGeneric("unsplit", 8 | function (value, f, drop = FALSE) standardGeneric("unsplit"), 9 | signature=c("value", "f")) 10 | 11 | -------------------------------------------------------------------------------- /R/nrow.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The nrow(), ncol(), NROW() and NCOL() generics 3 | ### ------------------------------------------------------------------------- 4 | 5 | ### The corresponding functions are standard functions defined in the base 6 | ### package. 7 | 8 | setGeneric("nrow") 9 | setGeneric("ncol") 10 | setGeneric("NROW") 11 | setGeneric("NCOL") 12 | 13 | -------------------------------------------------------------------------------- /R/annotation.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The annotation() and `annotation<-`() generics 3 | ### ------------------------------------------------------------------------- 4 | 5 | setGeneric("annotation", 6 | function(object, ...) standardGeneric("annotation") 7 | ) 8 | 9 | setGeneric("annotation<-", 10 | function(object, ..., value) standardGeneric("annotation<-") 11 | ) 12 | 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [](https://bioconductor.org/) 2 | 3 | **BiocGenerics** is an R/Bioconductor package that defines many S4 generic functions used in Bioconductor. 4 | 5 | See https://bioconductor.org/packages/BiocGenerics for more information including how to install the release version of the package (please refrain from installing directly from GitHub). 6 | 7 | -------------------------------------------------------------------------------- /R/unlist.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The unlist() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define this generic otherwise the implicit generic in 6 | ### package "base" would dispatch on all its arguments. Here we set dispatch 7 | ### on the 1st arg (the 'x' arg) only! 8 | 9 | setGeneric("unlist", signature="x") 10 | 11 | -------------------------------------------------------------------------------- /R/as.vector.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The as.vector() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define this generic otherwise the implicit generic in 6 | ### package "base" would dispatch on ('x', 'mode'). Here we set dispatch on 7 | ### the 1st arg (the 'x' arg) only! 8 | 9 | setGeneric("as.vector", signature="x") 10 | 11 | -------------------------------------------------------------------------------- /R/unique.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The unique() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define this generic otherwise the implicit generic in 6 | ### package "base" would dispatch on ('x', 'incomparables'). Here we set 7 | ### dispatch on the 1st arg (the 'x' arg) only! 8 | 9 | setGeneric("unique", signature="x") 10 | 11 | -------------------------------------------------------------------------------- /R/xtabs.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The xtabs() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define this generic otherwise the implicit generic in 6 | ### package "stats" would dispatch on all its arguments. Here we set dispatch 7 | ### on the 2nd arg (the 'data' arg) only! 8 | 9 | setGeneric("xtabs", signature="data") 10 | 11 | -------------------------------------------------------------------------------- /R/do.call.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The do.call() generic 3 | ### ------------------------------------------------------------------------- 4 | 5 | ### Need to explicitly define this generic otherwise the implicit generic in 6 | ### package "base" would dispatch on all its arguments. Here we set dispatch 7 | ### on the 1st and 2nd args only! 8 | 9 | setGeneric("do.call", signature=c("what", "args")) 10 | 11 | -------------------------------------------------------------------------------- /R/tapply.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The tapply() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define this generic otherwise the implicit generic in 6 | ### package "base" would dispatch on all its arguments. Here we set dispatch 7 | ### on the 1st and 2nd args only! 8 | 9 | setGeneric("tapply", signature=c("X", "INDEX")) 10 | 11 | -------------------------------------------------------------------------------- /R/paste.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The paste() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define this generic otherwise the implicit generic in 6 | ### package "base" would dispatch on ('sep', 'collapse'). 7 | ### 8 | ### Note that dispatching on '...' is supported starting with R 2.8.0 only. 9 | 10 | setGeneric("paste", signature="...") 11 | 12 | -------------------------------------------------------------------------------- /R/append.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The append() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define this generic otherwise the implicit generic in 6 | ### package "base" would dispatch on ('x', 'values', 'after'). Here we set 7 | ### dispatch on the first two args (the 'x' and 'values' args) only! 8 | 9 | setGeneric("append", signature=c("x", "values")) 10 | 11 | -------------------------------------------------------------------------------- /R/order.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The order() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define this generic otherwise the implicit generic in 6 | ### package "base" would dispatch on ('na.last', 'decreasing', 'method'). 7 | ### 8 | ### Note that dispatching on '...' is supported starting with R 2.8.0 only. 9 | 10 | setGeneric("order", signature="...") 11 | 12 | -------------------------------------------------------------------------------- /R/row_colnames.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The rownames() and colnames() generics 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | 6 | ### Dispatch on the 1st arg (the 'x' arg) only! 7 | setGeneric("rownames", signature="x") 8 | 9 | setGeneric("rownames<-") 10 | 11 | ### Dispatch on the 1st arg (the 'x' arg) only! 12 | setGeneric("colnames", signature="x") 13 | 14 | setGeneric("colnames<-") 15 | 16 | -------------------------------------------------------------------------------- /R/aperm.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The aperm() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that base::aperm is an S3 generic. 6 | ### 7 | ### Need to explicitly define this generic otherwise the implicit generic in 8 | ### package "base" would dispatch on ('a', 'perm'). Here we set dispatch on 9 | ### the 1st arg (the 'a' arg) only! 10 | 11 | setGeneric("aperm", signature="a") 12 | 13 | -------------------------------------------------------------------------------- /R/sort.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The sort() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that base::sort is an S3 generic. 6 | ### 7 | ### Need to explicitly define this generic otherwise the implicit generic 8 | ### in package "base" would dispatch on ('x', 'decreasing'). Here we set 9 | ### dispatch on the 1st arg (the 'x' arg) only! 10 | 11 | setGeneric("sort", signature="x") 12 | 13 | -------------------------------------------------------------------------------- /R/lapply.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The lapply() and sapply() generics 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define those generics otherwise the implicit generics 6 | ### in package "base" would dispatch on all their arguments. Here we set 7 | ### dispatch on the 1st arg (the 'X' arg) only! 8 | 9 | setGeneric("lapply", signature="X") 10 | 11 | setGeneric("sapply", signature="X") 12 | 13 | -------------------------------------------------------------------------------- /R/cbind.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The cbind() and rbind() generics 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define those generics otherwise the implicit generics 6 | ### in package "base" would dispatch on 'deparse.level'. 7 | ### 8 | ### Note that dispatching on '...' is supported starting with R 2.8.0 only. 9 | 10 | setGeneric("cbind", signature="...") 11 | 12 | setGeneric("rbind", signature="...") 13 | 14 | -------------------------------------------------------------------------------- /R/as.data.frame.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The as.data.frame() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that base::as.data.frame is an S3 generic. 6 | ### 7 | ### Need to explicitly define this generic otherwise the implicit generic in 8 | ### package "base" would dispatch on all its arguments. Here we set dispatch 9 | ### on the 1st arg (the 'x' arg) only! 10 | 11 | setGeneric("as.data.frame", signature="x") 12 | 13 | -------------------------------------------------------------------------------- /R/grep.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The grep() and grepl() generics 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define those generics otherwise the implicit generics 6 | ### in package "base" would dispatch on all their arguments. Here we set 7 | ### dispatch on the first 2 args ('pattern', 'x'). 8 | 9 | setGeneric("grep", signature = c("pattern", "x")) 10 | 11 | setGeneric("grepl", signature = c("pattern", "x")) 12 | -------------------------------------------------------------------------------- /inst/unitTests/test_Extremes.R: -------------------------------------------------------------------------------- 1 | 2 | test_ellipsis_forwarding_for_Extremes <- function() 3 | { 4 | for (FUN in c("pmax", "pmin", "pmax.int", "pmin.int")) { 5 | FUN <- match.fun(FUN) 6 | FUN_wrapper <- function(x, ...) FUN(x, ...) 7 | x <- c(1:3, NA) 8 | y <- c(NA, 3:1) 9 | checkIdentical(FUN(x, y), FUN_wrapper(x, y)) 10 | checkIdentical(FUN(x, y, na.rm=FALSE), FUN_wrapper(x, y, na.rm=FALSE)) 11 | checkIdentical(FUN(x, y, na.rm=TRUE), FUN_wrapper(x, y, na.rm=TRUE)) 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /R/mapply.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The mapply() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define this generic otherwise the implicit generic in 6 | ### package "base" would dispatch on all its arguments. Here we set dispatch 7 | ### on the 2nd arg (the '...' arg) only! 8 | ### 9 | ### Note that dispatching on '...' is supported starting with R 2.8.0 only. 10 | 11 | setGeneric("mapply", signature="...") 12 | 13 | -------------------------------------------------------------------------------- /R/dims.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The dims(), nrows() and ncols() generics 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | 6 | setGeneric("dims", signature="x", 7 | function(x, use.names=TRUE) standardGeneric("dims") 8 | ) 9 | 10 | setGeneric("nrows", signature="x", 11 | function(x, use.names=TRUE) standardGeneric("nrows") 12 | ) 13 | 14 | setGeneric("ncols", signature="x", 15 | function(x, use.names=TRUE) standardGeneric("ncols") 16 | ) 17 | 18 | -------------------------------------------------------------------------------- /R/plotMA.R: -------------------------------------------------------------------------------- 1 | setGeneric("plotMA", function(object, ...) { 2 | standardGeneric("plotMA") 3 | }) 4 | 5 | setMethod("plotMA", signature="ANY", 6 | definition = function(object, ...) { 7 | msg = sprintf("Error from the generic function 'plotMA' defined in package 'BiocGenerics': no S4 method definition for argument '%s' of class '%s' was found. Did you perhaps mean calling the function 'plotMA' from another package, e.g. 'limma'? In that case, please use the syntax 'limma::plotMA'.", 8 | deparse(substitute(object)), class(object)) 9 | stop(msg) 10 | }) 11 | -------------------------------------------------------------------------------- /inst/unitTests/test_order.R: -------------------------------------------------------------------------------- 1 | 2 | test_ellipsis_forwarding_for_order <- function() 3 | { 4 | x <- list(c(NA,11:13), c(21:22,NA)) 5 | 6 | target <- lapply(x, base::order) 7 | checkIdentical(target, lapply(x, order)) 8 | 9 | target <- lapply(x, base::order, na.last=TRUE) 10 | checkIdentical(target, lapply(x, order, na.last=TRUE)) 11 | 12 | target <- lapply(x, base::order, na.last=FALSE) 13 | checkIdentical(target, lapply(x, order, na.last=FALSE)) 14 | 15 | target <- lapply(x, base::order, na.last=NA) 16 | checkIdentical(target, lapply(x, order, na.last=NA)) 17 | } 18 | 19 | -------------------------------------------------------------------------------- /R/get.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The get() and mget() generics 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define those generics otherwise the implicit generics 6 | ### in package "base" would dispatch on all their arguments. Here we set 7 | ### dispatch on the first 3 args ('x', 'pos', 'envir') for get(), and on the 8 | ### first 2 args ('x', 'envir') for mget(). 9 | 10 | setGeneric("get", signature=c("x", "pos", "envir")) 11 | 12 | setGeneric("mget", signature=c("x", "envir")) 13 | 14 | -------------------------------------------------------------------------------- /R/duplicated.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The duplicated() and anyDuplicated() generics 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that base::duplicated and base::anyDuplicated are S3 generics. 6 | ### 7 | ### Need to explicitly define those generics otherwise the implicit generics 8 | ### in package "base" would dispatch on ('x', 'incomparables'). Here we set 9 | ### dispatch on the 1st arg (the 'x' arg) only! 10 | 11 | setGeneric("duplicated", signature="x") 12 | 13 | setGeneric("anyDuplicated", signature="x") 14 | 15 | -------------------------------------------------------------------------------- /R/organism_species.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The organism(), `organism<-`(), species(), and `species<-`() generics 3 | ### ------------------------------------------------------------------------- 4 | 5 | setGeneric("organism", function(object) standardGeneric("organism")) 6 | 7 | setGeneric("organism<-", signature="object", 8 | function(object, value) standardGeneric("organism<-") 9 | ) 10 | 11 | setGeneric("species", function(object) standardGeneric("species")) 12 | 13 | setGeneric("species<-", signature="object", 14 | function(object, value) standardGeneric("species<-") 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /R/strand.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The strand() and `strand<-`() generics 3 | ### ------------------------------------------------------------------------- 4 | 5 | setGeneric("strand", function(x, ...) standardGeneric("strand")) 6 | 7 | setGeneric("strand<-", function(x, ..., value) standardGeneric("strand<-")) 8 | 9 | unstrand <- function(x) 10 | { 11 | strand(x) <- "*" 12 | x 13 | } 14 | 15 | setGeneric("invertStrand", function(x) standardGeneric("invertStrand")) 16 | 17 | setMethod("invertStrand", "ANY", 18 | function(x) 19 | { 20 | strand(x) <- invertStrand(strand(x)) 21 | x 22 | } 23 | ) 24 | 25 | -------------------------------------------------------------------------------- /R/funprog.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The Reduce(), Filter(), Find(), Map() and Position() generics 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define those generics otherwise the implicit generics 6 | ### in package "base" would dispatch on all their arguments. Here we set 7 | ### dispatch on the 2nd arg (the 'x' or '...' arg) only! 8 | 9 | setGeneric("Reduce", signature="x") 10 | 11 | setGeneric("Filter", signature="x") 12 | 13 | setGeneric("Find", signature="x") 14 | 15 | ### Note that dispatching on '...' is supported starting with R 2.8.0 only. 16 | setGeneric("Map", signature="...") 17 | 18 | setGeneric("Position", signature="x") 19 | 20 | -------------------------------------------------------------------------------- /inst/unitTests/test_mapply.R: -------------------------------------------------------------------------------- 1 | 2 | test_ellipsis_forwarding_for_mapply <- function() 3 | { 4 | mapply_wrapper <- function(FUN, x, ...) mapply(FUN, x, ...) 5 | x <- list(a=1:3, 1:2) 6 | y <- list(104:105, B=103) 7 | 8 | target <- mapply(append, x, y) 9 | checkIdentical(target, mapply_wrapper(append, x, y)) 10 | 11 | MoreArgs <- list(after=0) 12 | target <- mapply(append, x, y, MoreArgs=MoreArgs) 13 | current <- mapply_wrapper(append, x, y, MoreArgs=MoreArgs) 14 | checkIdentical(target, current) 15 | 16 | MoreArgs <- list(after=2) 17 | target <- mapply(append, x, y, MoreArgs=MoreArgs, USE.NAMES=FALSE) 18 | current <- mapply_wrapper(append, x, y, MoreArgs=MoreArgs, USE.NAMES=FALSE) 19 | checkIdentical(target, current) 20 | } 21 | 22 | -------------------------------------------------------------------------------- /R/is.unsorted.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The is.unsorted() generic 3 | ### ------------------------------------------------------------------------- 4 | 5 | ### base::is.unsorted() doesn't have the ellipsis. We add it to the generic 6 | ### function defined below so methods can support additional arguments (e.g. 7 | ### the 'ignore.strand' argument for the method for GenomicRanges objects). 8 | 9 | .is.unsorted.useAsDefault <- function(x, na.rm=FALSE, strictly=FALSE, ...) 10 | base::is.unsorted(x, na.rm=na.rm, strictly=strictly, ...) 11 | 12 | setGeneric("is.unsorted", signature="x", 13 | function(x, na.rm=FALSE, strictly=FALSE, ...) 14 | standardGeneric("is.unsorted"), 15 | useAsDefault=.is.unsorted.useAsDefault 16 | ) 17 | 18 | -------------------------------------------------------------------------------- /R/setops.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The union(), intersect(), setdiff(), and setequal() generics 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### The default methods are defined in CRAN package generics. 6 | 7 | setGeneric("union", 8 | function(x, y, ...) standardGeneric("union"), 9 | useAsDefault=generics::union 10 | ) 11 | 12 | setGeneric("intersect", 13 | function(x, y, ...) standardGeneric("intersect"), 14 | useAsDefault=generics::intersect 15 | 16 | ) 17 | 18 | setGeneric("setdiff", 19 | function(x, y, ...) standardGeneric("setdiff"), 20 | useAsDefault=generics::setdiff 21 | ) 22 | 23 | setGeneric("setequal", 24 | function(x, y, ...) standardGeneric("setequal"), 25 | useAsDefault=generics::setequal 26 | ) 27 | 28 | -------------------------------------------------------------------------------- /R/match.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The match() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### base::match() doesn't have the ... argument. We add it to the generic 6 | ### function defined here. We also set dispatch on the first two args (the 7 | ### 'x' and 'table' args) only! 8 | 9 | .match.useAsDefault <- 10 | function(x, table, nomatch=NA_integer_, incomparables=NULL, ...) 11 | base::match(x, table, nomatch=nomatch, incomparables=incomparables, ...) 12 | 13 | setGeneric("match", signature=c("x", "table"), 14 | function(x, table, nomatch=NA_integer_, incomparables=NULL, ...) 15 | standardGeneric("match"), 16 | useAsDefault=.match.useAsDefault 17 | ) 18 | 19 | setGeneric("%in%", function(x, table) standardGeneric("%in%")) 20 | 21 | -------------------------------------------------------------------------------- /R/start.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The start(), end(), width(), and pos() generic getters and setters 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that stats::start and stats::end are S3 generics. 6 | ### 7 | 8 | setGeneric("start") 9 | 10 | setGeneric("start<-", signature="x", 11 | function(x, ..., value) standardGeneric("start<-") 12 | ) 13 | 14 | setGeneric("end") 15 | 16 | setGeneric("end<-", signature="x", 17 | function(x, ..., value) standardGeneric("end<-") 18 | ) 19 | 20 | setGeneric("width", function(x) standardGeneric("width")) 21 | 22 | setGeneric("width<-", signature="x", 23 | function(x, ..., value) standardGeneric("width<-") 24 | ) 25 | 26 | ### No pos() setter for now. 27 | setGeneric("pos", function(x) standardGeneric("pos")) 28 | 29 | -------------------------------------------------------------------------------- /R/rank.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The rank() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | 6 | ### base::rank() doesn't have the ellipsis. We add it to the generic 7 | ### function defined below so methods can support additional arguments (e.g. 8 | ### the 'ignore.strand' argument for the method for GenomicRanges objects). 9 | 10 | .is.rank.useAsDefault <- function(x, na.last=TRUE, 11 | ties.method=c("average", "first", "last", "random", "max", "min"), ...) 12 | { 13 | base::rank(x, na.last=na.last, ties.method=ties.method, ...) 14 | } 15 | 16 | setGeneric("rank", signature="x", 17 | function(x, na.last=TRUE, 18 | ties.method=c("average", "first", "last", "random", "max", "min"), ...) 19 | standardGeneric("rank"), 20 | useAsDefault=.is.rank.useAsDefault 21 | ) 22 | 23 | -------------------------------------------------------------------------------- /R/utils.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### Miscellaneous low-level utils 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | 6 | ### Like toString() but also injects names(x) in the returned string. 7 | ### For example with: 8 | ### x <- alist(b = 99, 98:96, zz) 9 | ### to_string(x) returns: 10 | ### "b = 99, 98:96, zz" 11 | to_string <- function(x) 12 | { 13 | x_names <- names(x) 14 | x <- as.character(x) 15 | if (!is.null(x_names)) { 16 | x_names <- paste0(x_names, ifelse(x_names == "", "", " = ")) 17 | x <- paste0(x_names, x) 18 | } 19 | paste(x, collapse=", ") 20 | } 21 | 22 | unused_arguments_msg <- function(dots) 23 | { 24 | msg <- "unused argument" 25 | if (length(dots) >= 2L) 26 | msg <- c(msg, "s") 27 | c(msg, " (", to_string(dots), ")") 28 | } 29 | 30 | -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | citEntry(entry="Article", 2 | author = "Huber, W. and Carey, V. J. and Gentleman, R. and Anders, S. and Carlson, M. and Carvalho, B. S. and Bravo, H. C. and Davis, S. and Gatto, L. and Girke, T. and Gottardo, R. and Hahne, F. and Hansen, K. D. and Irizarry, R. A. and Lawrence, M. and Love, M. I. and MacDonald, J. and Obenchain, V. and {Ole\'s}, A. K. and {Pag\`es}, H. and Reyes, A. and Shannon, P. and Smyth, G. K. and Tenenbaum, D. and Waldron, L. and Morgan, M. ", 3 | title = "{O}rchestrating high-throughput genomic analysis with {B}ioconductor", 4 | journal = "Nature Methods", 5 | year = "2015", 6 | volume = "12", 7 | number = "2", 8 | pages = "115--121", 9 | url = "http://www.nature.com/nmeth/journal/v12/n2/full/nmeth.3252.html", 10 | textVersion = paste( 11 | "Orchestrating high-throughput genomic analysis with Bioconductor.", 12 | "W. Huber, V.J. Carey, R. Gentleman, ..., M. Morgan", 13 | "Nature Methods, 2015:12, 115.") 14 | ) 15 | -------------------------------------------------------------------------------- /R/eval.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The eval() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define this generic otherwise the implicit generic in 6 | ### package "base" would dispatch on all its arguments. Here we set dispatch 7 | ### on the first two args (the 'expr' and 'envir' args) only! 8 | 9 | setGeneric("eval", signature=c("expr", "envir"), 10 | function(expr, envir=parent.frame(), 11 | enclos=if (is.list(envir) || is.pairlist(envir)) 12 | parent.frame() else baseenv()) 13 | { 14 | force(envir) 15 | force(enclos) 16 | standardGeneric("eval") 17 | } 18 | ) 19 | 20 | evalq <- function(expr, envir = parent.frame(), 21 | enclos = if (is.list(envir) || is.pairlist(envir)) 22 | parent.frame() else baseenv()) 23 | eval(substitute(expr), envir, enclos) 24 | -------------------------------------------------------------------------------- /inst/unitTests/test_format.R: -------------------------------------------------------------------------------- 1 | 2 | test_format <- function() 3 | { 4 | ## On a list. 5 | x1 <- list(1:5, NULL, 1:2) 6 | target1 <- c("1, 2, 3,....", " ", " 1, 2") 7 | checkIdentical(target1, format(x1)) 8 | 9 | ## On a list where some list elements are S4 objects. 10 | library(IRanges) 11 | x2 <- list(IRanges(), IRanges(1, 8:9), IRanges(2, 23:21)) 12 | target2 <- c(" ", " 1-8, 1-9", "2-23, 2-....") 13 | checkIdentical(target2, format(x2)) 14 | 15 | ## On a data.frame. 16 | x <- data.frame(x1=I(x1), x2=I(x2)) 17 | current <- format(x) 18 | checkTrue(is.data.frame(current)) 19 | checkIdentical(c(3L, 2L), dim(current)) 20 | checkIdentical(I(target1), current$x1) 21 | checkIdentical(I(target2), current$x2) 22 | 23 | ## Getting rid of the silly AsIs wrapper around the columns should 24 | ## make no difference. 25 | x[[1]] <- unclass(x[[1]]) 26 | x[[2]] <- unclass(x[[2]]) 27 | checkIdentical(current, format(x)) 28 | } 29 | 30 | -------------------------------------------------------------------------------- /R/Extremes.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The pmax(), pmin(), pmax.int() and pmin.int() generics 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define those generics otherwise the implicit generics 6 | ### in package "base" would dispatch on 'na.rm'. 7 | ### 8 | ### Note that dispatching on '...' is supported starting with R 2.8.0 only. 9 | 10 | ### setGeneric() cannot be used on "max" and "min": 11 | ### > setGeneric("max", signature="...") 12 | ### Error in setGeneric("max", signature = "...") : 13 | ### ‘max’ is a primitive function; methods can be defined, but the 14 | ### generic function is implicit, and cannot be changed. 15 | #setGeneric("max", signature="...") 16 | #setGeneric("min", signature="...") 17 | 18 | setGeneric("pmax", signature="...") 19 | 20 | setGeneric("pmin", signature="...") 21 | 22 | setGeneric("pmax.int", signature="...") 23 | 24 | setGeneric("pmin.int", signature="...") 25 | 26 | -------------------------------------------------------------------------------- /R/saveRDS.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The saveRDS() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Need to explicitly define this generic otherwise the implicit generic 6 | ### in package "base" would dispatch on all its argument ('object', 'file', 7 | ### 'ascii', etc...). Here we set dispatch on the 1st arg (the 'object' arg) 8 | ### only! 9 | 10 | setGeneric("saveRDS", signature="object") 11 | 12 | ### Note that this overwrites base::saveRDS()! 13 | setMethod("saveRDS", "ANY", 14 | function(object, file="", ascii=FALSE, version=NULL, 15 | compress=TRUE, refhook=NULL) 16 | { 17 | ## Only a warning for now. Should we make this an error? 18 | if (containsOutOfMemoryData(object)) 19 | warning("Object contains out-of-memory data so cannot be ", 20 | "serialized reliably.\n See '?containsOutOfMemoryData'.") 21 | base::saveRDS(object, file=file, ascii=ascii, version=version, 22 | compress=compress, refhook=refhook) 23 | } 24 | ) 25 | 26 | -------------------------------------------------------------------------------- /R/table.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The table() generic 3 | ### ------------------------------------------------------------------------- 4 | 5 | ### base::table() has a broken signature (list.names() is a function 6 | ### defined *inside* the body of base::table() so the default value for the 7 | ### 'dnn' arg is an expression that cannot be evaluated *outside* the 8 | ### base::table environment, this is poor design), we cannot keep all the 9 | ### extra arguments in the table() generic (those extra arguments are ugly 10 | ### and nobody uses them anyway). 11 | #setGeneric("table", signature="...", 12 | # function(..., exclude = if (useNA == "no") c(NA, NaN), 13 | # useNA = c("no", "ifany", "always"), 14 | # dnn = list.names(...), 15 | # deparse.level = 1) 16 | # standardGeneric("table") 17 | #) 18 | 19 | ### So we use this instead. 20 | 21 | .table.useAsDefault <- function(...) base::table(...) 22 | 23 | setGeneric("table", signature="...", 24 | function(...) standardGeneric("table"), 25 | useAsDefault=.table.useAsDefault 26 | ) 27 | 28 | -------------------------------------------------------------------------------- /R/format.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The format() generic 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Note that base::format is an S3 generic. 6 | 7 | setGeneric("format") 8 | 9 | ### The base package doesn't define a specific format() method for list 10 | ### objects and format.default() does a poor job on a list: 11 | ### 12 | ### > format(list(1:10)) 13 | ### [1] "1, 2, 3, 4, 5, 6, 7, 8, 9, 10" 14 | ### > library(IRanges) 15 | ### > format(list(IRanges(1, 8:9))) 16 | ### Error in h(simpleError(msg, call)) : 17 | ### error in evaluating the argument 'obj' in selecting a method for 18 | ### function 'unname': IRanges objects don't support [[, as.list(), 19 | ### lapply(), or unlist() at the moment 20 | ### 21 | ### OTOH format.AsIs() does a good job with lists: 22 | ### 23 | ### > format.AsIs(list(1:10)) 24 | ### [1] "1, 2, 3,...." 25 | ### > format.AsIs(list(IRanges(1, 8:9))) 26 | ### [1] "1-8, 1-9" 27 | ### 28 | ### So we define a format() **S3** method for list objects that does that. 29 | format.list <- base::format.AsIs 30 | 31 | -------------------------------------------------------------------------------- /man/Ontology.Rd: -------------------------------------------------------------------------------- 1 | \name{Ontology} 2 | 3 | \alias{Ontology} 4 | 5 | \title{Generic Ontology getter} 6 | 7 | \description{ 8 | Get the Ontology of an object. 9 | } 10 | 11 | \usage{ 12 | Ontology(object) 13 | } 14 | 15 | \arguments{ 16 | \item{object}{ 17 | An object with an Ontology. 18 | } 19 | } 20 | 21 | \seealso{ 22 | \itemize{ 23 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 24 | methods defined for a given generic function. 25 | 26 | \item \code{\link[methods]{selectMethod}} for getting the definition of 27 | a specific method. 28 | 29 | \item \link[AnnotationDbi]{Ontology,GOTerms-method} in the 30 | \pkg{AnnotationDbi} package for an example of a specific 31 | \code{Ontology} method (defined for \link[AnnotationDbi]{GOTerms} 32 | objects). 33 | 34 | \item \link{BiocGenerics} for a summary of all the generics defined 35 | in the \pkg{BiocGenerics} package. 36 | } 37 | } 38 | 39 | \examples{ 40 | Ontology 41 | showMethods("Ontology") 42 | 43 | library(AnnotationDbi) 44 | showMethods("Ontology") 45 | selectMethod("Ontology", "GOTerms") 46 | } 47 | 48 | \keyword{methods} 49 | -------------------------------------------------------------------------------- /R/which.min.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The which.min() and which.max() generics 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### Michael, June 2016 (commit 860cce0ec85b94ebca190802be95e61c4f469d6b): 6 | ### 7 | ### The default methods (defined in the base package) only take 1 argument. 8 | ### We add the ... argument to the generic functions defined here so they 9 | ### can be called with an arbitrary number of effective arguments. This was 10 | ### motivated by the desire to optionally return global subscripts from 11 | ### methods on List. 12 | ### These generics are slated to be internalized in base R. When that 13 | ### happens, these calls will effectively be no-ops. 14 | 15 | .which.min.useAsDefault <- function(x, ...) base::which.min(x, ...) 16 | .which.max.useAsDefault <- function(x, ...) base::which.max(x, ...) 17 | 18 | setGeneric("which.min", 19 | function(x, ...) standardGeneric("which.min"), 20 | useAsDefault=.which.min.useAsDefault 21 | ) 22 | 23 | setGeneric("which.max", 24 | function(x, ...) standardGeneric("which.max"), 25 | useAsDefault=.which.max.useAsDefault 26 | ) 27 | 28 | -------------------------------------------------------------------------------- /man/fileName.Rd: -------------------------------------------------------------------------------- 1 | \name{fileName} 2 | 3 | \alias{fileName} 4 | 5 | \title{Accessing the file name of an object} 6 | 7 | \description{ 8 | Get the file name of an object. 9 | } 10 | 11 | \usage{ 12 | fileName(object, ...) 13 | } 14 | 15 | \arguments{ 16 | \item{object}{ 17 | An object with a file name. 18 | } 19 | \item{...}{ 20 | Additional arguments, for use in specific methods. 21 | } 22 | } 23 | 24 | \seealso{ 25 | \itemize{ 26 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 27 | methods defined for a given generic function. 28 | 29 | \item \code{\link[methods]{selectMethod}} for getting the definition of 30 | a specific method. 31 | 32 | \item \link[MSnbase]{fileName,MSmap-method} in the 33 | \pkg{MSnbase} package for an example of a specific 34 | \code{fileName} method (defined for \link[MSnbase]{MSmap} 35 | objects). 36 | 37 | \item \link{BiocGenerics} for a summary of all the generics defined 38 | in the \pkg{BiocGenerics} package. 39 | } 40 | } 41 | 42 | \examples{ 43 | fileName 44 | showMethods("fileName") 45 | 46 | library(MSnbase) 47 | showMethods("fileName") 48 | selectMethod("fileName", "MSmap") 49 | } 50 | 51 | \keyword{methods} 52 | -------------------------------------------------------------------------------- /R/S3-classes-as-S4-classes.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### S3 classes as S4 classes 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### We register some old-style (aka S3) classes as formally defined (aka S4) 6 | ### classes. This allows S4 methods defined in Bioconductor packages to use 7 | ### them in their signatures. Note that dispatch still works without this 8 | ### registration but causes 'R CMD INSTALL' to (gently) complain. 9 | 10 | ### connection class and subclasses 11 | .connectionClasses <- c("file", "url", "gzfile", "bzfile", "unz", "pipe", 12 | "fifo", "sockconn", "terminal", "textConnection", 13 | "gzcon") 14 | apply(cbind(.connectionClasses, "connection"), 1, setOldClass, 15 | where = environment()) 16 | 17 | setClassUnion("character_OR_connection", c("character", "connection")) 18 | 19 | ### others 20 | setOldClass("AsIs") 21 | 22 | #setOldClass("xtabs", "table") # this seems to cause problems when installing 23 | # IRanges: 24 | # Warning: replacing previous import 25 | # ‘.__C__table’ when loading ‘BiocGenerics’ 26 | 27 | setOldClass("dist") 28 | 29 | -------------------------------------------------------------------------------- /R/dge.R: -------------------------------------------------------------------------------- 1 | # Currently, these are for DESeq and DEXSeq. Could be extended to a more general 2 | # infrastructure for count datasets. 3 | setGeneric("counts", function(object, ...) standardGeneric("counts")) 4 | setGeneric("counts<-", function(object, ..., value) standardGeneric("counts<-")) 5 | setGeneric("dispTable", function(object, ...) standardGeneric("dispTable")) 6 | setGeneric("dispTable<-", function(object, ..., value) standardGeneric("dispTable<-")) 7 | setGeneric("sizeFactors", function(object, ...) standardGeneric("sizeFactors")) 8 | setGeneric("sizeFactors<-", function(object, ..., value) standardGeneric("sizeFactors<-")) 9 | 10 | setGeneric("conditions", function(object, ...) standardGeneric("conditions")) 11 | setGeneric("conditions<-", function(object, ..., value) standardGeneric("conditions<-")) 12 | setGeneric("design", function(object, ...) standardGeneric("design")) 13 | setGeneric("design<-", function(object, ..., value) standardGeneric("design<-")) 14 | 15 | setGeneric("estimateSizeFactors", function(object, ...) standardGeneric("estimateSizeFactors")) 16 | setGeneric("estimateDispersions", function(object, ...) standardGeneric("estimateDispersions")) 17 | setGeneric("plotDispEsts", function(object, ...) standardGeneric("plotDispEsts")) 18 | 19 | -------------------------------------------------------------------------------- /man/plotPCA.Rd: -------------------------------------------------------------------------------- 1 | \name{plotPCA} 2 | 3 | \alias{plotPCA} 4 | 5 | \title{PCA-plot: Principal Component Analysis plot} 6 | 7 | \description{ 8 | A generic function which produces a PCA-plot. 9 | } 10 | 11 | \usage{ 12 | plotPCA(object, ...) 13 | } 14 | 15 | \arguments{ 16 | \item{object}{ 17 | 18 | A data object, typically containing gene expression information. 19 | 20 | } 21 | \item{...}{ 22 | Additional arguments, for use in specific methods. 23 | } 24 | } 25 | 26 | \value{ 27 | Undefined. The function exists for its side effect, producing a plot. 28 | } 29 | 30 | \seealso{ 31 | \itemize{ 32 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 33 | methods defined for a given generic function. 34 | 35 | \item \code{\link[methods]{selectMethod}} for getting the definition of 36 | a specific method. 37 | 38 | \item \code{\link[DESeq2]{plotPCA}} in the \pkg{DESeq2} package 39 | for an example method that uses this generic. 40 | 41 | \item \code{\link{BiocGenerics}} for a summary of all the generics defined 42 | in the \pkg{BiocGenerics} package. 43 | } 44 | } 45 | 46 | \examples{ 47 | showMethods("plotPCA") 48 | 49 | suppressWarnings( 50 | if(require("DESeq2")) 51 | example("plotPCA", package="DESeq2", local=TRUE) 52 | ) 53 | } 54 | 55 | \keyword{methods} 56 | -------------------------------------------------------------------------------- /man/evalq.Rd: -------------------------------------------------------------------------------- 1 | \name{evalq} 2 | 3 | \alias{evalq} 4 | 5 | \title{Evaluate an (unevaluated) expression} 6 | 7 | \description{ 8 | \code{evalq} evaluates an R expression (the quoted form of its first 9 | argument) in a specified environment. 10 | 11 | NOTE: This man page is for the \code{evalq} wrapper defined in the 12 | \pkg{BiocGenerics} package. See \code{?base::\link[base]{evalq}} for the 13 | function defined in the \pkg{base} package. This wrapper correctly delegates 14 | to the \code{eval} generic, rather than 15 | \code{base::\link[base]{eval}}. 16 | } 17 | 18 | \usage{ 19 | evalq(expr, envir=parent.frame(), 20 | enclos=if (is.list(envir) || is.pairlist(envir)) 21 | parent.frame() else baseenv()) 22 | } 23 | 24 | \arguments{ 25 | \item{expr}{ 26 | Quoted to form the expression that is evaluated. 27 | } 28 | \item{envir}{ 29 | The \emph{environment} in which \code{expr} is to be evaluated. 30 | May be any object supported by methods on the \code{\link{eval}} 31 | generic. 32 | } 33 | \item{enclos}{ 34 | See \code{?base::\link[base]{evalq}} for a description of 35 | this argument. 36 | } 37 | } 38 | 39 | \value{ 40 | See \code{?base::\link[base]{evalq}}. 41 | } 42 | 43 | \seealso{ 44 | \itemize{ 45 | \item \code{base::\link[base]{evalq}} for the base \code{evalq} function. 46 | } 47 | } 48 | 49 | \examples{ 50 | evalq # note just a copy of the original evalq 51 | } 52 | -------------------------------------------------------------------------------- /man/annotation.Rd: -------------------------------------------------------------------------------- 1 | \name{annotation} 2 | 3 | \alias{annotation} 4 | \alias{annotation<-} 5 | 6 | \title{Accessing annotation information} 7 | 8 | \description{ 9 | Get or set the annotation information contained in an object. 10 | } 11 | 12 | \usage{ 13 | annotation(object, ...) 14 | annotation(object, ...) <- value 15 | } 16 | 17 | \arguments{ 18 | \item{object}{ 19 | An object containing annotation information. 20 | } 21 | \item{...}{ 22 | Additional arguments, for use in specific methods. 23 | } 24 | \item{value}{ 25 | The annotation information to set on \code{object}. 26 | } 27 | } 28 | 29 | \seealso{ 30 | \itemize{ 31 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 32 | methods defined for a given generic function. 33 | 34 | \item \code{\link[methods]{selectMethod}} for getting the definition of 35 | a specific method. 36 | 37 | \item \link[Biobase]{annotation,eSet-method} in the \pkg{Biobase} package 38 | for an example of a specific \code{annotation} method (defined for 39 | \link[Biobase]{eSet} objects). 40 | 41 | \item \link{BiocGenerics} for a summary of all the generics defined 42 | in the \pkg{BiocGenerics} package. 43 | } 44 | } 45 | 46 | \examples{ 47 | annotation 48 | showMethods("annotation") 49 | 50 | library(Biobase) 51 | showMethods("annotation") 52 | selectMethod("annotation", "eSet") 53 | } 54 | 55 | \keyword{methods} 56 | -------------------------------------------------------------------------------- /man/S3-classes-as-S4-classes.Rd: -------------------------------------------------------------------------------- 1 | \name{S3-classes-as-S4-classes} 2 | 3 | \alias{S3-classes-as-S4-classes} 4 | 5 | \alias{connection-class} 6 | \alias{file-class} 7 | \alias{url-class} 8 | \alias{gzfile-class} 9 | \alias{bzfile-class} 10 | \alias{unz-class} 11 | \alias{pipe-class} 12 | \alias{fifo-class} 13 | \alias{sockconn-class} 14 | \alias{terminal-class} 15 | \alias{textConnection-class} 16 | \alias{gzcon-class} 17 | \alias{character_OR_connection-class} 18 | 19 | \alias{AsIs-class} 20 | %\alias{table-class} 21 | %\alias{xtabs-class} 22 | \alias{dist-class} 23 | 24 | 25 | \title{S3 classes as S4 classes} 26 | 27 | \description{ 28 | Some old-style (aka S3) classes are turned into formally defined (aka S4) 29 | classes by the \pkg{BiocGenerics} package. This allows S4 methods defined in 30 | Bioconductor packages to use them in their signatures. 31 | } 32 | 33 | \details{ 34 | S3 classes currently turned into S4 classes: 35 | \itemize{ 36 | \item connection class and subclasses: 37 | \link{connection}, 38 | file, url, gzfile, bzfile, unz, pipe, 39 | fifo, sockconn, terminal, textConnection, 40 | gzcon. 41 | Addtitionally the character_OR_connection S4 class is 42 | defined as the union of classes character and connection. 43 | 44 | \item others: \link{AsIs}, \link{dist} 45 | } 46 | } 47 | 48 | \seealso{ 49 | \link{setOldClass} and \link{setClassUnion} in the \pkg{methods} package. 50 | } 51 | 52 | \keyword{classes} 53 | -------------------------------------------------------------------------------- /man/longForm.Rd: -------------------------------------------------------------------------------- 1 | \name{longForm} 2 | 3 | \alias{longForm} 4 | 5 | \title{Turn object into long form} 6 | 7 | \description{ 8 | A generic function that returns the \emph{long form} of an object. 9 | } 10 | 11 | \usage{ 12 | longForm(object, ...) 13 | } 14 | 15 | \arguments{ 16 | \item{object}{ 17 | A data object. 18 | } 19 | \item{...}{ 20 | Additional arguments, for use in specific methods. 21 | } 22 | } 23 | 24 | \value{ 25 | The \emph{long form} version of the original object. This is typically 26 | a data-frame-like object. 27 | } 28 | 29 | \seealso{ 30 | \itemize{ 31 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 32 | methods defined for a given generic function. 33 | 34 | \item \code{\link[methods]{selectMethod}} for getting the definition of 35 | a specific method. 36 | 37 | \item \link[MultiAssayExperiment]{longForm,MultiAssayExperiment-method} 38 | in the \pkg{MultiAssayExperiment} package for an example of a 39 | specific \code{longForm} method (defined for 40 | \link[MultiAssayExperiment]{MultiAssayExperiment} objects). 41 | 42 | \item \link{BiocGenerics} for a summary of all the generics defined 43 | in the \pkg{BiocGenerics} package. 44 | } 45 | } 46 | 47 | \examples{ 48 | longForm 49 | showMethods("longForm") 50 | 51 | library(MultiAssayExperiment) 52 | showMethods("longForm") 53 | selectMethod("longForm", "MultiAssayExperiment") 54 | } 55 | 56 | \keyword{methods} 57 | -------------------------------------------------------------------------------- /man/dbconn.Rd: -------------------------------------------------------------------------------- 1 | \name{dbconn} 2 | 3 | \alias{dbconn} 4 | \alias{dbfile} 5 | 6 | \title{Accessing SQLite DB information} 7 | 8 | \description{ 9 | Get a connection object or file path for a SQLite DB 10 | } 11 | 12 | \usage{ 13 | dbconn(x) 14 | dbfile(x) 15 | } 16 | 17 | \arguments{ 18 | \item{x}{ 19 | An object with a SQLite connection. 20 | } 21 | } 22 | 23 | \value{ 24 | \code{dbconn} returns a connection object to the SQLite DB containing 25 | \code{x}'s data. 26 | 27 | \code{dbfile} returns a path (character string) to the SQLite DB (file) 28 | containing \code{x}'s data. 29 | } 30 | 31 | \seealso{ 32 | \itemize{ 33 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 34 | methods defined for a given generic function. 35 | 36 | \item \code{\link[methods]{selectMethod}} for getting the definition of 37 | a specific method. 38 | 39 | \item \link[AnnotationDbi]{dbconn,AnnotationDb-method} in the 40 | \pkg{AnnotationDbi} package for an example of a specific 41 | \code{dbconn} method (defined for \link[AnnotationDbi]{dbconn} 42 | objects). 43 | 44 | \item \link{BiocGenerics} for a summary of all the generics defined 45 | in the \pkg{BiocGenerics} package. 46 | } 47 | } 48 | 49 | \examples{ 50 | dbconn 51 | showMethods("dbconn") 52 | dbfile 53 | showMethods("dbfile") 54 | 55 | library(AnnotationDbi) 56 | showMethods("dbconn") 57 | selectMethod("dbconn", "AnnotationDb") 58 | } 59 | 60 | \keyword{methods} 61 | -------------------------------------------------------------------------------- /man/score.Rd: -------------------------------------------------------------------------------- 1 | \name{score} 2 | 3 | \alias{score} 4 | \alias{score<-} 5 | 6 | \title{Score accessor} 7 | 8 | \description{ 9 | Get or set the score value contained in an object. 10 | } 11 | 12 | \usage{ 13 | score(x, ...) 14 | score(x, ...) <- value 15 | } 16 | 17 | \arguments{ 18 | \item{x}{ 19 | An object to get or set the score value of. 20 | } 21 | \item{...}{ 22 | Additional arguments, for use in specific methods. 23 | } 24 | \item{value}{ 25 | The score value to set on \code{x}. 26 | } 27 | } 28 | 29 | \seealso{ 30 | \itemize{ 31 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 32 | methods defined for a given generic function. 33 | 34 | \item \code{\link[methods]{selectMethod}} for getting the definition of 35 | a specific method. 36 | 37 | \item \link[GenomicRanges]{score,GenomicRanges-method} in the 38 | \pkg{GenomicRanges} package for an example of a specific 39 | \code{score} method (defined for \link[GenomicRanges]{GenomicRanges} 40 | objects). 41 | 42 | \item \link{BiocGenerics} for a summary of all the generics defined 43 | in the \pkg{BiocGenerics} package. 44 | } 45 | } 46 | 47 | \examples{ 48 | score 49 | showMethods("score") 50 | 51 | `score<-` 52 | showMethods("score<-") 53 | 54 | library(GenomicRanges) 55 | 56 | showMethods("score") 57 | selectMethod("score", "GenomicRanges") 58 | 59 | showMethods("score<-") 60 | selectMethod("score<-", "GenomicRanges") 61 | } 62 | 63 | \keyword{methods} 64 | -------------------------------------------------------------------------------- /man/toTable.Rd: -------------------------------------------------------------------------------- 1 | \name{toTable} 2 | 3 | \alias{toTable} 4 | 5 | \title{An alternative to as.data.frame()} 6 | 7 | \description{ 8 | \code{toTable()} is an \emph{S4 generic function} provided as an 9 | alternative to \code{\link[BiocGenerics]{as.data.frame}()}. 10 | } 11 | 12 | \usage{ 13 | toTable(x, ...) 14 | } 15 | 16 | \arguments{ 17 | \item{x}{ 18 | The object to turn into a data frame. 19 | } 20 | \item{...}{ 21 | Additional arguments, for use in specific methods. 22 | } 23 | } 24 | 25 | \value{ 26 | A data frame. 27 | } 28 | 29 | \seealso{ 30 | \itemize{ 31 | \item The \code{\link[BiocGenerics]{as.data.frame}} \emph{S4 generic} 32 | defined in the \pkg{BiocGenerics} package. 33 | 34 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 35 | methods defined for a given generic function. 36 | 37 | \item \code{\link[methods]{selectMethod}} for getting the definition of 38 | a specific method. 39 | 40 | \item \link[AnnotationDbi]{toTable,Bimap-method} in the 41 | \pkg{AnnotationDbi} package for an example of a specific 42 | \code{toTable} method (defined for \link[AnnotationDbi]{Bimap} 43 | objects). 44 | 45 | \item \link{BiocGenerics} for a summary of all the generics defined 46 | in the \pkg{BiocGenerics} package. 47 | } 48 | } 49 | 50 | \examples{ 51 | toTable 52 | showMethods("toTable") 53 | 54 | library(AnnotationDbi) 55 | showMethods("toTable") 56 | selectMethod("toTable", "Bimap") 57 | } 58 | 59 | \keyword{methods} 60 | -------------------------------------------------------------------------------- /man/plotMA.Rd: -------------------------------------------------------------------------------- 1 | \name{plotMA} 2 | 3 | \alias{plotMA} 4 | \alias{plotMA,ANY-method} 5 | 6 | \title{MA-plot: plot differences versus averages for high-throughput data} 7 | 8 | \description{ 9 | A generic function which produces an MA-plot for an object containing 10 | microarray, RNA-Seq or other data. 11 | } 12 | 13 | \usage{ 14 | plotMA(object, ...) 15 | } 16 | 17 | \arguments{ 18 | \item{object}{ 19 | A data object, typically containing count values from an RNA-Seq 20 | experiment or microarray intensity values. 21 | } 22 | \item{...}{ 23 | Additional arguments, for use in specific methods. 24 | } 25 | } 26 | 27 | \value{ 28 | Undefined. The function exists for its side effect, producing a plot. 29 | } 30 | 31 | \seealso{ 32 | \itemize{ 33 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 34 | methods defined for a given generic function. 35 | 36 | \item \code{\link[methods]{selectMethod}} for getting the definition of 37 | a specific method. 38 | 39 | \item \code{\link[limma]{plotMA}} in the \pkg{limma} package 40 | for a function with the same name that is not dispatched through 41 | this generic function. 42 | 43 | \item \code{\link{BiocGenerics}} for a summary of all the generics defined 44 | in the \pkg{BiocGenerics} package. 45 | } 46 | } 47 | 48 | \examples{ 49 | showMethods("plotMA") 50 | 51 | suppressWarnings( 52 | if(require("DESeq2")) 53 | example("plotMA", package="DESeq2", local=TRUE) 54 | ) 55 | } 56 | 57 | \keyword{methods} 58 | -------------------------------------------------------------------------------- /man/IQR.Rd: -------------------------------------------------------------------------------- 1 | \name{IQR} 2 | 3 | \alias{IQR} 4 | 5 | \title{The Interquartile Range} 6 | 7 | \description{ 8 | Compute the interquartile range for a vector. 9 | 10 | NOTE: This man page is for the \code{IQR} \emph{S4 generic function} 11 | defined in the \pkg{BiocGenerics} package. 12 | See \code{?stats::\link[stats]{IQR}} for the default method 13 | (defined in the \pkg{stats} package). 14 | Bioconductor packages can define specific methods for objects 15 | not supported by the default method. 16 | } 17 | 18 | \usage{ 19 | IQR(x, na.rm = FALSE, type = 7) 20 | } 21 | 22 | \arguments{ 23 | \item{x, na.rm, type}{ 24 | See \code{?stats::\link[stats]{IQR}}. 25 | } 26 | } 27 | 28 | \value{ 29 | See \code{?stats::\link[stats]{IQR}} for the value returned by the 30 | default method. 31 | 32 | Specific methods defined in Bioconductor packages should 33 | behave as consistently as possible with the default method. 34 | } 35 | 36 | \seealso{ 37 | \itemize{ 38 | \item \code{stats::\link[stats]{IQR}} for the default 39 | \code{IQR} method. 40 | 41 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 42 | methods defined for a given generic function. 43 | 44 | \item \code{\link[methods]{selectMethod}} for getting the definition of 45 | a specific method. 46 | 47 | \item \link{BiocGenerics} for a summary of all the generics defined 48 | in the \pkg{BiocGenerics} package. 49 | } 50 | } 51 | 52 | \examples{ 53 | IQR 54 | showMethods("IQR") 55 | selectMethod("IQR", "ANY") # the default method 56 | } 57 | 58 | \keyword{methods} 59 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | CHANGES IN VERSION 0.56.0 2 | ------------------------- 3 | 4 | BUG FIXES 5 | 6 | o Fix updateObject() infinite recursion on an environment that contains 7 | itself. 8 | 9 | o Small tweak to updateObject(). 10 | 11 | 12 | CHANGES IN VERSION 0.54.0 13 | ------------------------- 14 | 15 | NEW FEATURES 16 | 17 | o Add longForm() S4 generic. 18 | See https://github.com/waldronlab/MultiAssayExperiment/issues/333 for 19 | some context. 20 | 21 | o Add paste2() S4 generic, with methods defined for ordinary vectors 22 | and arrays. Also add add_prefix() and add_suffix(), two simple wrappers 23 | around paste2() provided for convenience and code readability. 24 | 25 | o Define setequal() S4 generic with generics::setequal as default method. 26 | 27 | SIGNIFICANT USER-VISIBLE CHANGES 28 | 29 | o Add CRAN package generics to Depends field. The default methods for 30 | S4 generics union(), intersect(), and setdiff() now are 31 | generics::union(), generics::intersect(), and generics::setdiff(), 32 | respectively. See '?BiocGenerics::setops' for more information. 33 | 34 | 35 | CHANGES IN VERSION 0.52.0 36 | ------------------------- 37 | 38 | NEW FEATURES 39 | 40 | o Define the OutOfMemoryObject class (VIRTUAL class with no slots). 41 | 42 | o Add S4 generic containsOutOfMemoryData() and implement various methods. 43 | See '?containsOutOfMemoryData' for the details. 44 | 45 | o Add S4 generic saveRDS() and a default method that is just a thin wrapper 46 | around base::saveRDS() that issues a warning if the object to serialize 47 | contains out-of-memory data. 48 | 49 | -------------------------------------------------------------------------------- /R/containsOutOfMemoryData.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The containsOutOfMemoryData() generic 3 | ### ------------------------------------------------------------------------- 4 | 5 | setGeneric("containsOutOfMemoryData", 6 | function(object) standardGeneric("containsOutOfMemoryData") 7 | ) 8 | 9 | .S4_object_contains_out_of_memory_data <- function(object) 10 | { 11 | slot_names <- slotNames(class(object)) 12 | for (name in slot_names) { 13 | if (containsOutOfMemoryData(slot(object, name))) 14 | return(TRUE) 15 | } 16 | FALSE 17 | } 18 | 19 | .list_contains_out_of_memory_data <- function(object) 20 | { 21 | for (x in object) { 22 | if (containsOutOfMemoryData(x)) 23 | return(TRUE) 24 | } 25 | FALSE 26 | } 27 | 28 | .environment_contains_out_of_memory_data <- function(object) 29 | { 30 | for (name in names(object)) { 31 | if (containsOutOfMemoryData(object[[name]])) 32 | return(TRUE) 33 | } 34 | FALSE 35 | } 36 | 37 | setMethod("containsOutOfMemoryData", "ANY", 38 | function(object) 39 | { 40 | if (isS4(object)) 41 | return(.S4_object_contains_out_of_memory_data(object)) 42 | FALSE 43 | } 44 | ) 45 | 46 | setMethod("containsOutOfMemoryData", "list", 47 | .list_contains_out_of_memory_data 48 | ) 49 | 50 | setMethod("containsOutOfMemoryData", "environment", 51 | .environment_contains_out_of_memory_data 52 | ) 53 | 54 | setClass("OutOfMemoryObject", representation("VIRTUAL")) 55 | 56 | setMethod("containsOutOfMemoryData", "OutOfMemoryObject", 57 | function(object) TRUE 58 | ) 59 | 60 | -------------------------------------------------------------------------------- /R/normarg-utils.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### Utility functions for checking/fixing user-supplied arguments 3 | ### ------------------------------------------------------------------------- 4 | 5 | ### NOTE: The stuff in this file (not exported) is a copy/paste of some of 6 | ### the functions in S4Vectors but it doesn't really belong to BiocGenerics. 7 | ### It seems that the only reason for having it duplicated here is that it's 8 | ### used by the stuff in the update-utils.R file. However the stuff in 9 | ### update-utils.R doesn't really belong to BiocGenerics either! 10 | ### 11 | ### TODO: This stuff would need to be moved to a more appropriate place (when 12 | ### we have one), and then we should get rid of the duplication between the 13 | ### functions below and the same functions in S4Vectors. 14 | 15 | ### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 16 | ### For checking only. 17 | ### 18 | 19 | isTRUEorFALSE <- function(x) 20 | { 21 | is.logical(x) && length(x) == 1L && !is.na(x) 22 | } 23 | 24 | ### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 25 | ### Handling variadic calls 26 | ### 27 | 28 | extraArgsAsList <- function(.valid.argnames, ...) 29 | { 30 | args <- list(...) 31 | argnames <- names(args) 32 | if (length(args) != 0L 33 | && (is.null(argnames) || any(argnames %in% c("", NA)))) 34 | stop("all extra arguments must be named") 35 | if (!is.null(.valid.argnames) && !all(argnames %in% .valid.argnames)) 36 | stop("valid extra argument names are ", 37 | paste("'", .valid.argnames, "'", sep="", collapse=", ")) 38 | if (anyDuplicated(argnames)) 39 | stop("argument names must be unique") 40 | args 41 | } 42 | -------------------------------------------------------------------------------- /man/mad.Rd: -------------------------------------------------------------------------------- 1 | \name{mad} 2 | 3 | \alias{mad} 4 | 5 | \title{Median Absolute Deviation} 6 | 7 | \description{ 8 | Compute the median absolute deviation for a vector, dispatching only 9 | on the first argument, \code{x}. 10 | 11 | NOTE: This man page is for the \code{mad} \emph{S4 generic function} 12 | defined in the \pkg{BiocGenerics} package. 13 | See \code{?stats::\link[stats]{mad}} for the default method 14 | (defined in the \pkg{stats} package). 15 | Bioconductor packages can define specific methods for objects 16 | not supported by the default method. 17 | } 18 | 19 | \usage{ 20 | mad(x, center = median(x), constant = 1.4826, 21 | na.rm = FALSE, low = FALSE, high = FALSE) 22 | } 23 | 24 | \arguments{ 25 | \item{x, center, constant, na.rm, low, high}{ 26 | See \code{?stats::\link[stats]{mad}}. 27 | } 28 | } 29 | 30 | \value{ 31 | See \code{?stats::\link[stats]{mad}} for the value returned by the 32 | default method. 33 | 34 | Specific methods defined in Bioconductor packages should 35 | behave as consistently as possible with the default method. 36 | } 37 | 38 | \seealso{ 39 | \itemize{ 40 | \item \code{stats::\link[stats]{mad}} for the default 41 | \code{mad} method. 42 | 43 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 44 | methods defined for a given generic function. 45 | 46 | \item \code{\link[methods]{selectMethod}} for getting the definition of 47 | a specific method. 48 | 49 | \item \link{BiocGenerics} for a summary of all the generics defined 50 | in the \pkg{BiocGenerics} package. 51 | } 52 | } 53 | 54 | \examples{ 55 | mad 56 | showMethods("mad") 57 | selectMethod("mad", "ANY") # the default method 58 | } 59 | 60 | \keyword{methods} 61 | -------------------------------------------------------------------------------- /man/residuals.Rd: -------------------------------------------------------------------------------- 1 | \name{residuals} 2 | 3 | \alias{residuals} 4 | 5 | \title{Extract model residuals} 6 | 7 | \description{ 8 | \code{residuals} is a generic function which extracts model residuals 9 | from objects returned by modeling functions. 10 | 11 | NOTE: This man page is for the \code{residuals} \emph{S4 generic function} 12 | defined in the \pkg{BiocGenerics} package. 13 | See \code{?stats::\link[stats]{residuals}} for the default method 14 | (defined in the \pkg{stats} package). 15 | Bioconductor packages can define specific methods for objects 16 | not supported by the default method. 17 | } 18 | 19 | \usage{ 20 | residuals(object, ...) 21 | } 22 | 23 | \arguments{ 24 | \item{object, ...}{ 25 | See \code{?stats::\link[stats]{residuals}}. 26 | } 27 | } 28 | 29 | \value{ 30 | Residuals extracted from the object \code{object}. 31 | } 32 | 33 | \seealso{ 34 | \itemize{ 35 | \item \code{stats::\link[stats]{residuals}} for the default 36 | \code{residuals} method. 37 | 38 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 39 | methods defined for a given generic function. 40 | 41 | \item \code{\link[methods]{selectMethod}} for getting the definition of 42 | a specific method. 43 | 44 | \item \link[affyPLM]{residuals,PLMset-method} in the \pkg{affyPLM} package 45 | for an example of a specific \code{residuals} method (defined for 46 | \link[affyPLM]{PLMset} objects). 47 | 48 | \item \link{BiocGenerics} for a summary of all the generics defined 49 | in the \pkg{BiocGenerics} package. 50 | } 51 | } 52 | 53 | \examples{ 54 | residuals 55 | showMethods("residuals") 56 | selectMethod("residuals", "ANY") # the default method 57 | } 58 | 59 | \keyword{methods} 60 | -------------------------------------------------------------------------------- /man/format.Rd: -------------------------------------------------------------------------------- 1 | \name{format} 2 | 3 | \alias{format} 4 | \alias{format.list} 5 | 6 | \title{Format an R object for pretty printing} 7 | 8 | \description{ 9 | Turn an R object into a character vector used for pretty printing. 10 | 11 | NOTE: This man page is for the \code{format} \emph{S4 generic function} 12 | defined in the \pkg{BiocGenerics} package. 13 | See \code{?base::\link[base]{format}} for the default method 14 | (defined in the \pkg{base} package). 15 | Bioconductor packages can define specific methods for objects 16 | not supported by the default method. 17 | } 18 | 19 | \usage{ 20 | format(x, ...) 21 | } 22 | 23 | \arguments{ 24 | \item{x}{ 25 | The object to format. 26 | } 27 | \item{...}{ 28 | Additional arguments, for use in specific methods. 29 | } 30 | } 31 | 32 | \value{ 33 | A character vector that provides a "compact representation" of \code{x}. 34 | This character vector is typically used by \code{print.data.frame} to 35 | display the columns of a data.frame object. 36 | See \code{?base::\link[base]{print.data.frame}} for more information. 37 | } 38 | 39 | \seealso{ 40 | \itemize{ 41 | \item \code{base::\link[base]{format}} for the default \code{format} 42 | method. 43 | 44 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 45 | methods defined for a given generic function. 46 | 47 | \item \code{\link[methods]{selectMethod}} for getting the definition of 48 | a specific method. 49 | 50 | \item \link{BiocGenerics} for a summary of all the generics defined 51 | in the \pkg{BiocGenerics} package. 52 | } 53 | } 54 | 55 | \examples{ 56 | format 57 | showMethods("format") 58 | selectMethod("format", "ANY") # the default method 59 | } 60 | 61 | \keyword{methods} 62 | -------------------------------------------------------------------------------- /man/normalize.Rd: -------------------------------------------------------------------------------- 1 | \name{normalize} 2 | 3 | \alias{normalize} 4 | 5 | \title{Normalize an object} 6 | 7 | \description{ 8 | A generic function which normalizes an object containing microarray data 9 | or other data. 10 | Normalization is intended to remove from the intensity measures any 11 | systematic trends which arise from the microarray technology rather than 12 | from differences between the probes or between the target RNA samples 13 | hybridized to the arrays. 14 | } 15 | 16 | \usage{ 17 | normalize(object, ...) 18 | } 19 | 20 | \arguments{ 21 | \item{object}{ 22 | A data object, typically containing microarray data. 23 | } 24 | \item{...}{ 25 | Additional arguments, for use in specific methods. 26 | } 27 | } 28 | 29 | \value{ 30 | An object containing the normalized data. 31 | } 32 | 33 | \seealso{ 34 | \itemize{ 35 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 36 | methods defined for a given generic function. 37 | 38 | \item \code{\link[methods]{selectMethod}} for getting the definition of 39 | a specific method. 40 | 41 | \item \link[affy]{normalize,AffyBatch-method} in the \pkg{affy} 42 | package and \link[MSnbase]{normalize,MSnExp-method} in the 43 | \pkg{MSnbase} package for examples of specific \code{normalize} 44 | methods (defined for \link[affy]{AffyBatch} and 45 | \link[MSnbase]{MSnExp} objects, respectively). 46 | 47 | \item \link{BiocGenerics} for a summary of all the generics defined 48 | in the \pkg{BiocGenerics} package. 49 | } 50 | } 51 | 52 | \examples{ 53 | normalize 54 | showMethods("normalize") 55 | 56 | library(affy) 57 | showMethods("normalize") 58 | selectMethod("normalize", "AffyBatch") 59 | } 60 | 61 | \keyword{methods} 62 | -------------------------------------------------------------------------------- /man/t.Rd: -------------------------------------------------------------------------------- 1 | \name{t} 2 | 3 | \alias{t} 4 | 5 | \title{Matrix Transpose} 6 | 7 | \description{ 8 | Given a rectangular object \code{x}, \code{t} returns the 9 | transpose of \code{x}. 10 | 11 | NOTE: This man page is for the \code{t} \emph{S4 generic function} 12 | defined in the \pkg{BiocGenerics} package. 13 | See \code{?base::\link[base]{t}} for the default method 14 | (defined in the \pkg{base} package). 15 | Bioconductor packages can define specific methods for objects 16 | (typically array-like) not supported by the default method. 17 | } 18 | 19 | \usage{ 20 | t(x) 21 | } 22 | 23 | \arguments{ 24 | \item{x}{ 25 | A matrix-like or other rectangular object. 26 | } 27 | } 28 | 29 | \value{ 30 | See \code{?base::\link[base]{t}} for the value returned by the 31 | default method. 32 | 33 | Specific methods defined in Bioconductor packages will typically 34 | return an object of the same class as the input object. 35 | } 36 | 37 | \seealso{ 38 | \itemize{ 39 | \item \code{base::\link[base]{t}} for the default \code{t} method. 40 | 41 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 42 | methods defined for a given generic function. 43 | 44 | \item \code{\link[methods]{selectMethod}} for getting the definition of 45 | a specific method. 46 | 47 | \item \link[S4Vectors]{t,Hits-method} in the \pkg{S4Vectors} package 48 | for an example of a specific \code{t} method (defined for 49 | \link[S4Vectors]{Hits} objects). 50 | 51 | \item \link{BiocGenerics} for a summary of all the generics defined 52 | in the \pkg{BiocGenerics} package. 53 | } 54 | } 55 | 56 | \examples{ 57 | t 58 | showMethods("t") 59 | selectMethod("t", "ANY") # the default method 60 | } 61 | 62 | \keyword{methods} 63 | -------------------------------------------------------------------------------- /man/as.list.Rd: -------------------------------------------------------------------------------- 1 | \name{as.list} 2 | 3 | \alias{as.list} 4 | 5 | \title{Coerce to a list} 6 | 7 | \description{ 8 | Generic function to coerce to a list, if possible. 9 | 10 | NOTE: This man page is for the \code{as.list} \emph{S4 generic function} 11 | defined in the \pkg{BiocGenerics} package. 12 | See \code{?base::\link[base]{as.list}} for the default method 13 | (defined in the \pkg{base} package). 14 | Bioconductor packages can define specific methods for objects 15 | not supported by the default method. 16 | } 17 | 18 | \usage{ 19 | as.list(x, ...) 20 | } 21 | 22 | \arguments{ 23 | \item{x}{ 24 | The object to coerce. 25 | } 26 | \item{...}{ 27 | Additional arguments, for use in specific methods. 28 | } 29 | } 30 | 31 | \value{ 32 | An ordinary list. 33 | } 34 | 35 | \seealso{ 36 | \itemize{ 37 | \item \code{base::\link[base]{as.list}} for the default \code{as.list} 38 | method. 39 | 40 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 41 | methods defined for a given generic function. 42 | 43 | \item \code{\link[methods]{selectMethod}} for getting the definition of 44 | a specific method. 45 | 46 | \item \link[S4Vectors]{as.list,List-method} in the \pkg{S4Vectors} 47 | package for an example of a specific \code{as.list} method 48 | (defined for \link[S4Vectors]{List} objects). 49 | 50 | \item \link{BiocGenerics} for a summary of all the generics defined 51 | in the \pkg{BiocGenerics} package. 52 | } 53 | } 54 | 55 | \examples{ 56 | as.list 57 | showMethods("as.list") 58 | selectMethod("as.list", "ANY") # the default method 59 | 60 | library(S4Vectors) 61 | showMethods("as.list") 62 | ## The as.list() method for List objects: 63 | selectMethod("as.list", "List") 64 | } 65 | 66 | \keyword{methods} 67 | -------------------------------------------------------------------------------- /man/mean.Rd: -------------------------------------------------------------------------------- 1 | \name{mean} 2 | 3 | \alias{mean} 4 | 5 | \title{Arithmetic Mean} 6 | 7 | \description{ 8 | Generic function for the (trimmed) arithmetic mean. 9 | 10 | NOTE: This man page is for the \code{mean} \emph{S4 generic function} 11 | defined in the \pkg{BiocGenerics} package. 12 | See \code{?base::\link[base]{mean}} for the default method 13 | (defined in the \pkg{base} package). 14 | Bioconductor packages can define specific methods for objects 15 | (typically vector-like) not supported by the default method. 16 | } 17 | 18 | \usage{ 19 | mean(x, ...) 20 | } 21 | 22 | \arguments{ 23 | \item{x}{ 24 | typically a vector-like object 25 | } 26 | \item{...}{ 27 | see \code{\link[base]{mean}} 28 | } 29 | } 30 | 31 | \value{ 32 | See \code{?base::\link[base]{mean}} for the value returned by the 33 | default method. 34 | 35 | Specific methods defined in Bioconductor packages will typically 36 | return an object of the same class as the input object. 37 | } 38 | 39 | \seealso{ 40 | \itemize{ 41 | \item \code{base::\link[base]{mean}} for the default \code{mean} method. 42 | 43 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 44 | methods defined for a given generic function. 45 | 46 | \item \code{\link[methods]{selectMethod}} for getting the definition of 47 | a specific method. 48 | 49 | \item \link[S4Vectors]{mean,Rle-method} in the \pkg{S4Vectors} package 50 | for an example of a specific \code{mean} method (defined for 51 | \link[S4Vectors]{Rle} objects). 52 | 53 | \item \link{BiocGenerics} for a summary of all the generics defined 54 | in the \pkg{BiocGenerics} package. 55 | } 56 | } 57 | 58 | \examples{ 59 | mean 60 | showMethods("mean") 61 | selectMethod("mean", "ANY") # the default method 62 | } 63 | 64 | \keyword{methods} 65 | -------------------------------------------------------------------------------- /man/density.Rd: -------------------------------------------------------------------------------- 1 | \name{density} 2 | 3 | \alias{density} 4 | 5 | \title{Kernel density estimation} 6 | 7 | \description{ 8 | The generic function \code{density} computes kernel density 9 | estimates. 10 | 11 | NOTE: This man page is for the \code{density} \emph{S4 generic function} 12 | defined in the \pkg{BiocGenerics} package. 13 | See \code{?stats::\link[stats]{density}} for the default method 14 | (defined in the \pkg{stats} package). 15 | Bioconductor packages can define specific methods for objects 16 | not supported by the default method. 17 | } 18 | 19 | \usage{ 20 | density(x, ...) 21 | } 22 | 23 | \arguments{ 24 | \item{x, ...}{ 25 | See \code{?stats::\link[stats]{density}}. 26 | } 27 | } 28 | 29 | \value{ 30 | See \code{?stats::\link[stats]{density}} for the value returned by the 31 | default method. 32 | 33 | Specific methods defined in Bioconductor packages should 34 | behave as consistently as possible with the default method. 35 | } 36 | 37 | \seealso{ 38 | \itemize{ 39 | \item \code{stats::\link[stats]{density}} for the default \code{density} 40 | method. 41 | 42 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 43 | methods defined for a given generic function. 44 | 45 | \item \code{\link[methods]{selectMethod}} for getting the definition of 46 | a specific method. 47 | 48 | \item \link[flowClust]{density,flowClust-method} in the \pkg{flowClust} 49 | package for an example of a specific \code{density} method (defined 50 | for \link[flowClust]{flowClust} objects). 51 | 52 | \item \link{BiocGenerics} for a summary of all the generics defined 53 | in the \pkg{BiocGenerics} package. 54 | } 55 | } 56 | 57 | \examples{ 58 | density 59 | showMethods("density") 60 | selectMethod("density", "ANY") # the default method 61 | } 62 | 63 | \keyword{methods} 64 | -------------------------------------------------------------------------------- /man/var.Rd: -------------------------------------------------------------------------------- 1 | \name{var} 2 | 3 | \alias{var} 4 | \alias{sd} 5 | 6 | \title{Variance and Standard Deviation} 7 | 8 | \description{ 9 | \code{var} and \code{sd} compute the variance and standard deviation 10 | of a vector \code{x}. 11 | 12 | NOTE: This man page is for the \code{var} and \code{sd}, 13 | \emph{S4 generic functions} defined in the \pkg{BiocGenerics} package. 14 | See \code{?stats::\link[stats]{var}} and \code{?stats::\link[stats]{sd}} 15 | for the default methods (defined in the \pkg{stats} package). 16 | Bioconductor packages can define specific methods for objects 17 | (typically array-like) not supported by the default method. 18 | } 19 | 20 | \usage{ 21 | var(x, y = NULL, na.rm = FALSE, use) 22 | sd(x, na.rm = FALSE) 23 | } 24 | 25 | \arguments{ 26 | \item{x}{ 27 | a vector-like object 28 | } 29 | \item{y}{ 30 | a vector-like object, or \code{NULL} 31 | } 32 | \item{na.rm, use}{see \link[stats]{var}} 33 | } 34 | 35 | \value{ 36 | See \code{?stats::\link[stats]{var}} and \code{?stats::\link[stats]{sd}} 37 | for the value returned by the default methods. 38 | 39 | Specific methods defined in Bioconductor packages will typically 40 | return an object of the same class as the input object. 41 | } 42 | 43 | \seealso{ 44 | \itemize{ 45 | \item \code{stats::\link[stats]{var}} and \code{stats::\link[stats]{sd}} 46 | for the default methods. 47 | 48 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 49 | methods defined for a given generic function. 50 | 51 | \item \code{\link[methods]{selectMethod}} for getting the definition of 52 | a specific method. 53 | 54 | \item \link{BiocGenerics} for a summary of all the generics defined 55 | in the \pkg{BiocGenerics} package. 56 | } 57 | } 58 | 59 | \examples{ 60 | var 61 | showMethods("var") 62 | selectMethod("var", "ANY") # the default method 63 | } 64 | 65 | \keyword{methods} 66 | -------------------------------------------------------------------------------- /man/weights.Rd: -------------------------------------------------------------------------------- 1 | \name{weights} 2 | 3 | \alias{weights} 4 | 5 | \title{Extract model weights} 6 | 7 | \description{ 8 | \code{weights} is a generic function which extracts fitting weights 9 | from objects returned by modeling functions. 10 | 11 | NOTE: This man page is for the \code{weights} \emph{S4 generic function} 12 | defined in the \pkg{BiocGenerics} package. 13 | See \code{?stats::\link[stats]{weights}} for the default method 14 | (defined in the \pkg{stats} package). 15 | Bioconductor packages can define specific methods for objects 16 | not supported by the default method. 17 | } 18 | 19 | \usage{ 20 | weights(object, ...) 21 | } 22 | 23 | \arguments{ 24 | \item{object, ...}{ 25 | See \code{?stats::\link[stats]{weights}}. 26 | } 27 | } 28 | 29 | \value{ 30 | Weights extracted from the object \code{object}. 31 | 32 | See \code{?stats::\link[stats]{weights}} for the value returned by the 33 | default method. 34 | 35 | Specific methods defined in Bioconductor packages should 36 | behave as consistently as possible with the default method. 37 | } 38 | 39 | \seealso{ 40 | \itemize{ 41 | \item \code{stats::\link[stats]{weights}} for the default \code{weights} 42 | method. 43 | 44 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 45 | methods defined for a given generic function. 46 | 47 | \item \code{\link[methods]{selectMethod}} for getting the definition of 48 | a specific method. 49 | 50 | \item \link[affyPLM]{weights,PLMset-method} in the \pkg{affyPLM} package 51 | for an example of a specific \code{weights} method (defined for 52 | \link[affyPLM]{PLMset} objects). 53 | 54 | \item \link{BiocGenerics} for a summary of all the generics defined 55 | in the \pkg{BiocGenerics} package. 56 | } 57 | } 58 | 59 | \examples{ 60 | weights 61 | showMethods("weights") 62 | selectMethod("weights", "ANY") # the default method 63 | } 64 | 65 | \keyword{methods} 66 | -------------------------------------------------------------------------------- /man/rep.Rd: -------------------------------------------------------------------------------- 1 | \name{rep} 2 | 3 | \alias{rep.int} 4 | 5 | \title{Replicate elements of a vector-like object} 6 | 7 | \description{ 8 | \code{rep.int} replicates the elements in \code{x}. 9 | 10 | NOTE: This man page is for the \code{rep.int} \emph{S4 generic function} 11 | defined in the \pkg{BiocGenerics} package. 12 | See \code{?base::\link[base]{rep.int}} for the default method 13 | (defined in the \pkg{base} package). 14 | Bioconductor packages can define specific methods for objects 15 | (typically vector-like) not supported by the default method. 16 | } 17 | 18 | \usage{ 19 | rep.int(x, times) 20 | } 21 | 22 | \arguments{ 23 | \item{x}{ 24 | The object to replicate (typically vector-like). 25 | } 26 | \item{times}{ 27 | See \code{?base::\link[base]{rep.int}} for a description of 28 | this argument. 29 | } 30 | } 31 | 32 | \value{ 33 | See \code{?base::\link[base]{rep.int}} for the value returned by the 34 | default method. 35 | 36 | Specific methods defined in Bioconductor packages will typically 37 | return an object of the same class as the input object. 38 | } 39 | 40 | \seealso{ 41 | \itemize{ 42 | \item \code{base::\link[base]{rep.int}} for the default \code{rep.int} 43 | method. 44 | 45 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 46 | methods defined for a given generic function. 47 | 48 | \item \code{\link[methods]{selectMethod}} for getting the definition of 49 | a specific method. 50 | 51 | \item \link[S4Vectors]{rep.int,Rle-method} in the \pkg{S4Vectors} package 52 | for an example of a specific \code{rep.int} method (defined for 53 | \link[S4Vectors]{Rle} objects). 54 | 55 | \item \link{BiocGenerics} for a summary of all the generics defined 56 | in the \pkg{BiocGenerics} package. 57 | } 58 | } 59 | 60 | \examples{ 61 | rep.int 62 | showMethods("rep.int") 63 | selectMethod("rep.int", "ANY") # the default method 64 | } 65 | 66 | \keyword{methods} 67 | -------------------------------------------------------------------------------- /man/boxplot.Rd: -------------------------------------------------------------------------------- 1 | \name{boxplot} 2 | 3 | \alias{boxplot} 4 | 5 | \title{Box plots} 6 | 7 | \description{ 8 | Produce box-and-whisker plot(s) of the given (grouped) values. 9 | 10 | NOTE: This man page is for the \code{boxplot} \emph{S4 generic function} 11 | defined in the \pkg{BiocGenerics} package. 12 | See \code{?graphics::\link[graphics]{boxplot}} for the default method 13 | (defined in the \pkg{graphics} package). 14 | Bioconductor packages can define specific methods for objects 15 | not supported by the default method. 16 | } 17 | 18 | \usage{ 19 | boxplot(x, ...) 20 | } 21 | 22 | \arguments{ 23 | \item{x, ...}{ 24 | See \code{?graphics::\link[graphics]{boxplot}}. 25 | } 26 | } 27 | 28 | \value{ 29 | See \code{?graphics::\link[graphics]{boxplot}} for the value returned by the 30 | default method. 31 | 32 | Specific methods defined in Bioconductor packages should 33 | behave as consistently as possible with the default method. 34 | } 35 | 36 | \seealso{ 37 | \itemize{ 38 | \item \code{graphics::\link[graphics]{boxplot}} for the default 39 | \code{boxplot} method. 40 | 41 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 42 | methods defined for a given generic function. 43 | 44 | \item \code{\link[methods]{selectMethod}} for getting the definition of 45 | a specific method. 46 | 47 | \item \link[affy]{boxplot,AffyBatch-method} in the \pkg{affy} package 48 | for an example of a specific \code{boxplot} method (defined for 49 | \link[affy]{AffyBatch} objects). 50 | 51 | \item \link{BiocGenerics} for a summary of all the generics defined 52 | in the \pkg{BiocGenerics} package. 53 | } 54 | } 55 | 56 | \examples{ 57 | boxplot 58 | showMethods("boxplot") 59 | selectMethod("boxplot", "ANY") # the default method 60 | 61 | library(affy) 62 | showMethods("boxplot") 63 | ## The boxplot() method for AffyBatch objects: 64 | selectMethod("boxplot", "AffyBatch") 65 | } 66 | 67 | \keyword{methods} 68 | -------------------------------------------------------------------------------- /man/relist.Rd: -------------------------------------------------------------------------------- 1 | \name{relist} 2 | 3 | \alias{relist} 4 | 5 | \title{Re-listing an unlist()ed object} 6 | 7 | \description{ 8 | \code{relist} is a generic function with a few methods in order to allow 9 | easy inversion of \code{unlist(x)}. 10 | 11 | NOTE: This man page is for the \code{relist} \emph{S4 generic function} 12 | defined in the \pkg{BiocGenerics} package. 13 | See \code{?utils::\link[utils]{relist}} for the default method 14 | (defined in the \pkg{utils} package). 15 | Bioconductor packages can define specific methods for objects 16 | not supported by the default method. 17 | } 18 | 19 | \usage{ 20 | relist(flesh, skeleton) 21 | } 22 | 23 | \arguments{ 24 | \item{flesh}{ 25 | A vector-like object. 26 | } 27 | \item{skeleton}{ 28 | A list-like object. Only the "shape" (i.e. the lengths of the individual 29 | list elements) of \code{skeleton} matters. Its exact content is ignored. 30 | } 31 | } 32 | 33 | \value{ 34 | A list-like object with the same "shape" as \code{skeleton} and that would 35 | give \code{flesh} back if unlist()ed. 36 | } 37 | 38 | \seealso{ 39 | \itemize{ 40 | \item \code{utils::\link[utils]{relist}} for the default \code{relist} 41 | method. 42 | 43 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 44 | methods defined for a given generic function. 45 | 46 | \item \code{\link[methods]{selectMethod}} for getting the definition of 47 | a specific method. 48 | 49 | \item \link[IRanges]{relist,ANY,List-method} in the \pkg{IRanges} 50 | package for an example of a specific \code{relist} method (defined 51 | for when \code{skeleton} is a \link[S4Vectors]{List} object). 52 | 53 | \item \link{BiocGenerics} for a summary of all the generics defined 54 | in the \pkg{BiocGenerics} package. 55 | } 56 | } 57 | 58 | \examples{ 59 | relist 60 | showMethods("relist") 61 | selectMethod("relist", c("ANY", "ANY")) # the default method 62 | } 63 | 64 | \keyword{methods} 65 | -------------------------------------------------------------------------------- /man/table.Rd: -------------------------------------------------------------------------------- 1 | \name{table} 2 | 3 | \alias{table} 4 | 5 | \title{Cross tabulation and table creation} 6 | 7 | \description{ 8 | \code{table} uses the cross-classifying factors to build a contingency 9 | table of the counts at each combination of factor levels. 10 | 11 | NOTE: This man page is for the \code{table} \emph{S4 generic function} 12 | defined in the \pkg{BiocGenerics} package. 13 | See \code{?base::\link[base]{table}} for the default method 14 | (defined in the \pkg{base} package). 15 | Bioconductor packages can define specific methods for objects 16 | not supported by the default method. 17 | } 18 | 19 | \usage{ 20 | table(...) 21 | } 22 | 23 | \arguments{ 24 | \item{...}{ 25 | One or more objects which can be interpreted as factors 26 | (including character strings), or a list (or data frame) 27 | whose components can be so interpreted. 28 | } 29 | } 30 | 31 | \value{ 32 | See \code{?base::\link[base]{table}} for the value returned by the 33 | default method. 34 | 35 | Specific methods defined in Bioconductor packages should also 36 | return the type of object returned by the default method. 37 | } 38 | 39 | \seealso{ 40 | \itemize{ 41 | \item \code{base::\link[base]{table}} for the default \code{table} method. 42 | 43 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 44 | methods defined for a given generic function. 45 | 46 | \item \code{\link[methods]{selectMethod}} for getting the definition of 47 | a specific method. 48 | 49 | \item \link[S4Vectors]{table,Rle-method} in the \pkg{S4Vectors} package 50 | for an example of a specific \code{table} method (defined for 51 | \link[S4Vectors]{Rle} objects). 52 | 53 | \item \link{BiocGenerics} for a summary of all the generics defined 54 | in the \pkg{BiocGenerics} package. 55 | } 56 | } 57 | 58 | \examples{ 59 | table 60 | showMethods("table") 61 | selectMethod("table", "ANY") # the default method 62 | } 63 | 64 | \keyword{methods} 65 | -------------------------------------------------------------------------------- /man/aperm.Rd: -------------------------------------------------------------------------------- 1 | \name{aperm} 2 | 3 | \alias{aperm} 4 | 5 | \title{Transposing an array-like object} 6 | 7 | \description{ 8 | Transpose an array-like object by permuting its dimensions. 9 | 10 | This is a multidimensional generalization of the 11 | \code{\link[BiocGenerics]{t}()} operator used for 2D-transposition. 12 | 13 | NOTE: This man page is for the \code{aperm} 14 | \emph{S4 generic function} defined in the \pkg{BiocGenerics} package. 15 | See \code{?base::\link[base]{aperm}} for the default method 16 | (defined in the \pkg{base} package). 17 | Bioconductor packages can define specific methods for objects 18 | not supported by the default method. 19 | } 20 | 21 | \usage{ 22 | aperm(a, perm, ...) 23 | } 24 | 25 | \arguments{ 26 | \item{a}{ 27 | An array-like object. 28 | } 29 | \item{perm, ...}{ 30 | See \code{?base::\link[base]{aperm}} for a description of 31 | these arguments. 32 | } 33 | } 34 | 35 | \value{ 36 | A transposed version of array-like object \code{a}, with subscripts 37 | permuted as indicated by the \code{perm} vector. 38 | } 39 | 40 | \seealso{ 41 | \itemize{ 42 | \item \code{base::\link[base]{aperm}} for the default 43 | \code{aperm} method. 44 | 45 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 46 | methods defined for a given generic function. 47 | 48 | \item \code{\link[methods]{selectMethod}} for getting the definition of 49 | a specific method. 50 | 51 | \item \link[SparseArray]{aperm,SVT_SparseArray-method} in the 52 | \pkg{SparseArray} package for an example of a specific 53 | \code{aperm} method (defined for \link[SparseArray]{SVT_SparseArray} 54 | objects). 55 | 56 | \item \link{BiocGenerics} for a summary of all the generics defined 57 | in the \pkg{BiocGenerics} package. 58 | } 59 | } 60 | 61 | \examples{ 62 | aperm # note the dispatch on the 'a' arg only 63 | showMethods("aperm") 64 | selectMethod("aperm", "ANY") # the default method 65 | } 66 | 67 | \keyword{methods} 68 | -------------------------------------------------------------------------------- /man/paste.Rd: -------------------------------------------------------------------------------- 1 | \name{paste} 2 | 3 | \alias{paste} 4 | 5 | \title{Concatenate strings} 6 | 7 | \description{ 8 | \code{paste} concatenates vectors of strings or vector-like 9 | objects containing strings. 10 | 11 | NOTE: This man page is for the \code{paste} \emph{S4 generic function} 12 | defined in the \pkg{BiocGenerics} package. 13 | See \code{?base::\link[base]{paste}} for the default method 14 | (defined in the \pkg{base} package). 15 | Bioconductor packages can define specific methods for objects 16 | (typically vector-like objects containing strings) not supported by 17 | the default method. 18 | } 19 | 20 | \usage{ 21 | paste(..., sep=" ", collapse=NULL, recycle0=FALSE) 22 | } 23 | 24 | \arguments{ 25 | \item{...}{ 26 | One or more vector-like objects containing strings. 27 | } 28 | \item{sep, collapse, recycle0}{ 29 | See \code{?base::\link[base]{paste}} for a description of 30 | these arguments. 31 | } 32 | } 33 | 34 | \value{ 35 | See \code{?base::\link[base]{paste}} for the value returned by the 36 | default method. 37 | 38 | Specific methods defined in Bioconductor packages will typically 39 | return an object of the same class as the input objects. 40 | } 41 | 42 | \seealso{ 43 | \itemize{ 44 | \item \code{base::\link[base]{paste}} for the default \code{paste} method. 45 | 46 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 47 | methods defined for a given generic function. 48 | 49 | \item \code{\link[methods]{selectMethod}} for getting the definition of 50 | a specific method. 51 | 52 | \item \link[S4Vectors]{paste,Rle-method} in the \pkg{S4Vectors} package 53 | for an example of a specific \code{paste} method (defined for 54 | \link[S4Vectors]{Rle} objects). 55 | 56 | \item \link{BiocGenerics} for a summary of all the generics defined 57 | in the \pkg{BiocGenerics} package. 58 | } 59 | } 60 | 61 | \examples{ 62 | paste 63 | showMethods("paste") 64 | selectMethod("paste", "ANY") # the default method 65 | } 66 | 67 | \keyword{methods} 68 | -------------------------------------------------------------------------------- /man/dge.Rd: -------------------------------------------------------------------------------- 1 | \name{dge} 2 | 3 | \alias{dge} 4 | 5 | \alias{counts} 6 | \alias{counts<-} 7 | \alias{design} 8 | \alias{design<-} 9 | \alias{dispTable} 10 | \alias{dispTable<-} 11 | \alias{sizeFactors} 12 | \alias{sizeFactors<-} 13 | \alias{conditions} 14 | \alias{conditions<-} 15 | \alias{estimateSizeFactors} 16 | \alias{estimateDispersions} 17 | \alias{plotDispEsts} 18 | 19 | \title{Accessors and generic functions used in the context of count datasets} 20 | 21 | \description{These generic functions provide basic interfaces to operations on 22 | and data access to count datasets.} 23 | 24 | \usage{ 25 | counts(object, ...) 26 | counts(object, ...) <- value 27 | design(object, ...) 28 | design(object, ...) <- value 29 | dispTable(object, ...) 30 | dispTable(object, ...) <- value 31 | sizeFactors(object, ...) 32 | sizeFactors(object, ...) <- value 33 | conditions(object, ...) 34 | conditions(object, ...) <- value 35 | estimateSizeFactors(object, ...) 36 | estimateDispersions(object, ...) 37 | plotDispEsts(object, ...) 38 | } 39 | 40 | \arguments{ 41 | \item{object}{Object of class for which methods are defined, e.g., 42 | \code{CountDataSet}, \code{DESeqSummarizedExperiment} or \code{ExonCountSet}.} 43 | \item{value}{Value to be assigned to corresponding components of 44 | \code{object}; supported types depend on method implementation.} 45 | \item{...}{Further arguments, perhaps used by metohds} 46 | } 47 | 48 | \details{For the details, please consult the manual pages of the 49 | methods in the \pkg{DESeq}, \pkg{DESeq2}, and \pkg{DEXSeq} packages and the package 50 | vignettes.} 51 | 52 | \author{W. Huber, S. Anders} 53 | 54 | \seealso{ 55 | \itemize{ 56 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 57 | methods defined for a given generic function. 58 | 59 | \item \code{\link[methods]{selectMethod}} for getting the definition of 60 | a specific method. 61 | 62 | \item \link{BiocGenerics} for a summary of all the generics defined 63 | in the \pkg{BiocGenerics} package. 64 | } 65 | } 66 | 67 | \keyword{manip} 68 | -------------------------------------------------------------------------------- /man/image.Rd: -------------------------------------------------------------------------------- 1 | \name{image} 2 | 3 | \alias{image} 4 | 5 | \title{Display a color image} 6 | 7 | \description{ 8 | Creates a grid of colored or gray-scale rectangles with colors 9 | corresponding to the values in \code{z}. 10 | This can be used to display three-dimensional or spatial data aka 11 | \emph{images}. 12 | 13 | NOTE: This man page is for the \code{image} \emph{S4 generic function} 14 | defined in the \pkg{BiocGenerics} package. 15 | See \code{?graphics::\link[graphics]{image}} for the default method 16 | (defined in the \pkg{graphics} package). 17 | Bioconductor packages can define specific methods for objects 18 | not supported by the default method. 19 | } 20 | 21 | \usage{ 22 | image(x, ...) 23 | } 24 | 25 | \arguments{ 26 | \item{x, ...}{ 27 | See \code{?graphics::\link[graphics]{image}}. 28 | } 29 | } 30 | 31 | \details{ 32 | See \code{?graphics::\link[graphics]{image}} for the details. 33 | 34 | Specific methods defined in Bioconductor packages should 35 | behave as consistently as possible with the default method. 36 | } 37 | 38 | \seealso{ 39 | \itemize{ 40 | \item \code{graphics::\link[graphics]{image}} for the default \code{image} 41 | method. 42 | 43 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 44 | methods defined for a given generic function. 45 | 46 | \item \code{\link[methods]{selectMethod}} for getting the definition of 47 | a specific method. 48 | 49 | \item \link[affy]{image,AffyBatch-method} in the \pkg{affy} package 50 | for an example of a specific \code{image} method (defined for 51 | \link[affy]{AffyBatch} objects). 52 | 53 | \item \link{BiocGenerics} for a summary of all the generics defined 54 | in the \pkg{BiocGenerics} package. 55 | } 56 | } 57 | 58 | \examples{ 59 | image 60 | showMethods("image") 61 | selectMethod("image", "ANY") # the default method 62 | 63 | library(affy) 64 | showMethods("image") 65 | ## The image() method for AffyBatch objects: 66 | selectMethod("image", "AffyBatch") 67 | } 68 | 69 | \keyword{methods} 70 | -------------------------------------------------------------------------------- /man/subset.Rd: -------------------------------------------------------------------------------- 1 | \name{subset} 2 | 3 | \alias{subset} 4 | 5 | \title{Subsetting vector-like, matrix-like and data-frame-like objects} 6 | 7 | \description{ 8 | Return subsets of vector-like, matrix-like or data-frame-like objects 9 | which meet conditions. 10 | 11 | NOTE: This man page is for the \code{subset} \emph{S4 generic function} 12 | defined in the \pkg{BiocGenerics} package. 13 | See \code{?base::\link[base]{subset}} for the \code{subset} S3 generic 14 | defined in the \pkg{base} package. 15 | } 16 | 17 | \usage{ 18 | subset(x, ...) 19 | } 20 | 21 | \arguments{ 22 | \item{x}{ 23 | A vector-like, matrix-like or data-frame-like object to be subsetted. 24 | } 25 | \item{...}{ 26 | Additional arguments (e.g. \code{subset}, \code{select}, \code{drop}), 27 | for use in specific methods. See \code{?base::\link[base]{subset}} for 28 | more information. 29 | } 30 | } 31 | 32 | \value{ 33 | An object similar to \code{x} containing just the selected elements (for a 34 | vector-like object), or the selected rows and columns (for a matrix-like or 35 | data-frame-like object). 36 | } 37 | 38 | \seealso{ 39 | \itemize{ 40 | \item \code{base::\link[base]{subset}} in the \pkg{base} package 41 | for the \code{subset} S3 generic. 42 | 43 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 44 | methods defined for a given generic function. 45 | 46 | \item \code{\link[methods]{selectMethod}} for getting the definition of 47 | a specific method. 48 | 49 | \item \link[S4Vectors]{subset,RectangularData-method} in the \pkg{S4Vectors} 50 | package for an example of a specific \code{subset} method (defined 51 | for \link[S4Vectors]{RectangularData} derivatives). 52 | 53 | \item \link{BiocGenerics} for a summary of all the generics defined 54 | in the \pkg{BiocGenerics} package. 55 | } 56 | } 57 | 58 | \examples{ 59 | subset 60 | showMethods("subset") 61 | selectMethod("subset", "ANY") # the default method 62 | 63 | library(S4Vectors) 64 | showMethods("subset") 65 | ## The subset() method for RectangularData derivatives: 66 | selectMethod("subset", "RectangularData") 67 | } 68 | 69 | \keyword{methods} 70 | -------------------------------------------------------------------------------- /man/mapply.Rd: -------------------------------------------------------------------------------- 1 | \name{mapply} 2 | 3 | \alias{mapply} 4 | 5 | \title{Apply a function to multiple list-like or vector-like arguments} 6 | 7 | \description{ 8 | \code{mapply} is a multivariate version of 9 | \code{\link[BiocGenerics]{sapply}}. \code{mapply} applies 10 | \code{FUN} to the first elements of each \code{...} argument, 11 | the second elements, the third elements, and so on. Arguments 12 | are recycled if necessary. 13 | 14 | NOTE: This man page is for the \code{mapply} \emph{S4 generic function} 15 | defined in the \pkg{BiocGenerics} package. 16 | See \code{?base::\link[base]{mapply}} for the default method 17 | (defined in the \pkg{base} package). 18 | Bioconductor packages can define specific methods for objects 19 | (typically list-like or vector-like) not supported by the 20 | default methods. 21 | } 22 | 23 | \usage{ 24 | mapply(FUN, ..., MoreArgs=NULL, SIMPLIFY=TRUE, USE.NAMES=TRUE) 25 | } 26 | 27 | \arguments{ 28 | \item{FUN, MoreArgs, SIMPLIFY, USE.NAMES}{ 29 | See \code{?base::\link[base]{mapply}} for a description of 30 | these arguments. 31 | } 32 | \item{...}{ 33 | One or more list-like or vector-like objects of strictly 34 | positive length, or all of zero length. 35 | } 36 | } 37 | 38 | \value{ 39 | See \code{?base::\link[base]{mapply}} for the value returned by the 40 | default method. 41 | 42 | Specific methods defined in Bioconductor packages should 43 | behave as consistently as possible with the default method. 44 | } 45 | 46 | \seealso{ 47 | \itemize{ 48 | \item \code{base::\link[base]{mapply}} for the default \code{mapply} 49 | method. 50 | 51 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 52 | methods defined for a given generic function. 53 | 54 | \item \code{\link[methods]{selectMethod}} for getting the definition of 55 | a specific method. 56 | 57 | \item \link{BiocGenerics} for a summary of all the generics defined 58 | in the \pkg{BiocGenerics} package. 59 | } 60 | } 61 | 62 | \examples{ 63 | mapply # note the dispatch on the '...' arg only 64 | showMethods("mapply") 65 | selectMethod("mapply", "ANY") # the default method 66 | } 67 | 68 | \keyword{methods} 69 | -------------------------------------------------------------------------------- /man/unlist.Rd: -------------------------------------------------------------------------------- 1 | \name{unlist} 2 | 3 | \alias{unlist} 4 | 5 | \title{Flatten list-like objects} 6 | 7 | \description{ 8 | Given a list-like object \code{x}, \code{unlist} produces a vector-like 9 | object obtained by concatenating (conceptually thru \code{\link{c}}) all 10 | the top-level elements in \code{x} (each of them being expected to be 11 | a vector-like object, typically). 12 | 13 | NOTE: This man page is for the \code{unlist} 14 | \emph{S4 generic function} defined in the \pkg{BiocGenerics} package. 15 | See \code{?base::\link[base]{unlist}} for the default method 16 | (defined in the \pkg{base} package). 17 | Bioconductor packages can define specific methods for objects 18 | not supported by the default method. 19 | } 20 | 21 | \usage{ 22 | unlist(x, recursive=TRUE, use.names=TRUE) 23 | } 24 | 25 | \arguments{ 26 | \item{x}{ 27 | A list-like object. 28 | } 29 | \item{recursive, use.names}{ 30 | See \code{?base::\link[base]{unlist}} for a description of 31 | these arguments. 32 | } 33 | } 34 | 35 | \value{ 36 | See \code{?base::\link[base]{unlist}} for the value returned 37 | by the default method. 38 | 39 | Specific methods defined in Bioconductor packages should 40 | behave as consistently as possible with the default method. 41 | } 42 | 43 | \seealso{ 44 | \itemize{ 45 | \item \code{base::\link[base]{unlist}} for the default 46 | \code{unlist} method. 47 | 48 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 49 | methods defined for a given generic function. 50 | 51 | \item \code{\link[methods]{selectMethod}} for getting the definition of 52 | a specific method. 53 | 54 | \item \link[S4Vectors]{unlist,List-method} in the \pkg{S4Vectors} package 55 | for an example of a specific \code{unlist} method (defined for 56 | \link[S4Vectors]{List} objects). 57 | 58 | \item \link{BiocGenerics} for a summary of all the generics defined 59 | in the \pkg{BiocGenerics} package. 60 | } 61 | } 62 | 63 | \examples{ 64 | unlist # note the dispatch on the 'x' arg only 65 | showMethods("unlist") 66 | selectMethod("unlist", "ANY") # the default method 67 | } 68 | 69 | \keyword{methods} 70 | -------------------------------------------------------------------------------- /man/grep.Rd: -------------------------------------------------------------------------------- 1 | \name{grep} 2 | 3 | \alias{grep} 4 | \alias{grepl} 5 | 6 | \title{Pattern Matching and Replacement} 7 | 8 | \description{ 9 | Search for matches to argument 'pattern' within each element of a character 10 | vector. 11 | 12 | NOTE: This man page is for the \code{grep} and \code{grepl} 13 | \emph{S4 generic functions} defined in the \pkg{BiocGenerics} package. 14 | See \code{?base::\link[base]{grep}} for the default methods 15 | (defined in the \pkg{base} package). 16 | Bioconductor packages can define specific methods for objects 17 | not supported by the default method. 18 | } 19 | 20 | \usage{ 21 | grep(pattern, x, ignore.case = FALSE, perl = FALSE, value = FALSE, 22 | fixed = FALSE, useBytes = FALSE, invert = FALSE) 23 | grepl(pattern, x, ignore.case = FALSE, perl = FALSE, 24 | fixed = FALSE, useBytes = FALSE) 25 | } 26 | 27 | \arguments{ 28 | \item{pattern}{ 29 | The pattern for searching in \code{x}, such as a regular expression. 30 | } 31 | \item{x}{ 32 | The character vector (in the general sense) to search. 33 | } 34 | \item{ignore.case, perl, value, fixed, useBytes, invert}{ 35 | See \code{?base::\link[base]{grep}} for a description of 36 | these arguments. 37 | } 38 | } 39 | 40 | \value{ 41 | See \code{?base::\link[base]{grep}} for the value returned 42 | by the default method. 43 | 44 | Specific methods defined in Bioconductor packages should 45 | behave as consistently as possible with the default method. 46 | } 47 | 48 | \seealso{ 49 | \itemize{ 50 | \item \code{base::\link[base]{grep}} for the default 51 | \code{grep} and \code{grepl} methods. 52 | 53 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 54 | methods defined for a given generic function. 55 | 56 | \item \code{\link[methods]{selectMethod}} for getting the definition of 57 | a specific method. 58 | 59 | \item \link{BiocGenerics} for a summary of all the generics defined 60 | in the \pkg{BiocGenerics} package. 61 | } 62 | } 63 | 64 | \examples{ 65 | grep # note the dispatch on 'pattern' and 'x' args only 66 | showMethods("grep") 67 | selectMethod("grep", "ANY") # the default method 68 | } 69 | 70 | \keyword{methods} 71 | -------------------------------------------------------------------------------- /man/nrow.Rd: -------------------------------------------------------------------------------- 1 | \name{nrow} 2 | 3 | \alias{nrow} 4 | \alias{ncol} 5 | \alias{NROW} 6 | \alias{NCOL} 7 | 8 | \title{The number of rows/columns of an array-like object} 9 | 10 | \description{ 11 | Return the number of rows or columns present in an array-like object. 12 | 13 | NOTE: This man page is for the \code{nrow}, \code{ncol}, \code{NROW} and 14 | \code{NCOL} \emph{S4 generic functions} defined in the \pkg{BiocGenerics} 15 | package. 16 | See \code{?base::\link[base]{nrow}} for the default methods (defined in 17 | the \pkg{base} package). 18 | Bioconductor packages can define specific methods for objects 19 | (typically matrix- or array-like) not supported by the default methods. 20 | } 21 | 22 | \usage{ 23 | nrow(x) 24 | ncol(x) 25 | NROW(x) 26 | NCOL(x) 27 | } 28 | 29 | \arguments{ 30 | \item{x}{ 31 | A matrix- or array-like object. 32 | } 33 | } 34 | 35 | \value{ 36 | A single integer or \code{NULL}. 37 | 38 | Specific methods defined in Bioconductor packages should 39 | behave as consistently as possible with the default methods. 40 | } 41 | 42 | \seealso{ 43 | \itemize{ 44 | \item \code{base::\link[base]{nrow}} for the default \code{nrow}, 45 | \code{ncol}, \code{NROW} and \code{NCOL} methods. 46 | 47 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 48 | methods defined for a given generic function. 49 | 50 | \item \code{\link[methods]{selectMethod}} for getting the definition of 51 | a specific method. 52 | 53 | \item \link[S4Vectors]{nrow,DataFrame-method} in the \pkg{S4Vectors} 54 | package for an example of a specific \code{nrow} method (defined 55 | for \link[S4Vectors]{DataFrame} objects). 56 | 57 | \item \link{BiocGenerics} for a summary of all the generics defined 58 | in the \pkg{BiocGenerics} package. 59 | } 60 | } 61 | 62 | \examples{ 63 | nrow 64 | showMethods("nrow") 65 | selectMethod("nrow", "ANY") # the default method 66 | 67 | ncol 68 | showMethods("ncol") 69 | selectMethod("ncol", "ANY") # the default method 70 | 71 | NROW 72 | showMethods("NROW") 73 | selectMethod("NROW", "ANY") # the default method 74 | 75 | NCOL 76 | showMethods("NCOL") 77 | selectMethod("NCOL", "ANY") # the default method 78 | } 79 | 80 | \keyword{methods} 81 | -------------------------------------------------------------------------------- /man/unsplit.Rd: -------------------------------------------------------------------------------- 1 | \name{unsplit} 2 | 3 | \alias{unsplit} 4 | 5 | \title{Unsplit a list-like object} 6 | 7 | \description{ 8 | Given a list-like object \code{value} and grouping \code{f}, 9 | \code{unsplit} produces a vector-like object \code{x} by conceptually 10 | reversing the split operation \code{value <- split(x, f)}. 11 | 12 | NOTE: This man page is for the \code{unsplit} 13 | \emph{S4 generic function} defined in the \pkg{BiocGenerics} package. 14 | See \code{?base::\link[base]{unsplit}} for the default method 15 | (defined in the \pkg{base} package). 16 | Bioconductor packages can define specific methods for objects 17 | not supported by the default method. 18 | } 19 | 20 | \usage{ 21 | unsplit(value, f, drop=FALSE) 22 | } 23 | 24 | \arguments{ 25 | \item{value}{ 26 | A list-like object. 27 | } 28 | \item{f}{ 29 | A factor or other grouping object that corresponds to the \code{f} 30 | symbol in \code{value <- split(x, f)}. 31 | } 32 | \item{drop}{ 33 | See \code{?base::\link[base]{unsplit}} for a description of 34 | this argument. 35 | } 36 | } 37 | 38 | \value{ 39 | See \code{?base::\link[base]{unsplit}} for the value returned 40 | by the default method. 41 | 42 | Specific methods defined in Bioconductor packages should 43 | behave as consistently as possible with the default method. 44 | } 45 | 46 | \seealso{ 47 | \itemize{ 48 | \item \code{base::\link[base]{unsplit}} for the default 49 | \code{unsplit} method. 50 | 51 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 52 | methods defined for a given generic function. 53 | 54 | \item \code{\link[methods]{selectMethod}} for getting the definition of 55 | a specific method. 56 | 57 | \item \link[IRanges]{unsplit,List-method} in the \pkg{IRanges} package 58 | for an example of a specific \code{unsplit} method (defined for 59 | \link[S4Vectors]{List} objects). 60 | 61 | \item \link{BiocGenerics} for a summary of all the generics defined 62 | in the \pkg{BiocGenerics} package. 63 | } 64 | } 65 | 66 | \examples{ 67 | unsplit # note the dispatch on the 'value' and 'f' args only 68 | showMethods("unsplit") 69 | selectMethod("unsplit", "ANY") # the default method 70 | } 71 | 72 | \keyword{methods} 73 | -------------------------------------------------------------------------------- /man/append.Rd: -------------------------------------------------------------------------------- 1 | \name{append} 2 | 3 | \alias{append} 4 | 5 | \title{Append elements to a vector-like object} 6 | 7 | \description{ 8 | Append (or insert) elements to (in) a vector-like object. 9 | 10 | NOTE: This man page is for the \code{append} \emph{S4 generic function} 11 | defined in the \pkg{BiocGenerics} package. 12 | See \code{?base::\link[base]{append}} for the default method 13 | (defined in the \pkg{base} package). 14 | Bioconductor packages can define specific methods for objects 15 | (typically vector-like or data-frame-like) not supported by the 16 | default method. 17 | } 18 | 19 | \usage{ 20 | append(x, values, after=length(x)) 21 | } 22 | 23 | \arguments{ 24 | \item{x}{ 25 | The vector-like object to be modified. 26 | } 27 | \item{values}{ 28 | The vector-like object containing the values to be appended to \code{x}. 29 | \code{values} would typically be of the same class as \code{x}, but not 30 | necessarily. 31 | } 32 | \item{after}{ 33 | A subscript, after which the values are to be appended. 34 | } 35 | } 36 | 37 | \value{ 38 | See \code{?base::\link[base]{append}} for the value returned by the 39 | default method. 40 | 41 | Specific methods defined in Bioconductor packages will typically 42 | return an object of the same class as \code{x} and of length 43 | \code{length(x) + length(values)}. 44 | } 45 | 46 | \seealso{ 47 | \itemize{ 48 | \item \code{base::\link[base]{append}} for the default \code{append} 49 | method. 50 | 51 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 52 | methods defined for a given generic function. 53 | 54 | \item \code{\link[methods]{selectMethod}} for getting the definition of 55 | a specific method. 56 | 57 | \item \link[S4Vectors]{append,Vector,Vector-method} in the \pkg{S4Vectors} 58 | package for an example of a specific \code{append} method (defined 59 | for \link[S4Vectors]{Vector} objects). 60 | 61 | \item \link{BiocGenerics} for a summary of all the generics defined 62 | in the \pkg{BiocGenerics} package. 63 | } 64 | } 65 | 66 | \examples{ 67 | append # note the dispatch on the 'x' and 'values' args only 68 | showMethods("append") 69 | selectMethod("append", c("ANY", "ANY")) # the default method 70 | } 71 | 72 | \keyword{methods} 73 | -------------------------------------------------------------------------------- /man/as.vector.Rd: -------------------------------------------------------------------------------- 1 | \name{as.vector} 2 | 3 | \alias{as.vector} 4 | 5 | \title{Coerce an object into a vector} 6 | 7 | \description{ 8 | Attempt to coerce an object into a vector of the specified mode. 9 | If the mode is not specified, attempt to coerce to whichever vector 10 | mode is considered more appropriate for the class of the supplied 11 | object. 12 | 13 | NOTE: This man page is for the \code{as.vector} 14 | \emph{S4 generic function} defined in the \pkg{BiocGenerics} package. 15 | See \code{?base::\link[base]{as.vector}} for the default method 16 | (defined in the \pkg{base} package). 17 | Bioconductor packages can define specific methods for objects 18 | not supported by the default method. 19 | } 20 | 21 | \usage{ 22 | as.vector(x, mode="any") 23 | } 24 | 25 | \arguments{ 26 | \item{x}{ 27 | The object to coerce. 28 | } 29 | \item{mode}{ 30 | See \code{?base::\link[base]{as.vector}} for a description of 31 | this argument. 32 | } 33 | } 34 | 35 | \value{ 36 | A vector. 37 | 38 | See \code{?base::\link[base]{as.vector}} for the value returned 39 | by the default method. 40 | 41 | Specific methods defined in Bioconductor packages should 42 | behave as consistently as possible with the default method. 43 | } 44 | 45 | \seealso{ 46 | \itemize{ 47 | \item \code{base::\link[base]{as.vector}} for the default 48 | \code{as.vector} method. 49 | 50 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 51 | methods defined for a given generic function. 52 | 53 | \item \code{\link[methods]{selectMethod}} for getting the definition of 54 | a specific method. 55 | 56 | \item \link[S4Vectors]{as.vector,Rle-method} in the \pkg{S4Vectors} 57 | package, and \link[IRanges]{as.vector,AtomicList-method} in 58 | the \pkg{IRanges} packages, for examples of specific 59 | \code{as.vector} methods (defined for \link[S4Vectors]{Rle} 60 | and \link[IRanges]{AtomicList} objects, respectively). 61 | 62 | \item \link{BiocGenerics} for a summary of all the generics defined 63 | in the \pkg{BiocGenerics} package. 64 | } 65 | } 66 | 67 | \examples{ 68 | as.vector # note the dispatch on the 'x' arg only 69 | showMethods("as.vector") 70 | selectMethod("as.vector", "ANY") # the default method 71 | } 72 | 73 | \keyword{methods} 74 | -------------------------------------------------------------------------------- /man/which.Rd: -------------------------------------------------------------------------------- 1 | \name{which} 2 | 3 | \alias{which} 4 | 5 | \title{Which values in an object are considered TRUE?} 6 | 7 | \description{ 8 | Give the indices of the values in a vector-, array-, or list-like object 9 | that are considered \code{TRUE}, allowing for array indices in the case 10 | of an array-like object. 11 | 12 | NOTE: This man page is for the \code{which} \emph{S4 generic function} 13 | defined in the \pkg{BiocGenerics} package. 14 | See \code{?base::\link[base]{which}} for the default method (defined 15 | in the \pkg{base} package). 16 | Bioconductor packages can define specific methods for objects (typically 17 | vector-, array-, or list-like) not supported by the default methods. 18 | } 19 | 20 | \usage{ 21 | which(x, arr.ind=FALSE, useNames=TRUE) 22 | } 23 | 24 | \arguments{ 25 | \item{x}{ 26 | An object, typically with a vector-, array-, or list-like semantic. 27 | } 28 | \item{arr.ind, useNames}{ 29 | See \code{?base::\link[base]{which}} for a description of 30 | these arguments. 31 | } 32 | } 33 | 34 | \value{ 35 | See \code{?base::\link[base]{which}} for the value returned 36 | by the default method. 37 | 38 | Specific methods defined in Bioconductor packages should 39 | behave as consistently as possible with the default method. 40 | } 41 | 42 | \seealso{ 43 | \itemize{ 44 | \item \code{base::\link[base]{which}} for the default \code{which} method. 45 | 46 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 47 | methods defined for a given generic function. 48 | 49 | \item \code{\link[methods]{selectMethod}} for getting the definition of 50 | a specific method. 51 | 52 | \item \link[DelayedArray]{which,DelayedArray-method} in the 53 | \pkg{DelayedArray} package for an example of a specific 54 | \code{which} method (defined for \link[DelayedArray]{DelayedArray} 55 | objects). 56 | 57 | \item \link{BiocGenerics} for a summary of all the generics defined 58 | in the \pkg{BiocGenerics} package. 59 | } 60 | } 61 | 62 | \examples{ 63 | which 64 | showMethods("which") 65 | selectMethod("which", "ANY") # the default method 66 | 67 | library(DelayedArray) 68 | showMethods("which") 69 | ## The which() method for DelayedArray objects: 70 | selectMethod("which", "DelayedArray") 71 | } 72 | 73 | \keyword{methods} 74 | -------------------------------------------------------------------------------- /man/unique.Rd: -------------------------------------------------------------------------------- 1 | \name{unique} 2 | 3 | \alias{unique} 4 | 5 | \title{Extract unique elements} 6 | 7 | \description{ 8 | \code{unique} returns an object of the same class as \code{x} (typically 9 | a vector-like, data-frame-like, or array-like object) but with duplicate 10 | elements/rows removed. 11 | 12 | NOTE: This man page is for the \code{unique} \emph{S4 generic function} 13 | defined in the \pkg{BiocGenerics} package. 14 | See \code{?base::\link[base]{unique}} for the default method 15 | (defined in the \pkg{base} package). 16 | Bioconductor packages can define specific methods for objects 17 | (typically vector-like or data-frame-like) not supported by the 18 | default method. 19 | } 20 | 21 | \usage{ 22 | unique(x, incomparables=FALSE, ...) 23 | } 24 | 25 | \arguments{ 26 | \item{x}{ 27 | A vector-like, data-frame-like, or array-like object. 28 | } 29 | \item{incomparables, ...}{ 30 | See \code{?base::\link[base]{unique}} for a description of 31 | these arguments. 32 | } 33 | } 34 | 35 | \value{ 36 | See \code{?base::\link[base]{unique}} for the value returned by the 37 | default method. 38 | 39 | Specific methods defined in Bioconductor packages will typically 40 | return an object of the same class as the input object. 41 | 42 | \code{unique} should always behave consistently with 43 | \code{BiocGenerics::\link[BiocGenerics]{duplicated}}. 44 | } 45 | 46 | \seealso{ 47 | \itemize{ 48 | \item \code{base::\link[base]{unique}} for the default \code{unique} 49 | method. 50 | 51 | \item \code{BiocGenerics::\link[BiocGenerics]{duplicated}} for determining 52 | duplicate elements. 53 | 54 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 55 | methods defined for a given generic function. 56 | 57 | \item \code{\link[methods]{selectMethod}} for getting the definition of 58 | a specific method. 59 | 60 | \item \link[S4Vectors]{unique,Rle-method} in the \pkg{S4Vectors} package 61 | for an example of a specific \code{unique} method (defined for 62 | \link[S4Vectors]{Rle} objects). 63 | 64 | \item \link{BiocGenerics} for a summary of all the generics defined 65 | in the \pkg{BiocGenerics} package. 66 | } 67 | } 68 | 69 | \examples{ 70 | unique 71 | showMethods("unique") 72 | selectMethod("unique", "ANY") # the default method 73 | } 74 | 75 | \keyword{methods} 76 | -------------------------------------------------------------------------------- /man/as.data.frame.Rd: -------------------------------------------------------------------------------- 1 | \name{as.data.frame} 2 | 3 | \alias{as.data.frame} 4 | 5 | \title{Coerce to a data frame} 6 | 7 | \description{ 8 | Generic function to coerce to a data frame, if possible. 9 | 10 | NOTE: This man page is for the \code{as.data.frame} 11 | \emph{S4 generic function} defined in the \pkg{BiocGenerics} package. 12 | See \code{?base::\link[base]{as.data.frame}} for the default method 13 | (defined in the \pkg{base} package). 14 | Bioconductor packages can define specific methods for objects 15 | not supported by the default method. 16 | } 17 | 18 | \usage{ 19 | as.data.frame(x, row.names=NULL, optional=FALSE, ...) 20 | } 21 | 22 | \arguments{ 23 | \item{x}{ 24 | The object to coerce. 25 | } 26 | \item{row.names, optional, ...}{ 27 | See \code{?base::\link[base]{as.data.frame}} for a description of 28 | these arguments. 29 | } 30 | } 31 | 32 | \value{ 33 | An ordinary data frame. 34 | 35 | See \code{?base::\link[base]{as.data.frame}} for the value returned 36 | by the default method. 37 | 38 | Specific methods defined in Bioconductor packages should 39 | behave as consistently as possible with the default method. 40 | } 41 | 42 | \seealso{ 43 | \itemize{ 44 | \item \code{base::\link[base]{as.data.frame}} for the default 45 | \code{as.data.frame} method. 46 | 47 | \item \code{\link[BiocGenerics]{toTable}} for an alternative to 48 | \code{as.data.frame}. 49 | 50 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 51 | methods defined for a given generic function. 52 | 53 | \item \code{\link[methods]{selectMethod}} for getting the definition of 54 | a specific method. 55 | 56 | \item \link[S4Vectors]{as.data.frame,DataFrame-method} in the 57 | \pkg{S4Vectors} package, and 58 | \link[IRanges]{as.data.frame,IntegerRanges-method} in the 59 | \pkg{IRanges} package, for examples of specific \code{as.data.frame} 60 | methods (defined for \link[S4Vectors]{DataFrame} and 61 | \link[IRanges]{IntegerRanges} objects, respectively). 62 | 63 | \item \link{BiocGenerics} for a summary of all the generics defined 64 | in the \pkg{BiocGenerics} package. 65 | } 66 | } 67 | 68 | \examples{ 69 | as.data.frame # note the dispatch on the 'x' arg only 70 | showMethods("as.data.frame") 71 | selectMethod("as.data.frame", "ANY") # the default method 72 | } 73 | 74 | \keyword{methods} 75 | -------------------------------------------------------------------------------- /man/saveRDS.Rd: -------------------------------------------------------------------------------- 1 | \name{saveRDS} 2 | 3 | \alias{saveRDS} 4 | \alias{saveRDS,ANY-method} 5 | 6 | \title{The saveRDS() S4 generic and default method} 7 | 8 | \description{ 9 | Generic function to write a single R object to a file. 10 | 11 | NOTE: This man page is for the \code{saveRDS} \emph{S4 generic function} 12 | and default method defined in the \pkg{BiocGenerics} package. 13 | See \code{?base::\link[base]{saveRDS}} for the corresponding function 14 | defined in base R. 15 | } 16 | 17 | \usage{ 18 | saveRDS(object, file="", ascii=FALSE, version=NULL, 19 | compress=TRUE, refhook=NULL) 20 | } 21 | 22 | \details{ 23 | The default \code{saveRDS} method defined in this package is a thin 24 | wrapper around \code{base::\link[base]{saveRDS}} that issues a warning 25 | if the object to serialize contains out-of-memory data. 26 | See \code{?\link{containsOutOfMemoryData}} for more information. 27 | 28 | Bioconductor packages can override this default method with more 29 | specialized methods. 30 | } 31 | 32 | \arguments{ 33 | \item{object, file, ascii, version, compress, refhook}{ 34 | See \code{?base::\link[base]{saveRDS}} for a description of 35 | these arguments. 36 | } 37 | } 38 | 39 | \value{ 40 | An invisible \code{NULL}. 41 | } 42 | 43 | \seealso{ 44 | \itemize{ 45 | \item \code{base::\link[base]{saveRDS}} in the \pkg{base} package 46 | for the default \code{saveRDS} method. 47 | 48 | \item \code{\link{containsOutOfMemoryData}} for determining whether 49 | an object contains out-of-memory data or not. 50 | 51 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 52 | methods defined for a given generic function. 53 | 54 | \item \code{\link[methods]{selectMethod}} for getting the definition of 55 | a specific method. 56 | 57 | \item \link[SummarizedExperiment]{saveRDS,SummarizedExperiment-method} 58 | in the \pkg{SummarizedExperiment} package for an example 59 | of a specific \code{saveRDS} method (defined for 60 | \link[SummarizedExperiment]{SummarizedExperiment} objects 61 | and derivatives). 62 | 63 | \item \link{BiocGenerics} for a summary of all the generics defined 64 | in the \pkg{BiocGenerics} package. 65 | } 66 | } 67 | 68 | \examples{ 69 | saveRDS # note the dispatch on the 'object' arg only 70 | showMethods("saveRDS") 71 | selectMethod("saveRDS", "ANY") # the default method 72 | } 73 | 74 | \keyword{methods} 75 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | o Functions defined in base R that would need to be explicitly promoted 2 | to generics in the BiocGenerics package (currently they are implicitly 3 | made generics by the IRanges package): 4 | 5 | From package base: 6 | - split(): implicit generic dispatches on (x, f, drop). 7 | Explicit generic should dispatch on (x, f) only. 8 | - which(): implicit generic dispatches on (x, arr.ind, useNames). 9 | Explicit generic should dispatch on (x) only. 10 | - ifelse(): implicit generic dispatches on (test, yes, no). 11 | Explicit generic should dispatch on (test) only. 12 | - nchar(): implicit generic dispatches on (x, type, allowNA). 13 | Explicit generic should dispatch on (x) only. 14 | - substr(): implicit generic dispatches on (x, start, stop). 15 | Explicit generic should dispatch on (x) only. 16 | - substring(): implicit generic dispatches on (text, first, last). 17 | Explicit generic should dispatch on (text) only. 18 | - chartr(): implicit generic dispatches on (old, new, x). 19 | Explicit generic should dispatch on (x) only. 20 | - sub(), gsub(): implicit generics dispatch on (pattern, replacement, x, 21 | ignore.case, perl, fixed, useBytes). Explicit generics should dispatch 22 | on (x) only. 23 | - range(): 24 | - by(): 25 | 26 | From package stats: 27 | - var(): implicit generic dispatches on (x, y, na.rm, use). 28 | Explicit generic should dispatch on (x, y) only. 29 | - cov(): implicit generic dispatches on (x, y, use, method). 30 | Explicit generic should dispatch on (x, y) only. 31 | - cor(): implicit generic dispatches on (x, y, use, method). 32 | Explicit generic should dispatch on (x, y) only. 33 | - sd(): implicit generic dispatches on (x, na.rm). 34 | Explicit generic should dispatch on (x) only. 35 | - median(): implicit generic dispatches on (x, na.rm). 36 | Explicit generic should dispatch on (x) only. 37 | - mad(): implicit generic dispatches on (x, center, constant, na.rm, 38 | low, high). Explicit generic should dispatch on (x) only. 39 | - IQR(): implicit generic dispatches on (x, na.rm, type). 40 | Explicit generic should dispatch on (x) only. 41 | - smoothEnds(): implicit generic dispatches on (y, k). 42 | Explicit generic should dispatch on (y) only. 43 | - runmed(): implicit generic dispatches on (x, k, endrule, algorithm, 44 | print.level). Explicit generic should dispatch on (x) only. 45 | 46 | 47 | -------------------------------------------------------------------------------- /man/xtabs.Rd: -------------------------------------------------------------------------------- 1 | \name{xtabs} 2 | 3 | \alias{xtabs} 4 | 5 | \title{Cross tabulation} 6 | 7 | \description{ 8 | \code{xtabs} creates a contingency table (optionally a sparse matrix) from 9 | cross-classifying factors, usually contained in a data-frame-like object, 10 | using a formula interface. 11 | 12 | NOTE: This man page is for the \code{xtabs} \emph{S4 generic function} 13 | defined in the \pkg{BiocGenerics} package. 14 | See \code{?stats::\link[stats]{xtabs}} for the default method 15 | (defined in the \pkg{stats} package). 16 | Bioconductor packages can define specific methods for objects 17 | not supported by the default method. 18 | } 19 | 20 | \usage{ 21 | xtabs(formula=~., data=parent.frame(), subset, sparse=FALSE, 22 | na.action, na.rm=FALSE, addNA=FALSE, exclude=if(!addNA)c(NA, NaN), 23 | drop.unused.levels=FALSE) 24 | } 25 | 26 | \arguments{ 27 | \item{formula, subset, sparse, na.action, na.rm, addNA, 28 | exclude, drop.unused.levels}{ 29 | See \code{?stats::\link[stats]{xtabs}} for a description of 30 | these arguments. 31 | } 32 | \item{data}{ 33 | A data-frame-like object. 34 | } 35 | } 36 | 37 | \value{ 38 | See \code{?stats::\link[stats]{xtabs}} for the value returned by the 39 | default method. 40 | 41 | Specific methods defined in Bioconductor packages should also 42 | return the type of object returned by the default method. 43 | } 44 | 45 | \seealso{ 46 | \itemize{ 47 | \item \code{stats::\link[stats]{xtabs}} for the default \code{xtabs} 48 | method. 49 | 50 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 51 | methods defined for a given generic function. 52 | 53 | \item \code{\link[methods]{selectMethod}} for getting the definition of 54 | a specific method. 55 | 56 | \item \link[S4Vectors]{xtabs,DataFrame-method} in the \pkg{S4Vectors} 57 | package for an example of a specific \code{xtabs} method (defined 58 | for \link[S4Vectors]{DataFrame} objects). 59 | 60 | \item \link{BiocGenerics} for a summary of all the generics defined 61 | in the \pkg{BiocGenerics} package. 62 | } 63 | } 64 | 65 | \examples{ 66 | xtabs # note the dispatch on the 'data' arg only 67 | showMethods("xtabs") 68 | selectMethod("xtabs", "ANY") # the default method 69 | 70 | library(S4Vectors) 71 | showMethods("xtabs") 72 | ## The xtabs() method for DataFrame objects: 73 | selectMethod("xtabs", "DataFrame") 74 | } 75 | 76 | \keyword{methods} 77 | -------------------------------------------------------------------------------- /man/sort.Rd: -------------------------------------------------------------------------------- 1 | \name{sort} 2 | 3 | \alias{sort} 4 | 5 | \title{Sorting a vector-like object} 6 | 7 | \description{ 8 | Sort a vector-like object into ascending or descending order. 9 | 10 | NOTE: This man page is for the \code{sort} 11 | \emph{S4 generic function} defined in the \pkg{BiocGenerics} package. 12 | See \code{?base::\link[base]{sort}} for the default method 13 | (defined in the \pkg{base} package). 14 | Bioconductor packages can define specific methods for objects 15 | not supported by the default method. 16 | } 17 | 18 | \usage{ 19 | sort(x, decreasing=FALSE, ...) 20 | } 21 | 22 | \arguments{ 23 | \item{x}{ 24 | A vector-like object. 25 | } 26 | \item{decreasing, ...}{ 27 | See \code{?base::\link[base]{sort}} for a description of 28 | these arguments. 29 | } 30 | } 31 | 32 | \value{ 33 | See \code{?base::\link[base]{sort}} for the value returned 34 | by the default method. 35 | 36 | Specific methods defined in Bioconductor packages should 37 | behave as consistently as possible with the default method. 38 | } 39 | 40 | \note{ 41 | TO DEVELOPERS: 42 | 43 | See note in \code{?BiocGenerics::\link[BiocGenerics]{order}} 44 | about "stable" order. 45 | 46 | \code{\link[BiocGenerics]{order}}, \code{\link[BiocGenerics]{sort}}, 47 | and \code{\link[BiocGenerics]{rank}} methods for specific vector-like 48 | objects should adhere to the same underlying order that should be 49 | conceptually defined as a binary relation on the set of all possible 50 | vector values. For completeness, this binary relation should also be 51 | incarnated by a \link{<=} method. 52 | } 53 | 54 | \seealso{ 55 | \itemize{ 56 | \item \code{base::\link[base]{sort}} for the default 57 | \code{sort} method. 58 | 59 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 60 | methods defined for a given generic function. 61 | 62 | \item \code{\link[methods]{selectMethod}} for getting the definition of 63 | a specific method. 64 | 65 | \item \link[S4Vectors]{sort,Vector-method} in the \pkg{S4Vectors} package 66 | for an example of a specific \code{sort} method (defined for 67 | \link[S4Vectors]{Vector} objects). 68 | 69 | \item \link{BiocGenerics} for a summary of all the generics defined 70 | in the \pkg{BiocGenerics} package. 71 | } 72 | } 73 | 74 | \examples{ 75 | sort # note the dispatch on the 'x' arg only 76 | showMethods("sort") 77 | selectMethod("sort", "ANY") # the default method 78 | } 79 | 80 | \keyword{methods} 81 | -------------------------------------------------------------------------------- /man/do.call.Rd: -------------------------------------------------------------------------------- 1 | \name{do.call} 2 | 3 | \alias{do.call} 4 | 5 | \title{Execute a function call} 6 | 7 | \description{ 8 | \code{do.call} constructs and executes a function call from a name or a 9 | function and a list of arguments to be passed to it. 10 | 11 | NOTE: This man page is for the \code{do.call} \emph{S4 generic function} 12 | defined in the \pkg{BiocGenerics} package. 13 | See \code{?base::\link[base]{do.call}} for the default method 14 | (defined in the \pkg{base} package). 15 | Bioconductor packages can define specific methods for objects 16 | not supported by the default method. 17 | } 18 | 19 | \usage{ 20 | do.call(what, args, quote=FALSE, envir=parent.frame()) 21 | } 22 | 23 | \arguments{ 24 | \item{what}{ 25 | The default method expects either a function or a non-empty character 26 | string naming the function to be called. 27 | See \code{?base::\link[base]{do.call}} for the details. 28 | 29 | Specific methods can support other objects. 30 | Please refer to the documentation of a particular method for the details. 31 | } 32 | \item{args}{ 33 | The default method expects a \emph{list} of arguments to the function 34 | call (the \code{names} attribute of \code{args} gives the argument names). 35 | See \code{?base::\link[base]{do.call}} for the details. 36 | 37 | Specific methods can support other objects. 38 | Please refer to the documentation of a particular method for the details. 39 | } 40 | \item{quote, envir}{ 41 | See \code{?base::\link[base]{do.call}} for a description of 42 | these arguments. 43 | } 44 | } 45 | 46 | \value{ 47 | The result of the (evaluated) function call. 48 | 49 | Specific methods defined in Bioconductor packages should 50 | behave as consistently as possible with the default method. 51 | } 52 | 53 | \seealso{ 54 | \itemize{ 55 | \item \code{base::\link[base]{do.call}} for the default \code{do.call} 56 | method. 57 | 58 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 59 | methods defined for a given generic function. 60 | 61 | \item \code{\link[methods]{selectMethod}} for getting the definition of 62 | a specific method. 63 | 64 | \item \link{BiocGenerics} for a summary of all the generics defined 65 | in the \pkg{BiocGenerics} package. 66 | } 67 | } 68 | 69 | \examples{ 70 | do.call # note the dispatch on the 'what' and 'args' args only 71 | showMethods("do.call") 72 | selectMethod("do.call", c("ANY", "ANY")) # the default method 73 | } 74 | 75 | \keyword{methods} 76 | -------------------------------------------------------------------------------- /man/Extremes.Rd: -------------------------------------------------------------------------------- 1 | \name{Extremes} 2 | 3 | \alias{Extremes} 4 | \alias{pmax} 5 | \alias{pmin} 6 | \alias{pmax.int} 7 | \alias{pmin.int} 8 | 9 | \title{Maxima and minima} 10 | 11 | \description{ 12 | \code{pmax}, \code{pmin}, \code{pmax.int} and \code{pmin.int} return the 13 | parallel maxima and minima of the input values. 14 | 15 | NOTE: This man page is for the \code{pmax}, \code{pmin}, \code{pmax.int} 16 | and \code{pmin.int} \emph{S4 generic functions} defined in the 17 | \pkg{BiocGenerics} package. 18 | See \code{?base::\link[base]{pmax}} for the default methods 19 | (defined in the \pkg{base} package). 20 | Bioconductor packages can define specific methods for objects 21 | (typically vector-like or matrix-like) not supported by the default 22 | methods. 23 | } 24 | 25 | \usage{ 26 | pmax(..., na.rm=FALSE) 27 | pmin(..., na.rm=FALSE) 28 | 29 | pmax.int(..., na.rm=FALSE) 30 | pmin.int(..., na.rm=FALSE) 31 | } 32 | 33 | \arguments{ 34 | \item{...}{ 35 | One or more vector-like or matrix-like objects. 36 | } 37 | \item{na.rm}{ 38 | See \code{?base::\link[base]{pmax}} for a description of 39 | this argument. 40 | } 41 | } 42 | 43 | \value{ 44 | See \code{?base::\link[base]{pmax}} for the value returned by the 45 | default methods. 46 | 47 | Specific methods defined in Bioconductor packages will typically 48 | return an object of the same class as the input objects. 49 | } 50 | 51 | \seealso{ 52 | \itemize{ 53 | \item \code{base::\link[base]{pmax}} for the default \code{pmax}, 54 | \code{pmin}, \code{pmax.int} and \code{pmin.int} methods. 55 | 56 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 57 | methods defined for a given generic function. 58 | 59 | \item \code{\link[methods]{selectMethod}} for getting the definition of 60 | a specific method. 61 | 62 | \item \link[S4Vectors]{pmax,Rle-method} in the \pkg{S4Vectors} package 63 | for an example of a specific \code{pmax} method (defined for 64 | \link[S4Vectors]{Rle} objects). 65 | 66 | \item \link{BiocGenerics} for a summary of all the generics defined 67 | in the \pkg{BiocGenerics} package. 68 | } 69 | } 70 | 71 | \examples{ 72 | pmax 73 | showMethods("pmax") 74 | selectMethod("pmax", "ANY") # the default method 75 | 76 | pmin 77 | showMethods("pmin") 78 | selectMethod("pmin", "ANY") # the default method 79 | 80 | pmax.int 81 | showMethods("pmax.int") 82 | selectMethod("pmax.int", "ANY") # the default method 83 | 84 | pmin.int 85 | showMethods("pmin.int") 86 | selectMethod("pmin.int", "ANY") # the default method 87 | } 88 | 89 | \keyword{methods} 90 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: BiocGenerics 2 | Title: S4 generic functions used in Bioconductor 3 | Description: The package defines many S4 generic functions used in Bioconductor. 4 | biocViews: Infrastructure 5 | URL: https://bioconductor.org/packages/BiocGenerics 6 | BugReports: https://github.com/Bioconductor/BiocGenerics/issues 7 | Version: 0.57.0 8 | License: Artistic-2.0 9 | Encoding: UTF-8 10 | Authors@R: c( 11 | person("The Bioconductor Dev Team", role="aut"), 12 | person("Hervé", "Pagès", role=c("aut", "cre"), 13 | email="hpages.on.github@gmail.com", 14 | comment=c(ORCID="0009-0002-8272-4522")), 15 | person("Laurent", "Gatto", role="ctb", 16 | email="laurent.gatto@uclouvain.be", 17 | comment=c(ORCID="0000-0002-1520-2268")), 18 | person("Nathaniel", "Hayden", role="ctb"), 19 | person("James", "Hester", role="ctb"), 20 | person("Wolfgang", "Huber", role="ctb"), 21 | person("Michael", "Lawrence", role="ctb"), 22 | person("Martin", "Morgan", role="ctb", 23 | email="mtmorgan.xyz@gmail.com", 24 | comment=c(ORCID="0000-0002-5874-8148")), 25 | person("Valerie", "Obenchain", role="ctb")) 26 | Depends: R (>= 4.0.0), methods, utils, graphics, stats, generics 27 | Imports: methods, utils, graphics, stats 28 | Suggests: Biobase, S4Vectors, IRanges, S4Arrays, SparseArray, DelayedArray, 29 | HDF5Array, GenomicRanges, pwalign, Rsamtools, AnnotationDbi, affy, 30 | affyPLM, DESeq2, flowClust, MSnbase, annotate, MultiAssayExperiment, 31 | RUnit 32 | Collate: S3-classes-as-S4-classes.R 33 | utils.R 34 | normarg-utils.R 35 | replaceSlots.R 36 | aperm.R 37 | append.R 38 | as.data.frame.R 39 | as.list.R 40 | as.vector.R 41 | cbind.R 42 | do.call.R 43 | duplicated.R 44 | eval.R 45 | Extremes.R 46 | format.R 47 | funprog.R 48 | get.R 49 | grep.R 50 | is.unsorted.R 51 | lapply.R 52 | mapply.R 53 | match.R 54 | mean.R 55 | nrow.R 56 | order.R 57 | paste.R 58 | rank.R 59 | rep.R 60 | row_colnames.R 61 | saveRDS.R 62 | sort.R 63 | start.R 64 | subset.R 65 | t.R 66 | table.R 67 | tapply.R 68 | unique.R 69 | unlist.R 70 | unsplit.R 71 | which.R 72 | which.min.R 73 | relist.R 74 | boxplot.R 75 | image.R 76 | density.R 77 | IQR.R 78 | mad.R 79 | residuals.R 80 | var.R 81 | weights.R 82 | xtabs.R 83 | setops.R 84 | annotation.R 85 | combine.R 86 | containsOutOfMemoryData.R 87 | dbconn.R 88 | dge.R 89 | dims.R 90 | fileName.R 91 | longForm.R 92 | normalize.R 93 | Ontology.R 94 | organism_species.R 95 | paste2.R 96 | path.R 97 | plotMA.R 98 | plotPCA.R 99 | score.R 100 | strand.R 101 | toTable.R 102 | type.R 103 | updateObject.R 104 | testPackage.R 105 | zzz.R 106 | -------------------------------------------------------------------------------- /man/eval.Rd: -------------------------------------------------------------------------------- 1 | \name{eval} 2 | 3 | \alias{eval} 4 | 5 | \title{Evaluate an (unevaluated) expression} 6 | 7 | \description{ 8 | \code{eval} evaluates an R expression in a specified environment. 9 | 10 | NOTE: This man page is for the \code{eval} \emph{S4 generic function} 11 | defined in the \pkg{BiocGenerics} package. 12 | See \code{?base::\link[base]{eval}} for the default method 13 | (defined in the \pkg{base} package). 14 | Bioconductor packages can define specific methods for objects 15 | not supported by the default method. 16 | } 17 | 18 | \usage{ 19 | eval(expr, envir=parent.frame(), 20 | enclos=if (is.list(envir) || is.pairlist(envir)) 21 | parent.frame() else baseenv()) 22 | } 23 | 24 | \arguments{ 25 | \item{expr}{ 26 | An object to be evaluated. 27 | May be any object supported by the default method 28 | (see \code{?base::\link[base]{eval}}) or by the additional 29 | methods defined in Bioconductor packages. 30 | } 31 | \item{envir}{ 32 | The \emph{environment} in which \code{expr} is to be evaluated. 33 | May be any object supported by the default method 34 | (see \code{?base::\link[base]{eval}}) or by the additional 35 | methods defined in Bioconductor packages. 36 | } 37 | \item{enclos}{ 38 | See \code{?base::\link[base]{eval}} for a description of 39 | this argument. 40 | } 41 | } 42 | 43 | \value{ 44 | See \code{?base::\link[base]{eval}} for the value returned by the 45 | default method. 46 | 47 | Specific methods defined in Bioconductor packages should 48 | behave as consistently as possible with the default method. 49 | } 50 | 51 | \seealso{ 52 | \itemize{ 53 | \item \code{base::\link[base]{eval}} for the default \code{eval} method. 54 | 55 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 56 | methods defined for a given generic function. 57 | 58 | \item \code{\link[methods]{selectMethod}} for getting the definition of 59 | a specific method. 60 | 61 | \item \link[IRanges]{eval,expression,Vector-method} in the \pkg{IRanges} 62 | package for an example of a specific \code{eval} method (defined 63 | for when the \code{expr} and \code{envir} arguments are an 64 | \link[base]{expression} and a \link[S4Vectors]{Vector} object, 65 | respectively). 66 | 67 | \item \link{BiocGenerics} for a summary of all the generics defined 68 | in the \pkg{BiocGenerics} package. 69 | } 70 | } 71 | 72 | \examples{ 73 | eval # note the dispatch on 'expr' and 'envir' args only 74 | showMethods("eval") 75 | selectMethod("eval", c("ANY", "ANY")) # the default method 76 | } 77 | 78 | \keyword{methods} 79 | -------------------------------------------------------------------------------- /R/type.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### The type() getter and setter 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | 6 | 7 | ### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8 | ### Getter 9 | ### 10 | 11 | setGeneric("type", function(x) standardGeneric("type")) 12 | 13 | setMethod("type", "vector", function(x) typeof(x)) 14 | 15 | setMethod("type", "array", function(x) typeof(x)) 16 | 17 | setMethod("type", "factor", function(x) "character") 18 | 19 | ### NOT exported but used in S4Arrays. 20 | ### Return a list with one list element per column in data frame 'x', with 21 | ### the exception that a length-1 list is returned when 'x' has zero column. 22 | ### All the list elements in the returned list are guaranteed to be ordinary 23 | ### vectors (atomic or list) of length 0. 24 | ### Note that: 25 | ### - extract_data_frame_slice0() works on a data.frame object only if 26 | ### as.vector() can be applied to all its columns. 27 | ### - Additionally, extract_data_frame_slice0() would also work out-of-the-box 28 | ### on any data-frame-like object granted that the object supports 29 | ### x[0L, , drop=FALSE]. This includes DataFrame, data.table, and 30 | ### tibble (tbl_df) objects. 31 | extract_data_frame_slice0 <- function(x) 32 | { 33 | if (ncol(x) == 0L) 34 | return(list(logical(0))) 35 | x0 <- x[0L, , drop=FALSE] 36 | ## Apply as.vector() on each column to turn them into ordinary vectors. 37 | ## In particular this will turn columns that are factors into character 38 | ## vectors, and columns that are Rle objects into atomic vectors of the 39 | ## corresponding types. 40 | ## Note that as.vector() is not guaranteed to work on all columns. For 41 | ## example 'x' could be a data.frame or DataFrame object where some 42 | ## columns are S4 objects that don't support as.vector(), in which 43 | ## case 'type(x)' will fail. 44 | lapply(x0, as.vector) 45 | } 46 | 47 | .get_data_frame_type <- function(x) 48 | { 49 | slice0 <- extract_data_frame_slice0(x) 50 | type(unlist(slice0, recursive=FALSE, use.names=FALSE)) 51 | } 52 | 53 | setMethod("type", "data.frame", .get_data_frame_type) 54 | 55 | 56 | ### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 57 | ### Setter 58 | ### 59 | 60 | setGeneric("type<-", signature="x", 61 | function(x, value) standardGeneric("type<-") 62 | ) 63 | 64 | setReplaceMethod("type", "vector", 65 | function(x, value) `storage.mode<-`(x, value=value) 66 | ) 67 | 68 | setReplaceMethod("type", "array", 69 | function(x, value) `storage.mode<-`(x, value=value) 70 | ) 71 | 72 | -------------------------------------------------------------------------------- /man/is.unsorted.Rd: -------------------------------------------------------------------------------- 1 | \name{is.unsorted} 2 | 3 | \alias{is.unsorted} 4 | 5 | \title{Test if a vector-like object is not sorted} 6 | 7 | \description{ 8 | Test if a vector-like object is not sorted, without the cost of sorting it. 9 | 10 | NOTE: This man page is for the \code{is.unsorted} 11 | \emph{S4 generic function} defined in the \pkg{BiocGenerics} package. 12 | See \code{?base::\link[base]{is.unsorted}} for the default method 13 | (defined in the \pkg{base} package). 14 | Bioconductor packages can define specific methods for objects 15 | (typically vector-like) not supported by the default method. 16 | } 17 | 18 | \usage{ 19 | is.unsorted(x, na.rm=FALSE, strictly=FALSE, ...) 20 | } 21 | 22 | \arguments{ 23 | \item{x}{ 24 | A vector-like object. 25 | } 26 | \item{na.rm, strictly}{ 27 | See \code{?base::\link[base]{is.unsorted}} for a description of 28 | these arguments. 29 | } 30 | \item{...}{ 31 | Additional arguments, for use in specific methods. 32 | 33 | Note that \code{base::\link[base]{is.unsorted}} (the default method) only 34 | takes the \code{x}, \code{na.rm}, and \code{strictly} arguments. 35 | } 36 | } 37 | 38 | \value{ 39 | See \code{?base::\link[base]{is.unsorted}} for the value returned 40 | by the default method. 41 | 42 | Specific methods defined in Bioconductor packages should 43 | behave as consistently as possible with the default method. 44 | } 45 | 46 | \note{ 47 | TO DEVELOPERS: 48 | 49 | The \code{is.unsorted} method for specific vector-like objects should 50 | adhere to the same underlying order used by the 51 | \code{\link[BiocGenerics]{order}}, \code{\link[BiocGenerics]{sort}}, 52 | and \code{\link[BiocGenerics]{rank}} methods for the same objects. 53 | } 54 | 55 | \seealso{ 56 | \itemize{ 57 | \item \code{base::\link[base]{is.unsorted}} for the default 58 | \code{is.unsorted} method. 59 | 60 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 61 | methods defined for a given generic function. 62 | 63 | \item \code{\link[methods]{selectMethod}} for getting the definition of 64 | a specific method. 65 | 66 | \item \link[GenomicRanges]{is.unsorted,GenomicRanges-method} in 67 | the \pkg{GenomicRanges} package for an example of a specific 68 | \code{is.unsorted} method (defined for 69 | \link[GenomicRanges]{GenomicRanges} objects). 70 | 71 | \item \link{BiocGenerics} for a summary of all the generics defined 72 | in the \pkg{BiocGenerics} package. 73 | } 74 | } 75 | 76 | \examples{ 77 | is.unsorted # note the dispatch on the 'x' arg only 78 | showMethods("is.unsorted") 79 | selectMethod("is.unsorted", "ANY") # the default method 80 | } 81 | 82 | \keyword{methods} 83 | -------------------------------------------------------------------------------- /man/cbind.Rd: -------------------------------------------------------------------------------- 1 | \name{cbind} 2 | 3 | \alias{rbind} 4 | \alias{cbind} 5 | 6 | \title{Combine objects by rows or columns} 7 | 8 | \description{ 9 | \code{rbind} and \code{cbind} take one or more objects and combine them 10 | by columns or rows, respectively. 11 | 12 | NOTE: This man page is for the \code{rbind} and \code{cbind} 13 | \emph{S4 generic functions} defined in the \pkg{BiocGenerics} package. 14 | See \code{?base::\link[base]{cbind}} for the default methods 15 | (defined in the \pkg{base} package). 16 | Bioconductor packages can define specific methods for objects 17 | (typically vector-like or matrix-like) not supported by the default 18 | methods. 19 | } 20 | 21 | \usage{ 22 | rbind(..., deparse.level=1) 23 | cbind(..., deparse.level=1) 24 | } 25 | 26 | \arguments{ 27 | \item{...}{ 28 | One or more vector-like or matrix-like objects. These can be given as 29 | named arguments. 30 | } 31 | \item{deparse.level}{ 32 | See \code{?base::\link[base]{cbind}} for a description of 33 | this argument. 34 | } 35 | } 36 | 37 | \value{ 38 | See \code{?base::\link[base]{cbind}} for the value returned by the 39 | default methods. 40 | 41 | Specific methods defined in Bioconductor packages will typically 42 | return an object of the same class as the input objects. 43 | } 44 | 45 | \seealso{ 46 | \itemize{ 47 | \item \code{base::\link[base]{cbind}} for the default \code{rbind} and 48 | \code{cbind} methods. 49 | 50 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 51 | methods defined for a given generic function. 52 | 53 | \item \code{\link[methods]{selectMethod}} for getting the definition of 54 | a specific method. 55 | 56 | \item \link[S4Vectors]{rbind,RectangularData-method} and 57 | \link[S4Vectors]{cbind,DataFrame-method} in the \pkg{S4Vectors} 58 | package for examples of specific \code{rbind} and \code{cbind} 59 | methods (defined for \link[S4Vectors]{RectangularData} derivatives 60 | and \link[S4Vectors]{DataFrame} objects, respectively). 61 | 62 | \item \link{BiocGenerics} for a summary of all the generics defined 63 | in the \pkg{BiocGenerics} package. 64 | } 65 | } 66 | 67 | \examples{ 68 | rbind # note the dispatch on the '...' arg only 69 | showMethods("rbind") 70 | selectMethod("rbind", "ANY") # the default method 71 | 72 | cbind # note the dispatch on the '...' arg only 73 | showMethods("cbind") 74 | selectMethod("cbind", "ANY") # the default method 75 | 76 | library(S4Vectors) 77 | showMethods("rbind") 78 | ## The rbind() method for RectangularData derivatives: 79 | selectMethod("rbind", "RectangularData") 80 | ## The cbind() method for DataFrame objects: 81 | selectMethod("cbind", "DataFrame") 82 | } 83 | 84 | \keyword{methods} 85 | -------------------------------------------------------------------------------- /man/testPackage.Rd: -------------------------------------------------------------------------------- 1 | \name{testPackage} 2 | 3 | \alias{testPackage} 4 | 5 | \title{Run RUnit package unit tests} 6 | 7 | \description{ 8 | \code{testPackage} helps developers implement unit tests using the 9 | \pkg{RUnit} testing conventions. 10 | } 11 | 12 | \usage{ 13 | testPackage(pkgname=NULL, subdir="unitTests", pattern="^test_.*\\\\.R$", 14 | path=getwd()) 15 | } 16 | 17 | \arguments{ 18 | \item{pkgname}{ 19 | The name of the package whose installed unit tests are to be run. A 20 | missing or NULL value implies that the \code{testPackage} command 21 | will look for tests within the package source directory indicated by 22 | \code{path}. 23 | } 24 | \item{subdir}{ 25 | A character(1) vector providing the subdirectory in which unit tests 26 | are located. The directory is searched first in the (installed or 27 | source) package root, or in a subdirectory \code{inst/} below the 28 | root. 29 | } 30 | \item{pattern}{ 31 | A character(1) regular expression describing the file names to be 32 | evaluated; typically used to restrict tests to a subset of all test 33 | files. 34 | } 35 | \item{path}{ 36 | A character(1) directory path indicating, when \code{pkgname} is 37 | missing or NULL, where unit tests will be searched. \code{path} can 38 | be any location at or below the package root. 39 | } 40 | } 41 | 42 | \details{ 43 | This function is not exported from the package namespace, and must be 44 | invoked using triple colons, \code{BiocGenerics:::testPackage()}; it 45 | is provided primarily for the convenience of developers. 46 | 47 | When invoked with missing or NULL \code{pkgname} argument, the 48 | function assumes that it has been invoked from within the package 49 | source tree (or that the source tree is located above \code{path}), 50 | and finds unit tests in \code{subdir="unitTests"} in either the base 51 | or \code{inst/} directories at the root of the package source 52 | tree. This mode is useful when developing unit tests, since the 53 | package does not have to be re-installed to run an updated test. 54 | 55 | When invoked with \code{pkgname} set to the name of an installed 56 | package, unit tests are searched for in the installed package 57 | directory. 58 | } 59 | 60 | \value{ 61 | The function returns the result of \code{RUnit::runTestSuite} invoked 62 | on the unit tests specified in the function call. 63 | } 64 | 65 | \seealso{ 66 | \url{http://bioconductor.org/developers/how-to/unitTesting-guidelines/} 67 | } 68 | 69 | \examples{ 70 | ## Run unit tests found in the library location where 71 | ## BiocGenerics is installed 72 | BiocGenerics:::testPackage("BiocGenerics") 73 | \dontrun{## Run unit tests for the package whose source tree implied 74 | ## by getwd() 75 | BiocGenerics:::testPackage() 76 | } 77 | } 78 | 79 | \keyword{methods} 80 | -------------------------------------------------------------------------------- /R/replaceSlots.R: -------------------------------------------------------------------------------- 1 | ### ========================================================================= 2 | ### Efficient multiple slots replacement of an S4 object 3 | ### ------------------------------------------------------------------------- 4 | ### 5 | ### From a caller point of views, replacement of the slots should feel atomic 6 | ### i.e. the object gets validated only after all the slots have been replaced. 7 | ### 8 | ### NOTE: The stuff in this file (not exported) doesn't really belong to 9 | ### BiocGenerics. 10 | ### 11 | ### TODO: This stuff would need to be moved to a more appropriate place (when 12 | ### we have one). 13 | ### 14 | 15 | unsafe_replaceSlots <- function(object, ..., .slotList=list()) 16 | { 17 | ## This function is no longer 'unsafe', in that it does not do 18 | ## in-place modification via `slot<-()`; see 19 | ## https://github.com/Bioconductor/BiocGenerics/pull/1 20 | slots <- c(list(...), .slotList) 21 | slots_names <- names(slots) 22 | ## This is too slow. See further down for a much faster way to check 23 | ## that the supplied slots exist. 24 | #invalid_idx <- which(!(slots_names %in% slotNames(object))) 25 | #if (length(invalid_idx) != 0L) { 26 | # in1string <- paste0(slots_names[invalid_idx], collapse=", ") 27 | # stop(wmsg("invalid slot(s) for ", class(object), " instance: ", 28 | # in1string)) 29 | #} 30 | for (i in seq_along(slots)) { 31 | slot_name <- slots_names[[i]] 32 | if (slot_name == "mcols") 33 | slot_name <- "elementMetadata" 34 | ## Even if we won't make any use of 'old_slot_val', this is a very 35 | ## efficient way to check that the supplied slot exists. 36 | ## We need to check this because the slot() setter won't raise an error 37 | ## in case of invalid slot name when used with 'check=FALSE'. It will 38 | ## silently be a no-op! 39 | old_slot_val <- slot(object, slot_name) # check slot existence 40 | slot_val <- slots[[i]] 41 | ## Too risky! identical() is not reliable enough e.g. with objects 42 | ## that contain external pointers. For example, DNAStringSet("A") 43 | ## and DNAStringSet("T") are considered to be identical! identical() 44 | ## would first need to be fixed. 45 | #if (identical(old_slot_val, slot_val)) 46 | # next 47 | slot(object, slot_name, check=FALSE) <- slot_val 48 | } 49 | object 50 | } 51 | 52 | ### replaceSlots() is essentially a more efficient initialize(), especially 53 | ### when called with 'check=FALSE'. 54 | replaceSlots <- function(object, ..., check=TRUE) 55 | { 56 | if (!isTRUEorFALSE(check)) 57 | stop("'check' must be TRUE or FALSE") 58 | object <- unsafe_replaceSlots(object, ...) 59 | if (check) 60 | validObject(object) 61 | object 62 | } 63 | 64 | -------------------------------------------------------------------------------- /man/lapply.Rd: -------------------------------------------------------------------------------- 1 | \name{lapply} 2 | 3 | \alias{lapply} 4 | \alias{sapply} 5 | 6 | \title{Apply a function over a list-like or vector-like object} 7 | 8 | \description{ 9 | \code{lapply} returns a list of the same length as \code{X}, each 10 | element of which is the result of applying \code{FUN} to the 11 | corresponding element of \code{X}. 12 | 13 | \code{sapply} is a user-friendly version and wrapper of \code{lapply} 14 | by default returning a vector, matrix or, if \code{simplify="array"}, 15 | an array if appropriate, by applying \code{simplify2array()}. 16 | \code{sapply(x, f, simplify=FALSE, USE.NAMES=FALSE)} is the same 17 | as \code{lapply(x, f)}. 18 | 19 | NOTE: This man page is for the \code{lapply} and \code{sapply} 20 | \emph{S4 generic functions} defined in the \pkg{BiocGenerics} package. 21 | See \code{?base::\link[base]{lapply}} for the default methods 22 | (defined in the \pkg{base} package). 23 | Bioconductor packages can define specific methods for objects 24 | (typically list-like or vector-like) not supported by the 25 | default methods. 26 | } 27 | 28 | \usage{ 29 | lapply(X, FUN, ...) 30 | sapply(X, FUN, ..., simplify=TRUE, USE.NAMES=TRUE) 31 | } 32 | 33 | \arguments{ 34 | \item{X}{ 35 | A list-like or vector-like object. 36 | } 37 | \item{FUN, ..., simplify, USE.NAMES}{ 38 | See \code{?base::\link[base]{lapply}} for a description of 39 | these arguments. 40 | } 41 | } 42 | 43 | \value{ 44 | See \code{?base::\link[base]{lapply}} for the value returned by the 45 | default methods. 46 | 47 | Specific methods defined in Bioconductor packages should 48 | behave as consistently as possible with the default methods. 49 | In particular, \code{lapply} and \code{sapply(simplify=FALSE)} 50 | should always return a list. 51 | } 52 | 53 | \seealso{ 54 | \itemize{ 55 | \item \code{base::\link[base]{lapply}} for the default \code{lapply} and 56 | \code{sapply} methods. 57 | 58 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 59 | methods defined for a given generic function. 60 | 61 | \item \code{\link[methods]{selectMethod}} for getting the definition of 62 | a specific method. 63 | 64 | \item \link[S4Vectors]{lapply,List-method} in the \pkg{S4Vectors} package 65 | for an example of a specific \code{lapply} method (defined for 66 | \link[S4Vectors]{List} objects). 67 | 68 | \item \link{BiocGenerics} for a summary of all the generics defined 69 | in the \pkg{BiocGenerics} package. 70 | } 71 | } 72 | 73 | \examples{ 74 | lapply # note the dispatch on the 'X' arg only 75 | showMethods("lapply") 76 | selectMethod("lapply", "ANY") # the default method 77 | 78 | sapply # note the dispatch on the 'X' arg only 79 | showMethods("sapply") 80 | selectMethod("sapply", "ANY") # the default method 81 | } 82 | 83 | \keyword{methods} 84 | -------------------------------------------------------------------------------- /man/tapply.Rd: -------------------------------------------------------------------------------- 1 | \name{tapply} 2 | 3 | \alias{tapply} 4 | 5 | \title{Apply a function over a ragged array} 6 | 7 | \description{ 8 | \code{tapply} applies a function to each cell of a ragged array, 9 | that is to each (non-empty) group of values given by a unique 10 | combination of the levels of certain factors. 11 | 12 | NOTE: This man page is for the \code{tapply} \emph{S4 generic function} 13 | defined in the \pkg{BiocGenerics} package. 14 | See \code{?base::\link[base]{tapply}} for the default method 15 | (defined in the \pkg{base} package). 16 | Bioconductor packages can define specific methods for objects 17 | (typically list-like or vector-like) not supported by the 18 | default method. 19 | } 20 | 21 | \usage{ 22 | tapply(X, INDEX, FUN=NULL, ..., default=NA, simplify=TRUE) 23 | } 24 | 25 | \arguments{ 26 | \item{X}{ 27 | The default method expects an atomic object, typically a vector. 28 | See \code{?base::\link[base]{tapply}} for the details. 29 | 30 | Specific methods can support other objects (typically list-like 31 | or vector-like). 32 | Please refer to the documentation of a particular method for the details. 33 | } 34 | \item{INDEX}{ 35 | The default method expects a list of one or more factors, each of same 36 | length as \code{X}. 37 | See \code{?base::\link[base]{tapply}} for the details. 38 | 39 | Specific methods can support other objects (typically list-like). 40 | Please refer to the documentation of a particular method for the details. 41 | } 42 | \item{FUN, ..., default, simplify}{ 43 | See \code{?base::\link[base]{tapply}} for a description of 44 | these arguments. 45 | } 46 | } 47 | 48 | \value{ 49 | See \code{?base::\link[base]{tapply}} for the value returned by the 50 | default method. 51 | 52 | Specific methods defined in Bioconductor packages should 53 | behave as consistently as possible with the default method. 54 | } 55 | 56 | \seealso{ 57 | \itemize{ 58 | \item \code{base::\link[base]{tapply}} for the default \code{tapply} 59 | method. 60 | 61 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 62 | methods defined for a given generic function. 63 | 64 | \item \code{\link[methods]{selectMethod}} for getting the definition of 65 | a specific method. 66 | 67 | \item \link[IRanges]{tapply,Vector,ANY-method} in the \pkg{IRanges} 68 | package for an example of a specific \code{tapply} method (defined 69 | for \link[S4Vectors]{Vector} objects). 70 | 71 | \item \link{BiocGenerics} for a summary of all the generics defined 72 | in the \pkg{BiocGenerics} package. 73 | } 74 | } 75 | 76 | \examples{ 77 | tapply # note the dispatch on the 'X' and 'INDEX' args only 78 | showMethods("tapply") 79 | selectMethod("tapply", c("ANY", "ANY")) # the default method 80 | } 81 | 82 | \keyword{methods} 83 | -------------------------------------------------------------------------------- /man/get.Rd: -------------------------------------------------------------------------------- 1 | \name{get} 2 | 3 | \alias{get} 4 | \alias{mget} 5 | 6 | \title{Return the value of a named object} 7 | 8 | \description{ 9 | Search for an object with a given name and return it. 10 | 11 | NOTE: This man page is for the \code{get} and \code{mget} \emph{S4 generic 12 | functions} defined in the \pkg{BiocGenerics} package. 13 | See \code{?base::\link[base]{get}} for the default methods 14 | (defined in the \pkg{base} package). 15 | Bioconductor packages can define specific methods for objects 16 | (list-like or environment-like) not supported by the default methods. 17 | } 18 | 19 | \usage{ 20 | get(x, pos=-1, envir=as.environment(pos), mode="any", inherits=TRUE) 21 | mget(x, envir, mode="any", ifnotfound, inherits=FALSE) 22 | } 23 | 24 | \arguments{ 25 | \item{x}{ 26 | For \code{get}: A variable name (or, more generally speaking, 27 | a \emph{key}), given as a single string. 28 | 29 | For \code{mget}: A vector of variable names (or \emph{keys}). 30 | } 31 | \item{envir}{ 32 | Where to look for the key(s). Typically a list-like or environment-like 33 | object. 34 | } 35 | \item{pos, mode, inherits, ifnotfound}{ 36 | See \code{?base::\link[base]{get}} for a description of 37 | these arguments. 38 | } 39 | } 40 | 41 | \details{ 42 | See \code{?base::\link[base]{get}} for details about the default methods. 43 | } 44 | 45 | \value{ 46 | For \code{get}: The value corresponding to the specified key. 47 | 48 | For \code{mget}: The list of values corresponding to the specified keys. 49 | The returned list must have one element per key, and in the same order 50 | as in \code{x}. 51 | 52 | See \code{?base::\link[base]{get}} for the value returned by the 53 | default methods. 54 | } 55 | 56 | \seealso{ 57 | \itemize{ 58 | \item \code{base::\link[base]{get}} for the default \code{get} and 59 | \code{mget} methods. 60 | 61 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 62 | methods defined for a given generic function. 63 | 64 | \item \code{\link[methods]{selectMethod}} for getting the definition of 65 | a specific method. 66 | 67 | \item \link[AnnotationDbi]{get,ANY,Bimap,missing-method} in the 68 | \pkg{AnnotationDbi} package for an example of a specific \code{get} 69 | method (defined for \link[AnnotationDbi]{Bimap} objects). 70 | 71 | \item \link{BiocGenerics} for a summary of all the generics defined 72 | in the \pkg{BiocGenerics} package. 73 | } 74 | } 75 | 76 | \examples{ 77 | get # note the dispatch on the 'x', 'pos' and 'envir' args only 78 | showMethods("get") 79 | selectMethod("get", c("ANY", "ANY", "ANY")) # the default method 80 | 81 | mget # note the dispatch on the 'x' and 'envir' args only 82 | showMethods("mget") 83 | selectMethod("mget", c("ANY", "ANY")) # the default method 84 | } 85 | 86 | \keyword{methods} 87 | -------------------------------------------------------------------------------- /man/rank.Rd: -------------------------------------------------------------------------------- 1 | \name{rank} 2 | 3 | \alias{rank} 4 | 5 | \title{Ranks the values in a vector-like object} 6 | 7 | \description{ 8 | Returns the ranks of the values in a vector-like object. 9 | Ties (i.e., equal values) and missing values can be handled in several ways. 10 | 11 | NOTE: This man page is for the \code{rank} 12 | \emph{S4 generic function} defined in the \pkg{BiocGenerics} package. 13 | See \code{?base::\link[base]{rank}} for the default method 14 | (defined in the \pkg{base} package). 15 | Bioconductor packages can define specific methods for objects 16 | not supported by the default method. 17 | } 18 | 19 | \usage{ 20 | rank(x, na.last=TRUE, 21 | ties.method=c("average", "first", "last", "random", "max", "min"), 22 | ...) 23 | } 24 | 25 | \arguments{ 26 | \item{x}{ 27 | A vector-like object. 28 | } 29 | \item{na.last, ties.method}{ 30 | See \code{?base::\link[base]{rank}} for a description of 31 | these arguments. 32 | } 33 | \item{...}{ 34 | Additional arguments, for use in specific methods. 35 | 36 | Note that \code{base::\link[base]{rank}} (the default method) only 37 | takes the \code{x}, \code{na.last}, and \code{ties.method} arguments. 38 | } 39 | } 40 | 41 | \value{ 42 | See \code{?base::\link[base]{rank}} for the value returned 43 | by the default method. 44 | 45 | Specific methods defined in Bioconductor packages should 46 | behave as consistently as possible with the default method. 47 | } 48 | 49 | \note{ 50 | TO DEVELOPERS: 51 | 52 | See note in \code{?BiocGenerics::\link[BiocGenerics]{order}} 53 | about "stable" order. 54 | 55 | \code{\link[BiocGenerics]{order}}, \code{\link[BiocGenerics]{sort}}, 56 | and \code{\link[BiocGenerics]{rank}} methods for specific vector-like 57 | objects should adhere to the same underlying order that should be 58 | conceptually defined as a binary relation on the set of all possible 59 | vector values. For completeness, this binary relation should also be 60 | incarnated by a \link{<=} method. 61 | } 62 | 63 | \seealso{ 64 | \itemize{ 65 | \item \code{base::\link[base]{rank}} for the default \code{rank} method. 66 | 67 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 68 | methods defined for a given generic function. 69 | 70 | \item \code{\link[methods]{selectMethod}} for getting the definition of 71 | a specific method. 72 | 73 | \item \link[S4Vectors]{rank,Vector-method} in the \pkg{S4Vectors} package 74 | for an example of a specific \code{rank} method (defined for 75 | \link[S4Vectors]{Vector} objects). 76 | 77 | \item \link{BiocGenerics} for a summary of all the generics defined 78 | in the \pkg{BiocGenerics} package. 79 | } 80 | } 81 | 82 | \examples{ 83 | rank # note the dispatch on the 'x' arg only 84 | showMethods("rank") 85 | selectMethod("rank", "ANY") # the default method 86 | } 87 | 88 | \keyword{methods} 89 | -------------------------------------------------------------------------------- /man/dims.Rd: -------------------------------------------------------------------------------- 1 | \name{dims} 2 | 3 | \alias{dims} 4 | \alias{nrows} 5 | \alias{ncols} 6 | 7 | \title{Get the dimensions of each element of a list-like object} 8 | 9 | \description{ 10 | Get the dimensions, number of rows, or number of columns, of each element 11 | of a list-like object. 12 | 13 | Note that these functions are the \emph{vectorized versions} of 14 | corresponding functions \code{dim()}, \code{nrow()}, and \code{ncol()}, 15 | in the same fashion that \code{lengths()} is the \emph{vectorized version} 16 | of \code{length}. 17 | } 18 | 19 | \usage{ 20 | dims(x, use.names=TRUE) 21 | nrows(x, use.names=TRUE) 22 | ncols(x, use.names=TRUE) 23 | } 24 | 25 | \arguments{ 26 | \item{x}{ 27 | List-like object (or environment) where all the list elements 28 | are expected to be array-like objects with the \emph{same number 29 | of dimensions}. 30 | } 31 | \item{use.names}{ 32 | Logical indicating if the names on \code{x} should be propagated to 33 | the returned matrix (as its rownames) or vector (as its names). 34 | } 35 | } 36 | 37 | \value{ 38 | For \code{dims()}: Typically a numeric matrix with one row per list element 39 | in \code{x} and one column per dimension in these list elements (they're 40 | all expected to have the same number of dimensions). The i-th row in the 41 | returned matrix is a vector containing the dimensions of the i-th list 42 | element in \code{x}. More formally: 43 | \preformatted{ dims(x)[i, ] is dim(x[[i]])} 44 | for any valid \code{i}. 45 | By default the names on \code{x}, if any, are propagated as the rownames 46 | of the returned matrix, unless \code{use.names} is set to \code{FALSE}. 47 | 48 | For \code{nrows()} or \code{ncols()}: A numeric vector with one element 49 | per list element in \code{x}. The i-th element in the returned vector is 50 | the number of rows (or columns) of the i-th list element in \code{x}. 51 | More formally: 52 | \preformatted{ nrows(x)[i] is nrow(x[[i]]) and ncols(x)[i] is ncol(x[[i]])} 53 | for any valid \code{i}. 54 | By default the names on \code{x}, if any, are propagated on the returned 55 | vector, unless \code{use.names} is set to \code{FALSE}. 56 | } 57 | 58 | \seealso{ 59 | \itemize{ 60 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 61 | methods defined for a given generic function. 62 | 63 | \item \code{\link[methods]{selectMethod}} for getting the definition of 64 | a specific method. 65 | 66 | \item \link[IRanges]{dims,DataFrameList-method} in the 67 | \pkg{IRanges} package for an example of a specific 68 | \code{dims} method (defined for \link[IRanges]{DataFrameList} 69 | objects). 70 | 71 | \item \link{BiocGenerics} for a summary of all the generics defined 72 | in the \pkg{BiocGenerics} package. 73 | } 74 | } 75 | 76 | \examples{ 77 | dims 78 | showMethods("dims") 79 | 80 | library(IRanges) 81 | showMethods("dims") 82 | selectMethod("dims", "DataFrameList") 83 | } 84 | 85 | \keyword{methods} 86 | -------------------------------------------------------------------------------- /man/which.min.Rd: -------------------------------------------------------------------------------- 1 | \name{which.min} 2 | 3 | \alias{which.min} 4 | \alias{which.max} 5 | 6 | \title{What's the index of the first min or max value in an object?} 7 | 8 | \description{ 9 | Determines the location (i.e. index) of the (first) minimum or 10 | maximum value in an object. 11 | 12 | NOTE: This man page is for the \code{which.min} and \code{which.max} 13 | \emph{S4 generic functions} defined in the \pkg{BiocGenerics} package. 14 | See \code{?base::\link[base]{which.min}} for the default methods (defined 15 | in the \pkg{base} package). 16 | Bioconductor packages can define specific methods for objects (typically 17 | vector-, array-, or list-like) not supported by the default methods. 18 | } 19 | 20 | \usage{ 21 | which.min(x, ...) 22 | which.max(x, ...) 23 | } 24 | 25 | \arguments{ 26 | \item{x}{ 27 | An object, typically with a vector-, array-, or list-like semantic. 28 | } 29 | \item{...}{ 30 | Additional arguments, for use in specific methods. 31 | } 32 | } 33 | 34 | \value{ 35 | See \code{?base::\link[base]{which.min}} for the value returned by the 36 | default methods. 37 | 38 | Specific methods defined in Bioconductor packages should 39 | behave as consistently as possible with the default methods. 40 | } 41 | 42 | \note{ 43 | The default methods (defined in the \pkg{base} package) only take a 44 | single argument. We've added the \code{...} argument to the generic 45 | functions defined in the \pkg{BiocGenerics} package so they 46 | can be called with an arbitrary number of effective arguments. 47 | This typically allows methods to add extra arguments for 48 | controlling/altering the behavior of the operation. Like for 49 | example the \code{global} argument supported by the \code{which.max} 50 | method for \link[IRanges]{NumericList} objects (defined in the 51 | \pkg{IRanges} package). 52 | } 53 | 54 | \seealso{ 55 | \itemize{ 56 | \item \code{base::\link[base]{which.min}} for the default \code{which.min} 57 | and \code{which.max} methods. 58 | 59 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 60 | methods defined for a given generic function. 61 | 62 | \item \code{\link[methods]{selectMethod}} for getting the definition of 63 | a specific method. 64 | 65 | \item \link[IRanges]{which.max,NumericList-method} in the \pkg{IRanges} 66 | package for an example of a specific \code{which.max} method 67 | (defined for \link[IRanges]{NumericList} objects). 68 | 69 | \item \link{BiocGenerics} for a summary of all the generics defined 70 | in the \pkg{BiocGenerics} package. 71 | } 72 | } 73 | 74 | \examples{ 75 | which.min 76 | showMethods("which.min") 77 | selectMethod("which.min", "ANY") # the default method 78 | 79 | which.max 80 | showMethods("which.max") 81 | selectMethod("which.max", "ANY") # the default method 82 | 83 | library(IRanges) 84 | showMethods("which.max") 85 | ## The which.max() method for NumericList objects: 86 | selectMethod("which.max", "NumericList") 87 | } 88 | 89 | \keyword{methods} 90 | -------------------------------------------------------------------------------- /man/match.Rd: -------------------------------------------------------------------------------- 1 | \name{match} 2 | 3 | \alias{match} 4 | \alias{\%in\%} 5 | 6 | \title{Value matching} 7 | 8 | \description{ 9 | \code{match} returns a vector of the positions of (first) matches of 10 | its first argument in its second. 11 | 12 | \code{\%in\%} is a binary operator that returns a logical vector of the 13 | length of its left operand indicating if the elements in it have a match 14 | or not. 15 | 16 | NOTE: This man page is for the \code{match} and \code{\%in\%} \emph{S4 17 | generic functions} defined in the \pkg{BiocGenerics} package. 18 | See \code{?base::\link[base]{match}} for the default methods 19 | (defined in the \pkg{base} package). 20 | Bioconductor packages can define specific methods for objects 21 | (typically vector-like) not supported by the default methods. 22 | } 23 | 24 | \usage{ 25 | match(x, table, nomatch=NA_integer_, incomparables=NULL, ...) 26 | 27 | x \%in\% table 28 | } 29 | 30 | \arguments{ 31 | \item{x, table}{ 32 | Vector-like objects (typically of the same class, but not necessarily). 33 | } 34 | \item{nomatch, incomparables}{ 35 | See \code{?base::\link[base]{match}} for a description of 36 | these arguments. 37 | } 38 | \item{...}{ 39 | Additional arguments, for use in specific methods. 40 | } 41 | } 42 | 43 | \value{ 44 | The same as the default methods (see \code{?base::\link[base]{match}} for 45 | the value returned by the default methods). 46 | 47 | Specific methods defined in Bioconductor packages should 48 | behave as consistently as possible with the default methods. 49 | } 50 | 51 | \note{ 52 | The default \code{base::\link[base]{match}} method (defined in the \pkg{base} 53 | package) doesn't have the \code{...} argument. We've added it to the generic 54 | function defined in the \pkg{BiocGenerics} package in order to allow specific 55 | methods to support additional arguments if needed. 56 | } 57 | 58 | \seealso{ 59 | \itemize{ 60 | \item \code{base::\link[base]{match}} for the default \code{match} and 61 | \code{\%in\%} methods. 62 | 63 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 64 | methods defined for a given generic function. 65 | 66 | \item \code{\link[methods]{selectMethod}} for getting the definition of 67 | a specific method. 68 | 69 | \item \link[S4Vectors]{match,Hits,Hits-method} and 70 | \link[S4Vectors]{\%in\%,Rle,ANY-method} in the \pkg{S4Vectors} 71 | package for examples of specific \code{match} and \code{\%in\%} 72 | methods (defined for \link[S4Vectors]{Hits} and 73 | \link[S4Vectors]{Rle} objects, respectively). 74 | 75 | \item \link{BiocGenerics} for a summary of all the generics defined 76 | in the \pkg{BiocGenerics} package. 77 | } 78 | } 79 | 80 | \examples{ 81 | match # note the dispatch on the 'x' and 'table' args only 82 | showMethods("match") 83 | selectMethod("match", c("ANY", "ANY")) # the default method 84 | 85 | `\%in\%` 86 | showMethods("\%in\%") 87 | selectMethod("\%in\%", c("ANY", "ANY")) # the default method 88 | } 89 | 90 | \keyword{methods} 91 | -------------------------------------------------------------------------------- /man/duplicated.Rd: -------------------------------------------------------------------------------- 1 | \name{duplicated} 2 | 3 | \alias{duplicated} 4 | \alias{anyDuplicated} 5 | 6 | \title{Determine duplicate elements} 7 | 8 | \description{ 9 | Determines which elements of a vector-like or data-frame-like object 10 | are duplicates of elements with smaller subscripts, and returns a 11 | logical vector indicating which elements (rows) are duplicates. 12 | 13 | NOTE: This man page is for the \code{duplicated} and \code{anyDuplicated} 14 | \emph{S4 generic functions} defined in the \pkg{BiocGenerics} package. 15 | See \code{?base::\link[base]{duplicated}} for the default methods 16 | (defined in the \pkg{base} package). 17 | Bioconductor packages can define specific methods for objects 18 | (typically vector-like or data-frame-like) not supported by the 19 | default method. 20 | } 21 | 22 | \usage{ 23 | duplicated(x, incomparables=FALSE, ...) 24 | anyDuplicated(x, incomparables=FALSE, ...) 25 | } 26 | 27 | \arguments{ 28 | \item{x}{ 29 | A vector-like or data-frame-like object. 30 | } 31 | \item{incomparables, ...}{ 32 | See \code{?base::\link[base]{duplicated}} for a description of 33 | these arguments. 34 | } 35 | } 36 | 37 | \value{ 38 | The default \code{duplicated} method (see 39 | \code{?base::\link[base]{duplicated}}) returns a logical vector 40 | of length N where N is: 41 | \itemize{ 42 | \item \code{length(x)} when \code{x} is a vector; 43 | \item \code{nrow(x)} when \code{x} is a data frame. 44 | } 45 | 46 | Specific \code{duplicated} methods defined in Bioconductor 47 | packages must also return a logical vector of the same length 48 | as \code{x} when \code{x} is a vector-like object, and a logical 49 | vector with one element for each row when \code{x} is a 50 | data-frame-like object. 51 | 52 | The default \code{anyDuplicated} method (see 53 | \code{?base::\link[base]{duplicated}}) returns a single 54 | non-negative integer and so must the specific \code{anyDuplicated} 55 | methods defined in Bioconductor packages. 56 | 57 | \code{anyDuplicated} should always behave consistently with 58 | \code{duplicated}. 59 | } 60 | 61 | \seealso{ 62 | \itemize{ 63 | \item \code{base::\link[base]{duplicated}} for the default 64 | \code{duplicated} and \code{anyDuplicated} methods. 65 | 66 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 67 | methods defined for a given generic function. 68 | 69 | \item \code{\link[methods]{selectMethod}} for getting the definition of 70 | a specific method. 71 | 72 | \item \link[S4Vectors]{duplicated,Rle-method} in the \pkg{S4Vectors} 73 | package for an example of a specific \code{duplicated} method 74 | (defined for \link[S4Vectors]{Rle} objects). 75 | 76 | \item \link{BiocGenerics} for a summary of all the generics defined 77 | in the \pkg{BiocGenerics} package. 78 | } 79 | } 80 | 81 | \examples{ 82 | duplicated 83 | showMethods("duplicated") 84 | selectMethod("duplicated", "ANY") # the default method 85 | 86 | anyDuplicated 87 | showMethods("anyDuplicated") 88 | selectMethod("anyDuplicated", "ANY") # the default method 89 | } 90 | 91 | \keyword{methods} 92 | -------------------------------------------------------------------------------- /man/strand.Rd: -------------------------------------------------------------------------------- 1 | \name{strand} 2 | 3 | \alias{strand} 4 | \alias{strand<-} 5 | \alias{unstrand} 6 | \alias{invertStrand} 7 | \alias{invertStrand,ANY-method} 8 | 9 | \title{Accessing strand information} 10 | 11 | \description{ 12 | Get or set the strand information contained in an object. 13 | } 14 | 15 | \usage{ 16 | strand(x, ...) 17 | strand(x, ...) <- value 18 | 19 | unstrand(x) 20 | 21 | invertStrand(x) 22 | \S4method{invertStrand}{ANY}(x) 23 | } 24 | 25 | \arguments{ 26 | \item{x}{ 27 | An object containing strand information. 28 | } 29 | \item{...}{ 30 | Additional arguments, for use in specific methods. 31 | } 32 | \item{value}{ 33 | The strand information to set on \code{x}. 34 | } 35 | } 36 | 37 | \details{ 38 | All the \code{strand} methods defined in the \pkg{GenomicRanges} package 39 | use the same set of 3 values (called the "standard strand levels") to 40 | specify the strand of a genomic location: \code{+}, \code{-}, and \code{*}. 41 | \code{*} is used when the exact strand of the location is unknown, 42 | or irrelevant, or when the "feature" at that location belongs to 43 | both strands. 44 | 45 | Note that \code{unstrand} is not a generic function, just a convenience 46 | wrapper to the generic \code{strand()} setter (\code{strand<-}) that does: 47 | \preformatted{ strand(x) <- "*" 48 | x 49 | } 50 | The default method for \code{invertStrand} does: 51 | \preformatted{ strand(x) <- invertStrand(strand(x)) 52 | x 53 | } 54 | } 55 | 56 | \value{ 57 | If \code{x} is a vector-like object, \code{strand(x)} will typically 58 | return a vector-like object \emph{parallel} to \code{x}, that is, an 59 | object of the same length as \code{x} where the i-th element describes 60 | the strand of the i-th element in \code{x}. 61 | 62 | \code{unstrand(x)} and \code{invertStrand(x)} return a copy of \code{x} 63 | with the strand set to \code{"*"} for \code{unstrand} or inverted for 64 | \code{invertStrand} (i.e. \code{"+"} and \code{"-"} switched, and 65 | \code{"*"} untouched). 66 | } 67 | 68 | \seealso{ 69 | \itemize{ 70 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 71 | methods defined for a given generic function. 72 | 73 | \item \code{\link[methods]{selectMethod}} for getting the definition of 74 | a specific method. 75 | 76 | \item \link[GenomicRanges]{strand,GRanges-method} in the 77 | \pkg{GenomicRanges} package for an example of a specific 78 | \code{strand} method (defined for \link[GenomicRanges]{GRanges} 79 | objects). 80 | 81 | \item \link{BiocGenerics} for a summary of all the generics defined 82 | in the \pkg{BiocGenerics} package. 83 | } 84 | } 85 | 86 | \examples{ 87 | strand 88 | showMethods("strand") 89 | 90 | `strand<-` 91 | showMethods("strand<-") 92 | 93 | unstrand 94 | 95 | invertStrand 96 | showMethods("invertStrand") 97 | selectMethod("invertStrand", "ANY") # the default method 98 | 99 | library(GenomicRanges) 100 | 101 | showMethods("strand") 102 | selectMethod("strand", "missing") 103 | strand() 104 | 105 | showMethods("strand<-") 106 | } 107 | 108 | \keyword{methods} 109 | -------------------------------------------------------------------------------- /man/row_colnames.Rd: -------------------------------------------------------------------------------- 1 | \name{row+colnames} 2 | 3 | \alias{row+colnames} 4 | \alias{rownames} 5 | \alias{rownames<-} 6 | \alias{colnames} 7 | \alias{colnames<-} 8 | 9 | \title{Row and column names} 10 | 11 | \description{ 12 | Get or set the row or column names of a matrix-like object. 13 | 14 | NOTE: This man page is for the \code{rownames}, \code{`rownames<-`}, 15 | \code{colnames}, and \code{`colnames<-`} \emph{S4 generic functions} 16 | defined in the \pkg{BiocGenerics} package. 17 | See \code{?base::\link[base]{rownames}} for the default methods 18 | (defined in the \pkg{base} package). 19 | Bioconductor packages can define specific methods for objects 20 | (typically matrix-like) not supported by the default methods. 21 | } 22 | 23 | \usage{ 24 | rownames(x, do.NULL=TRUE, prefix="row") 25 | rownames(x) <- value 26 | 27 | colnames(x, do.NULL=TRUE, prefix="col") 28 | colnames(x) <- value 29 | } 30 | 31 | \arguments{ 32 | \item{x}{ 33 | A matrix-like object. 34 | } 35 | \item{do.NULL, prefix}{ 36 | See \code{?base::\link[base]{rownames}} for a description of 37 | these arguments. 38 | } 39 | \item{value}{ 40 | Either \code{NULL} or a character vector equal of length equal to the 41 | appropriate dimension. 42 | } 43 | } 44 | 45 | \value{ 46 | The getters will return \code{NULL} or a character vector of length 47 | \code{\link{nrow}(x)} for \code{rownames} and length \code{\link{ncol}(x)} 48 | for \code{colnames(x)}. 49 | 50 | See \code{?base::\link[base]{rownames}} for more information about the 51 | default methods, including how the setters are expected to behave. 52 | 53 | Specific methods defined in Bioconductor packages should 54 | behave as consistently as possible with the default methods. 55 | } 56 | 57 | \seealso{ 58 | \itemize{ 59 | \item \code{base::\link[base]{rownames}} for the default \code{rownames}, 60 | \code{`rownames<-`}, \code{colnames}, and \code{`colnames<-`} 61 | methods. 62 | 63 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 64 | methods defined for a given generic function. 65 | 66 | \item \code{\link[methods]{selectMethod}} for getting the definition of 67 | a specific method. 68 | 69 | \item \link[S4Vectors]{rownames,DataFrame-method} in the \pkg{S4Vectors} 70 | package for an example of a specific \code{rownames} method (defined 71 | for \link[S4Vectors]{DataFrame} objects). 72 | 73 | \item \link{BiocGenerics} for a summary of all the generics defined 74 | in the \pkg{BiocGenerics} package. 75 | } 76 | } 77 | 78 | \examples{ 79 | ## rownames() getter: 80 | rownames # note the dispatch on the 'x' arg only 81 | showMethods("rownames") 82 | selectMethod("rownames", "ANY") # the default method 83 | 84 | ## rownames() setter: 85 | `rownames<-` 86 | showMethods("rownames<-") 87 | selectMethod("rownames<-", "ANY") # the default method 88 | 89 | ## colnames() getter: 90 | colnames # note the dispatch on the 'x' arg only 91 | showMethods("colnames") 92 | selectMethod("colnames", "ANY") # the default method 93 | 94 | ## colnames() setter: 95 | `colnames<-` 96 | showMethods("colnames<-") 97 | selectMethod("colnames<-", "ANY") # the default method 98 | } 99 | 100 | \keyword{methods} 101 | -------------------------------------------------------------------------------- /man/order.Rd: -------------------------------------------------------------------------------- 1 | \name{order} 2 | 3 | \alias{order} 4 | 5 | \title{Ordering permutation} 6 | 7 | \description{ 8 | \code{order} returns a permutation which rearranges its first argument 9 | into ascending or descending order, breaking ties by further 10 | arguments. 11 | 12 | NOTE: This man page is for the \code{order} \emph{S4 generic function} 13 | defined in the \pkg{BiocGenerics} package. 14 | See \code{?base::\link[base]{order}} for the default method 15 | (defined in the \pkg{base} package). 16 | Bioconductor packages can define specific methods for objects 17 | (typically vector-like) not supported by the default method. 18 | } 19 | 20 | \usage{ 21 | order(..., na.last=TRUE, decreasing=FALSE, method=c("auto", "shell", "radix")) 22 | } 23 | 24 | \arguments{ 25 | \item{...}{ 26 | One or more vector-like objects, all of the same length. 27 | } 28 | \item{na.last, decreasing, method}{ 29 | See \code{?base::\link[base]{order}} for a description of 30 | these arguments. 31 | } 32 | } 33 | 34 | \value{ 35 | The default method (see \code{?base::\link[base]{order}}) returns 36 | an integer vector of length N where N is the common length of the 37 | input objects. This integer vector represents a permutation of N 38 | elements and can be used to rearrange the first argument in 39 | \code{...} into ascending or descending order (by subsetting it). 40 | 41 | Specific methods defined in Bioconductor packages should also 42 | return an integer vector representing a permutation of N elements. 43 | } 44 | 45 | \note{ 46 | TO DEVELOPERS: 47 | 48 | Specific \code{order} methods should preferably be made "stable" for 49 | consistent behavior across platforms and consistency with 50 | \code{base::order()}. Note that C qsort() is \emph{not} "stable" so 51 | \code{order} methods that use qsort() at the C-level need to ultimately 52 | break ties by position, which can easily be done by adding a little 53 | extra code at the end of the comparison function passed to qsort(). 54 | 55 | \code{order(x, decreasing=TRUE)} is \emph{not} always equivalent to 56 | \code{rev(order(x))}. 57 | 58 | \code{\link[BiocGenerics]{order}}, \code{\link[BiocGenerics]{sort}}, 59 | and \code{\link[BiocGenerics]{rank}} methods for specific vector-like 60 | objects should adhere to the same underlying order that should be 61 | conceptually defined as a binary relation on the set of all possible 62 | vector values. For completeness, this binary relation should also be 63 | incarnated by a \link{<=} method. 64 | } 65 | 66 | \seealso{ 67 | \itemize{ 68 | \item \code{base::\link[base]{order}} for the default \code{order} method. 69 | 70 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 71 | methods defined for a given generic function. 72 | 73 | \item \code{\link[methods]{selectMethod}} for getting the definition of 74 | a specific method. 75 | 76 | \item \link[IRanges]{order,IntegerRanges-method} in the \pkg{IRanges} 77 | package for an example of a specific \code{order} method (defined 78 | for \link[IRanges]{IntegerRanges} objects). 79 | 80 | \item \link{BiocGenerics} for a summary of all the generics defined 81 | in the \pkg{BiocGenerics} package. 82 | } 83 | } 84 | 85 | \examples{ 86 | order 87 | showMethods("order") 88 | selectMethod("order", "ANY") # the default method 89 | } 90 | 91 | \keyword{methods} 92 | -------------------------------------------------------------------------------- /man/organism_species.Rd: -------------------------------------------------------------------------------- 1 | \name{organism_species} 2 | 3 | \alias{organism_species} 4 | \alias{organism} 5 | \alias{organism<-} 6 | \alias{species} 7 | \alias{species<-} 8 | 9 | \title{Organism and species accessors} 10 | 11 | \description{ 12 | Get or set the organism and/or species of an object. 13 | } 14 | 15 | \usage{ 16 | organism(object) 17 | organism(object) <- value 18 | 19 | species(object) 20 | species(object) <- value 21 | } 22 | 23 | \arguments{ 24 | \item{object}{ 25 | An object to get or set the organism or species of. 26 | } 27 | \item{value}{ 28 | The organism or species to set on \code{object}. 29 | } 30 | } 31 | 32 | \value{ 33 | \code{organism} should return the \emph{scientific name} (i.e. genus and 34 | species, or genus and species and subspecies) of the organism. Preferably 35 | in the format \code{"Genus species"} (e.g. \code{"Homo sapiens"}) 36 | or \code{"Genus species subspecies"} (e.g. 37 | \code{"Homo sapiens neanderthalensis"}). 38 | 39 | \code{species} should of course return the species of the organism. 40 | Unfortunately there is a long history of misuse of this accessor in 41 | Bioconductor so its usage is now discouraged (starting with BioC 3.1). 42 | } 43 | 44 | \note{ 45 | TO DEVELOPERS: 46 | 47 | \code{species} has been historically misused in many places in Bioconductor 48 | and is redundant with \code{organism}. So implementing the \code{species} 49 | accessor is now discouraged (starting with BioC 3.1). The \code{organism} 50 | accessor (returning the \emph{scientific name}) should be implemented 51 | instead. 52 | } 53 | 54 | \seealso{ 55 | \itemize{ 56 | \item \url{http://bioconductor.org/packages/release/BiocViews.html#___Organism} 57 | for browsing the annotation packages currently available in 58 | Bioconductor by organism. 59 | 60 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 61 | methods defined for a given generic function. 62 | 63 | \item \code{\link[methods]{selectMethod}} for getting the definition of 64 | a specific method. 65 | 66 | \item \link[annotate]{organism,character-method} and 67 | \link[annotate]{organism,chromLocation-method} in the 68 | \pkg{annotate} package for examples of specific \code{organism} 69 | methods (defined for character and \link[annotate]{chromLocation} 70 | objects). 71 | 72 | \item \link[AnnotationDbi]{species,AnnotationDb-method} in the 73 | \pkg{AnnotationDbi} package for an example of a specific 74 | \code{species} method (defined for \link[AnnotationDbi]{AnnotationDb} 75 | objects). 76 | 77 | \item \link{BiocGenerics} for a summary of all the generics defined 78 | in the \pkg{BiocGenerics} package. 79 | } 80 | } 81 | 82 | \examples{ 83 | ## organism() getter: 84 | organism 85 | showMethods("organism") 86 | 87 | library(annotate) 88 | showMethods("organism") 89 | selectMethod("organism", "character") 90 | selectMethod("organism", "chromLocation") 91 | 92 | ## organism() setter: 93 | `organism<-` 94 | showMethods("organism<-") 95 | 96 | ## species() getter: 97 | species 98 | showMethods("species") 99 | 100 | library(AnnotationDbi) 101 | selectMethod("species", "AnnotationDb") 102 | 103 | ## species() setter: 104 | `species<-` 105 | showMethods("species<-") 106 | } 107 | 108 | \keyword{methods} 109 | -------------------------------------------------------------------------------- /man/start.Rd: -------------------------------------------------------------------------------- 1 | \name{start} 2 | 3 | \alias{start} 4 | \alias{start<-} 5 | \alias{end} 6 | \alias{end<-} 7 | \alias{width} 8 | \alias{width<-} 9 | \alias{pos} 10 | 11 | \title{The start(), end(), width(), and pos() generic getters and setters} 12 | 13 | \description{ 14 | Get or set the start, end, width, or single positions stored in an object. 15 | 16 | NOTE: This man page is for the \code{start}, \code{`start<-`}, 17 | \code{end}, \code{`end<-`}, \code{width}, \code{`width<-`}, and 18 | \code{pos} \emph{S4 generic functions} defined in the \pkg{BiocGenerics} 19 | package. 20 | See \code{?stats::\link[stats]{start}} for the \code{start} and \code{end} 21 | S3 generics defined in the \pkg{stats} package. 22 | } 23 | 24 | \usage{ 25 | start(x, ...) 26 | start(x, ...) <- value 27 | 28 | end(x, ...) 29 | end(x, ...) <- value 30 | 31 | width(x) 32 | width(x, ...) <- value 33 | 34 | pos(x) 35 | } 36 | 37 | \arguments{ 38 | \item{x}{ 39 | For the \code{start()}, \code{end()}, and \code{width()} getters/setters: 40 | an object containing start, end, and width values. 41 | 42 | For the \code{pos{}} getter: an object containing single positions. 43 | } 44 | \item{...}{ 45 | Additional arguments, for use in specific methods. 46 | } 47 | \item{value}{ 48 | The start, end, or width values to set on \code{x}. 49 | } 50 | } 51 | 52 | \value{ 53 | See specific methods defined in Bioconductor packages. 54 | } 55 | 56 | \seealso{ 57 | \itemize{ 58 | \item \code{stats::\link[stats]{start}} in the \pkg{stats} package 59 | for the \code{start} and \code{end} S3 generics. 60 | 61 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 62 | methods defined for a given generic function. 63 | 64 | \item \code{\link[methods]{selectMethod}} for getting the definition of 65 | a specific method. 66 | 67 | \item \link[IRanges]{start,IRanges-method} in the \pkg{IRanges} 68 | package for examples of specific \code{start}, \code{end}, and 69 | \code{width} methods (defined for \link[IRanges]{IRanges} objects). 70 | 71 | \item \link[IRanges]{pos,UnstitchedIPos-method} in the \pkg{IRanges} 72 | package for an example of a specific \code{pos} method 73 | (defined for \link[IRanges]{UnstitchedIPos} objects). 74 | 75 | \item \link{BiocGenerics} for a summary of all the generics defined 76 | in the \pkg{BiocGenerics} package. 77 | } 78 | } 79 | 80 | \examples{ 81 | ## start() getter: 82 | start 83 | showMethods("start") 84 | 85 | library(IRanges) 86 | showMethods("start") 87 | selectMethod("start", "IRanges") # start() getter for IRanges objects 88 | 89 | ## start() setter: 90 | `start<-` 91 | showMethods("start<-") 92 | selectMethod("start<-", "IRanges") # start() setter for IRanges objects 93 | 94 | ## end() getter: 95 | end 96 | showMethods("end") 97 | selectMethod("end", "IRanges") # end() getter for IRanges objects 98 | 99 | ## end() setter: 100 | `end<-` 101 | showMethods("end<-") 102 | selectMethod("end<-", "IRanges") # end() setter for IRanges objects 103 | 104 | ## width() getter: 105 | width 106 | showMethods("width") 107 | selectMethod("width", "IRanges") # width() getter for IRanges objects 108 | 109 | ## width() setter: 110 | `width<-` 111 | showMethods("width<-") 112 | selectMethod("width<-", "IRanges") # width() setter for IRanges objects 113 | 114 | ## pos() getter: 115 | pos 116 | showMethods("pos") 117 | selectMethod("pos", "UnstitchedIPos") # pos() getter for UnstitchedIPos 118 | # objects 119 | } 120 | 121 | \keyword{methods} 122 | -------------------------------------------------------------------------------- /man/funprog.Rd: -------------------------------------------------------------------------------- 1 | \name{funprog} 2 | 3 | \alias{funprog} 4 | \alias{Reduce} 5 | \alias{Filter} 6 | \alias{Find} 7 | \alias{Map} 8 | \alias{Position} 9 | 10 | \title{Common higher-order functions in functional programming languages} 11 | 12 | \description{ 13 | \code{Reduce} uses a binary function to successively combine the 14 | elements of a given list-like or vector-like object and a possibly 15 | given initial value. 16 | \code{Filter} extracts the elements of a list-like or vector-like 17 | object for which a predicate (logical) function gives true. 18 | \code{Find} and \code{Position} give the first or last such element 19 | and its position in the object, respectively. 20 | \code{Map} applies a function to the corresponding elements of given 21 | list-like or vector-like objects. 22 | 23 | NOTE: This man page is for the \code{Reduce}, \code{Filter}, 24 | \code{Find}, \code{Map} and \code{Position} \emph{S4 generic functions} 25 | defined in the \pkg{BiocGenerics} package. 26 | See \code{?base::\link[base]{Reduce}} for the default methods 27 | (defined in the \pkg{base} package). 28 | Bioconductor packages can define specific methods for objects 29 | (typically list-like or vector-like) not supported by the 30 | default methods. 31 | } 32 | 33 | \usage{ 34 | Reduce(f, x, init, right=FALSE, accumulate=FALSE, simplify=TRUE) 35 | Filter(f, x) 36 | Find(f, x, right=FALSE, nomatch=NULL) 37 | Map(f, ...) 38 | Position(f, x, right=FALSE, nomatch=NA_integer_) 39 | } 40 | 41 | \arguments{ 42 | \item{f, init, right, accumulate, nomatch, simplify}{ 43 | See \code{?base::\link[base]{Reduce}} for a description of 44 | these arguments. 45 | } 46 | \item{x}{ 47 | A list-like or vector-like object. 48 | } 49 | \item{...}{ 50 | One or more list-like or vector-like objects. 51 | } 52 | } 53 | 54 | \value{ 55 | See \code{?base::\link[base]{Reduce}} for the value returned by the 56 | default methods. 57 | 58 | Specific methods defined in Bioconductor packages should 59 | behave as consistently as possible with the default methods. 60 | } 61 | 62 | \seealso{ 63 | \itemize{ 64 | \item \code{base::\link[base]{Reduce}} for the default \code{Reduce}, 65 | \code{Filter}, \code{Find}, \code{Map} and \code{Position} methods. 66 | 67 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 68 | methods defined for a given generic function. 69 | 70 | \item \code{\link[methods]{selectMethod}} for getting the definition of 71 | a specific method. 72 | 73 | \item \link[S4Vectors]{Reduce,List-method} in the \pkg{S4Vectors} package 74 | for an example of a specific \code{Reduce} method (defined for 75 | \link[S4Vectors]{List} objects). 76 | 77 | \item \link{BiocGenerics} for a summary of all the generics defined 78 | in the \pkg{BiocGenerics} package. 79 | } 80 | } 81 | 82 | \examples{ 83 | Reduce # note the dispatch on the 'x' arg only 84 | showMethods("Reduce") 85 | selectMethod("Reduce", "ANY") # the default method 86 | 87 | Filter # note the dispatch on the 'x' arg only 88 | showMethods("Filter") 89 | selectMethod("Filter", "ANY") # the default method 90 | 91 | Find # note the dispatch on the 'x' arg only 92 | showMethods("Find") 93 | selectMethod("Find", "ANY") # the default method 94 | 95 | Map # note the dispatch on the '...' arg only 96 | showMethods("Map") 97 | selectMethod("Map", "ANY") # the default method 98 | 99 | Position # note the dispatch on the 'x' arg only 100 | showMethods("Position") 101 | selectMethod("Position", "ANY") # the default method 102 | } 103 | 104 | \keyword{methods} 105 | -------------------------------------------------------------------------------- /R/testPackage.R: -------------------------------------------------------------------------------- 1 | ### 2 | 3 | packageRoot <- function(path) 4 | { 5 | hasDescription <- function(path) { 6 | file.exists(file.path(path, "DESCRIPTION")) 7 | } 8 | isRoot <- function(path) { 9 | identical(path, dirname(path)) 10 | } 11 | while (!hasDescription(path) && !isRoot(path)) { 12 | path <- dirname(path) 13 | } 14 | if (isRoot(path)) { 15 | NULL 16 | } else { 17 | path 18 | } 19 | } 20 | 21 | packageInfo <- function(path) 22 | { 23 | as.data.frame(read.dcf(file.path(path, "DESCRIPTION")), 24 | stringsAsFactors=FALSE) 25 | } 26 | 27 | testPackage <- function(pkgname = NULL, 28 | subdir="unitTests", 29 | pattern="^test_.*\\.R$", 30 | path = getwd()) 31 | { 32 | .failure_details <- function(result) { 33 | res <- result[[1L]] 34 | if (res$nFail > 0 || res$nErr > 0) { 35 | Filter(function(x) length(x) > 0, 36 | lapply(res$sourceFileResults, 37 | function(fileRes) { 38 | names(Filter(function(x) x$kind != "success", 39 | fileRes)) 40 | })) 41 | } else list() 42 | } 43 | 44 | if (is.null(pkgname)) { 45 | root <- packageRoot(path) 46 | if (is.null(root)) 47 | stop("could not infer package root directory") 48 | 49 | pkgname0 <- packageInfo(root)$Package 50 | if (is.null(pkgname)) { 51 | pkgname <- pkgname0 52 | } else if (!identical(pkgname, pkgname0)) { 53 | stop("'pkgname' and inferred DESCRIPTION 'Package' differ") 54 | } 55 | } else { 56 | root <- system.file(package=pkgname) 57 | } 58 | 59 | library(pkgname, character.only = TRUE, quietly=TRUE) 60 | 61 | dir <- file.path(root, subdir) 62 | if (!file.exists(dir)) { # try inst/subdir 63 | dir <- file.path(root, "inst", subdir) 64 | } 65 | if (!file.exists(dir)) { 66 | stop("unable to find unit tests, no subdir ", sQuote(subdir)) 67 | } 68 | 69 | ## If we only load RUnit's namespace without attaching the package to 70 | ## the search path, then many tests in many packages will fail with 71 | ## errors like: could not find function "checkIdentical" 72 | #if (!requireNamespace("RUnit", quietly=TRUE)) 73 | # stop("Couldn't load the RUnit package. You need to ", 74 | # "install it before\n you can use testPackage().") 75 | library("RUnit", quietly=TRUE) 76 | RUnit_opts <- getOption("RUnit", list()) 77 | RUnit_opts$verbose <- 0L 78 | RUnit_opts$silent <- TRUE 79 | RUnit_opts$verbose_fail_msg <- TRUE 80 | oopt <- options(RUnit = RUnit_opts) 81 | on.exit(options(oopt)) 82 | suite <- RUnit::defineTestSuite(name=paste(pkgname, "RUnit Tests"), 83 | dirs=dir, 84 | testFileRegexp=pattern, 85 | rngKind="default", 86 | rngNormalKind="default") 87 | result <- RUnit::runTestSuite(suite) 88 | cat("\n\n") 89 | RUnit::printTextProtocol(result, showDetails=FALSE) 90 | if (length(details <- .failure_details(result)) > 0) { 91 | cat("\nTest files with failing tests\n") 92 | for (i in seq_along(details)) { 93 | cat("\n ", basename(names(details)[[i]]), "\n") 94 | for (j in seq_along(details[[i]])) { 95 | cat(" ", details[[i]][[j]], "\n") 96 | } 97 | } 98 | cat("\n\n") 99 | stop("unit tests failed for package ", pkgname) 100 | } 101 | result 102 | } 103 | -------------------------------------------------------------------------------- /man/type.Rd: -------------------------------------------------------------------------------- 1 | \name{type} 2 | 3 | \alias{type} 4 | \alias{type,vector-method} 5 | \alias{type,array-method} 6 | \alias{type,factor-method} 7 | \alias{type,data.frame-method} 8 | 9 | \alias{type<-} 10 | \alias{type<-,vector-method} 11 | \alias{type<-,array-method} 12 | 13 | \title{Accessing the type of an object} 14 | 15 | \description{ 16 | Get or set the \emph{type} of an object. 17 | 18 | Note that \code{type} and \code{type<-} are defined as \emph{S4 generic 19 | functions} and what \emph{type} means exactly (and what \code{type()} 20 | returns) depends on the objects for which the \code{type} and/or 21 | \code{type<-} methods are defined. 22 | } 23 | 24 | \usage{ 25 | type(x) 26 | type(x) <- value 27 | 28 | ## Methods defined in the BiocGenerics package: 29 | 30 | \S4method{type}{vector}(x) 31 | \S4method{type}{array}(x) 32 | \S4method{type}{factor}(x) # returns "character" 33 | \S4method{type}{data.frame}(x) 34 | 35 | \S4method{type}{vector}(x) <- value 36 | \S4method{type}{array}(x) <- value 37 | } 38 | 39 | \arguments{ 40 | \item{x}{ 41 | Any object for which the \code{type()} getter or setter is defined. 42 | Note that objects will either: not support the getter or setter at all, 43 | or support only the getter, or support both the getter and setter. 44 | } 45 | \item{value}{ 46 | The type to set on \code{x} (assuming \code{x} supports the \code{type()} 47 | setter). \code{value} is typically (but not necessarily) expected to be 48 | a single string (i.e. a character vector of length 1). 49 | } 50 | } 51 | 52 | \details{ 53 | On an ordinary vector, matrix, or array \code{x}, \code{type(x)} returns 54 | \code{typeof(x)}. 55 | 56 | On a data frame \code{x} where all the columns are ordinary vectors 57 | or factors, \code{type(x)} is \emph{semantically equivalent} to 58 | \code{typeof(as.matrix(x))}. However, the actual implementation is 59 | careful to avoid turning the full data frame \code{x} into a matrix, 60 | as this would tend to be very inefficient in general. 61 | 62 | Note that for a matrix-like or array-like object, \code{type(x)} 63 | returns the type of the \emph{elements} in the object. 64 | See \code{?S4Arrays::\link[S4Arrays]{type}} for more information. 65 | } 66 | 67 | \value{ 68 | \code{type(x)} is expected to return the type of \code{x} as a single 69 | string i.e. as a character vector of length 1. 70 | } 71 | 72 | \seealso{ 73 | \itemize{ 74 | \item \code{\link[methods]{showMethods}} for displaying a summary of the 75 | methods defined for a given generic function. 76 | 77 | \item \code{\link[methods]{selectMethod}} for getting the definition of 78 | a specific method. 79 | 80 | \item \link[S4Arrays]{type,ANY-method} in the \pkg{S4Arrays} 81 | package for the default \code{type} method. 82 | 83 | \item \link[S4Arrays]{type,DataFrame-method} in the \pkg{S4Arrays} 84 | package, and \link[pwalign]{type,PairwiseAlignments-method} in 85 | the \pkg{pwalign} package, for examples of specific \code{type} 86 | methods (defined for \link[S4Vectors]{DataFrame} and 87 | \link[pwalign]{PairwiseAlignments} objects, respectively). 88 | 89 | \item \link{BiocGenerics} for a summary of all the generics defined 90 | in the \pkg{BiocGenerics} package. 91 | } 92 | } 93 | 94 | \examples{ 95 | type 96 | showMethods("type") 97 | 98 | `type<-` 99 | showMethods("type<-") 100 | 101 | ## The BiocGenerics package defines methods for ordinary vectors, arrays, 102 | ## and data frames: 103 | m <- matrix(11:22, nrow=3) 104 | type(m) # equivalent to 'typeof(m)' or 'storage.mode(m)' 105 | type(m) <- "raw" # equivalent to 'storage.mode(m) <- "raw"' 106 | m 107 | type(m) 108 | 109 | selectMethod("type", "array") 110 | 111 | selectMethod("type<-", "array") 112 | 113 | df <- data.frame(a=44:49, b=letters[1:6], c=c(TRUE, FALSE)) 114 | stopifnot(identical(type(df), typeof(as.matrix(df)))) 115 | 116 | ## Examples of methods defined in other packages: 117 | 118 | library(S4Arrays) 119 | showMethods("type") 120 | selectMethod("type", "ANY") # the default "type" method 121 | 122 | library(pwalign) 123 | showMethods("type") 124 | ## The type() method for PairwiseAlignments objects: 125 | selectMethod("type", "PairwiseAlignments") 126 | } 127 | 128 | \keyword{methods} 129 | -------------------------------------------------------------------------------- /inst/unitTests/test_updateObject.R: -------------------------------------------------------------------------------- 1 | ### Most of the code in this file originally by Martin Morgan in Biobase, 2 | ### and moved to BiocGenerics in November 2011. 3 | 4 | test_updateObject_list <- function() 5 | { 6 | setClass("A", 7 | representation(x="numeric"), prototype(x=1:10), 8 | where=.GlobalEnv) 9 | a <- new("A") 10 | l <- list(a,a) 11 | checkTrue(identical(l, updateObject(l))) 12 | 13 | setMethod("updateObject", "A", 14 | function(object, ..., verbose=FALSE) { 15 | if (verbose) message("updateObject object = 'A'") 16 | object@x <- -object@x 17 | object 18 | }, 19 | where=.GlobalEnv) 20 | 21 | obj <- updateObject(l) 22 | checkTrue(identical(lapply(l, function(elt) { elt@x <- -elt@x; elt }), 23 | obj)) 24 | removeMethod("updateObject", "A", where=.GlobalEnv) 25 | removeClass("A", where=.GlobalEnv) 26 | } 27 | 28 | test_updateObject_env <- function() 29 | { 30 | opts <- options() 31 | options(warn=-1) 32 | e <- new.env() 33 | e$x=1 34 | e$.x=1 35 | obj <- updateObject(e) 36 | checkTrue(identical(e,obj)) # modifies environment 37 | 38 | lockEnvironment(e) 39 | obj <- updateObject(e) # copies environment 40 | checkTrue(identical(lapply(ls(e, all=TRUE), function(x) x), 41 | lapply(ls(obj, all=TRUE), function(x) x))) 42 | checkTrue(!identical(e, obj)) # different environments 43 | 44 | e <- new.env() 45 | e$x=1 46 | e$.x=1 47 | lockBinding("x", e) 48 | checkException(updateObject(e), silent=TRUE) 49 | 50 | lockEnvironment(e) 51 | obj <- updateObject(e) 52 | checkTrue(TRUE==bindingIsLocked("x", obj)) # R bug, 14 May, 2006, fixed 53 | checkTrue(FALSE==bindingIsLocked(".x", obj)) 54 | options(opts) 55 | 56 | ## With an environment that contains itself. 57 | e <- new.env() 58 | attr(e, "titi") <- 11:13 59 | e$x <- e 60 | obj <- updateObject(e) 61 | checkIdentical(obj, e) 62 | checkIdentical(attributes(obj), list(titi=11:13)) 63 | } 64 | 65 | test_updateObject_defaults <- function() 66 | { 67 | x <- 1:10 68 | checkTrue(identical(x, updateObject(x))) 69 | } 70 | 71 | test_updateObject_S4 <- function() 72 | { 73 | setClass("A", 74 | representation=representation( 75 | x="numeric"), 76 | prototype=list(x=1:5), 77 | where=.GlobalEnv) 78 | .__a__ <- new("A") 79 | setClass("A", 80 | representation=representation( 81 | x="numeric", 82 | y="character"), 83 | where=.GlobalEnv) 84 | checkException(validObject(.__a__), silent=TRUE) # now out-of-date 85 | .__a__@x <- 1:5 86 | a <- updateObject(.__a__) 87 | checkTrue(validObject(a)) 88 | checkIdentical(1:5, a@x) 89 | removeClass("A", where=.GlobalEnv) 90 | } 91 | 92 | test_updateObject_setClass <- function() 93 | { 94 | setClass("A", 95 | representation(x="numeric"), 96 | prototype=prototype(x=1:10), 97 | where=.GlobalEnv) 98 | a <- new("A") 99 | checkTrue(identical(a,updateObject(a))) 100 | removeClass("A", where=.GlobalEnv) 101 | } 102 | 103 | test_updateObject_refClass <- function() 104 | { 105 | cls <- ".__test_updateObject_refClassA" 106 | .A <- setRefClass(cls, fields=list(x="numeric", y="numeric"), 107 | where=.GlobalEnv) 108 | 109 | a <- .A() 110 | checkTrue(all.equal(a, updateObject(a))) 111 | 112 | a <- .A(x=1:5, y=5:1) 113 | checkTrue(all.equal(a, updateObject(a))) 114 | 115 | .A <- setRefClass(cls, fields=list(x="numeric", y="numeric", z="numeric"), 116 | where=.GlobalEnv) 117 | checkTrue(all.equal(.A(x=1:5, y=5:1, z=numeric()), updateObject(a))) 118 | 119 | .A <- setRefClass(cls, fields=list(x="numeric")) 120 | warn <- FALSE 121 | value <- withCallingHandlers(updateObject(a), warning=function(w) { 122 | txt <- "dropping fields(s) 'y' from object = '.__test_updateObject_refClassA'" 123 | warn <<- identical(txt, conditionMessage(w)) 124 | invokeRestart("muffleWarning") 125 | }) 126 | checkTrue(warn) 127 | checkTrue(all.equal(.A(x=1:5), value)) 128 | 129 | removeClass(cls, where=.GlobalEnv) 130 | } 131 | --------------------------------------------------------------------------------