bioconductor v3.9.0 BiocGenerics

The package defines S4 generic functions used in Bioconductor.

Link to this section Summary

Functions

S4 generic functions for Bioconductor

Maxima and minima

The Interquartile Range

Generic Ontology getter

S3 classes as S4 classes

Accessing annotation information

Append elements to a vector-like object

Coerce an object into a data frame

Coerce an object into a vector

Box plots

Combine objects by rows or columns

Apply operations using clusters

Combining or merging different Bioconductor data structures

Accessing SQLite DB information

Kernel density estimation

Accessors and generic functions used in the context of count datasets

Get the dimensions of all elements in a list-like object

Execute a function call

Determine duplicate elements

Evaluate an (unevaluated) expression

Evaluate an (unevaluated) expression

Accessing the file name of an object

Common higher-order functions in functional programming languages

Return the value of a named object

Pattern Matching and Replacement

Display a color image

Test if a vector-like object is not sorted

Apply a function over a list-like or vector-like object

Median Absolute Deviation

Apply a function to multiple list-like or vector-like arguments

Value matching

Form Row and Column Sums and Means

Arithmetic Mean

Normalize an object

The number of rows/columns of an array-like object

Ordering permutation

Organism and species accessors

Concatenate strings

Accessing the path of an object

MA-plot: plot differences versus averages for high-throughput data

PCA-plot: Principal Component Analysis plot

Ranks the values in a vector-like object

Re-listing an unlist()ed object

Replicate elements of a vector-like object

Extract model residuals

Row and column names

Score accessor

Set operations

Sorting a vector-like object

The start(), end(), width(), and pos() generic getters and setters

Accessing strand information

Subsetting vector-like, matrix-like and data-frame-like objects

t()

Matrix Transponse

Cross tabulation and table creation

Apply a function over a ragged array

Run RUnit package unit tests

An alternative to as.data.frame()

Extract unique elements

Flatten list-like objects

Unsplit a list-like object

Update an object to its current class definition

Variance and Standard Deviation

Extract model weights

Subscript generators

Cross tabulation

Link to this section Functions

Link to this function

BiocGenerics_package()

S4 generic functions for Bioconductor

Description

S4 generic functions needed by many Bioconductor packages.

Details

We divide the generic functions defined in the list("BiocGenerics") package in 2 categories: (1) functions already defined in base R and explicitly promoted to generics in BiocGenerics, and (2) Bioconductor specific generics.

list(list("(1) Functions defined in base R and explicitly promoted to ", " generics in the ", list("BiocGenerics"), " package"), list(" ", " ", " Generics for functions defined in package ", list("base"), ": ", " ", list(" ", " ", list(), " ", list("BiocGenerics::", list("append")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("as.data.frame")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("as.vector")), " ", " ", " ", list(),

" ", list("BiocGenerics::", list("cbind")), ",

", " ", list("BiocGenerics::", list("rbind")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("do.call")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("duplicated")), ", ", " ", list("BiocGenerics::", list("anyDuplicated")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("eval")), " ", " ", " ", list(), " Extremes: ", " ", list("BiocGenerics::", list("pmax")),

",

", " ", list("BiocGenerics::", list("pmin")), ", ", " ", list("BiocGenerics::", list("pmax.int")), ", ", " ", list("BiocGenerics::", list("pmin.int")), " ", " ", " ", list(), " funprog: ", " ", list("BiocGenerics::", list("Reduce")), ", ", " ", list("BiocGenerics::", list("Filter")), ", ", " ", list("BiocGenerics::", list("Find")), ", ", " ", list("BiocGenerics::", list("Map")), ", ", " ",

list("BiocGenerics::", list("Position")), "

", " ", " ", list(), " ", list("BiocGenerics::", list("get")), ", ", " ", list("BiocGenerics::", list("mget")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("grep")), ", ", " ", list("BiocGenerics::", list("grepl")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("is.unsorted")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("lapply")), ", ", " ", list("BiocGenerics::",

    list("sapply")), "

", " ", " ", list(), " ", list("BiocGenerics::", list("mapply")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("match")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("nrow")), ", ", " ", list("BiocGenerics::", list("ncol")), ", ", " ", list("BiocGenerics::", list("NROW")), ", ", " ", list("BiocGenerics::", list("NCOL")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("order")),

"

", " ", " ", list(), " ", list("BiocGenerics::", list("paste")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("rank")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("rep.int")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("rownames")), ", ", " ", list("BiocGenerics::", list("rownames<-")), ", ", " ", list("BiocGenerics::", list("colnames")), ", ", " ", list("BiocGenerics::", list("colnames<-")),

"

", " ", " ", list(), " sets: ", " ", list("BiocGenerics::", list("union")), ", ", " ", list("BiocGenerics::", list("intersect")), ", ", " ", list("BiocGenerics::", list("setdiff")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("sort")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("start")), ", ", " ", list("BiocGenerics::", list("start<-")), ", ", " ", list("BiocGenerics::", list("end")),

",

", " ", list("BiocGenerics::", list("end<-")), ", ", " ", list("BiocGenerics::", list("width")), ", ", " ", list("BiocGenerics::", list("width<-")), ", ", " ", list("BiocGenerics::", list("pos")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("subset")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("table")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("tapply")), " ", " ", " ", list(),

" ", list("BiocGenerics::", list("unique")), "

", " ", " ", list(), " ", list("BiocGenerics::", list("unlist")), " ", " "), " ", " ", " Generics for functions defined in package ", list("utils"), ": ", " ", list(" ", " ", list(), " ", list("BiocGenerics::", list("relist")), " ", " "), " ", " ", " Generics for functions defined in package ", list("graphics"), ": ", " ", list(" ", " ", list(), " ", list("BiocGenerics::", list("boxplot")), " ", " ",

"      ", list(), " ", list("BiocGenerics::", list("image")), "

", " "), " ", " ", " Generics for functions defined in package ", list("stats"), ": ", " ", list(" ", " ", list(), " ", list("BiocGenerics::", list("density")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("residuals")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("weights")), " ", " ", " ", list(), " ", list("BiocGenerics::", list("xtabs")), " ", " "), " ", " ",

"    Generics for functions defined in package ", list("parallel"), ":

", " ", list(" ", " ", list(), " ", list("BiocGenerics::", list("clusterCall")), ", ", " ", list("BiocGenerics::", list("clusterApply")), ", ", " ", list("BiocGenerics::", list("clusterApplyLB")), ", ", " ", list("BiocGenerics::", list("clusterEvalQ")), ", ", " ", list("BiocGenerics::", list("clusterExport")), ", ", " ", list("BiocGenerics::", list("clusterMap")),

    ",

", " ", list("BiocGenerics::", list("clusterSplit")), ", ", " ", list("BiocGenerics::", list("parLapply")), ", ", " ", list("BiocGenerics::", list("parSapply")), ", ", " ", list("BiocGenerics::", list("parApply")), ", ", " ", list("BiocGenerics::", list("parRapply")), ", ", " ", list("BiocGenerics::", list("parCapply")), ", ", " ", list("BiocGenerics::", list("parLapplyLB")), ", ", " ", list(

        "BiocGenerics::", list("parSapplyLB")), "

", " "), " ", " "))

list(list("(2) Bioconductor specific generics"), list(" ", " ", list(" ", " ", list(), " ", list(list("annotation")), ", ", " ", list(list("annotation<-")), " ", " ", " ", list(), " ", list(list("combine")), " ", " ", " ", list(), " ", list(list("dbconn")), ", ", " ", list(list("dbfile")), " ", " ", " ", list(), " ", list(list("dims")), " ", " ", " ", list(), " ", list(list("fileName")), " ", " ", " ", list(), " ", list(list("normalize")),

"

", " ", " ", list(), " ", list(list("Ontology")), " ", " ", " ", list(), " ", list(list("organism")), ", ", " ", list(list("organism<-")), ", ", " ", list(list("species")), ", ", " ", list(list("species<-")), " ", " ", " ", list(), " ", list(list("path")), ", ", " ", list(list("path<-")), ", ", " ", list(list("basename")), ", ", " ", list(list("basename<-")), ", ", " ", list(list("dirname")),

",

", " ", list(list("dirname<-")), " ", " ", " ", list(), " ", list(list("plotMA")), " ", " ", " ", list(), " ", list(list("plotPCA")), " ", " ", " ", list(), " ", list(list("score")), ", ", " ", list(list("score<-")), " ", " ", " ", list(), " ", list(list("strand")), ", ", " ", list(list("strand<-")), ", ", " ", list(list("invertStrand")), " ", " ", " ", list(), " ", list(list("toTable")), " ", " ", " ",

list(), " ", list(list("updateObject")), "

", " "), " ", " "))

Seealso

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • setGeneric and setMethod for defining generics and methods.

Note

More generics can be added on request by sending an email to the Bioc-devel mailing list:

http://bioconductor.org/help/mailing-list/

Things that should NOT be added to the BiocGenerics package:

  • Internal generic primitive functions like length , dim , , etc... See `?` for the complete list. There are a few exceptions though, that is, the BiocGenerics package may actually redefine a few of those internal generic primitive functions as S4 generics when for example the signature of the internal generic primitive is not appropriate (this is the case for `BiocGenerics::` ). * S3 and S4 group generic functions like [`Math`](#math) , [`Ops`](#ops) , etc... See `?` and `?` for the complete list. * Generics already defined in the stats4 package. ## Author The Bioconductor Dev Team ## Examplesr

List all the symbols defined in this package:

ls('package:BiocGenerics')

Maxima and minima

Description

pmax , pmin , pmax.int and pmin.int return the parallel maxima and minima of the input values.

NOTE: This man page is for the pmax , pmin , pmax.int and pmin.int S4 generic functions defined in the BiocGenerics package. See ?base:: for the default methods (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like or matrix-like) not supported by the default methods.

Usage

pmax(..., na.rm=FALSE)
pmin(..., na.rm=FALSE)
     
pmax.int(..., na.rm=FALSE)
pmin.int(..., na.rm=FALSE)

Arguments

ArgumentDescription
...One or more vector-like or matrix-like objects.
na.rmSee ?base:: for a description of this argument.

Value

See ?base:: for the value returned by the default methods.

Specific methods defined in Bioconductor packages will typically return an object of the same class as the input objects.

Seealso

  • base:: for the default pmax , pmin , pmax.int and pmin.int methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • pmax,Rle-method in the S4Vectors package for an example of a specific pmax method (defined for Rle objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

pmax
showMethods("pmax")
selectMethod("pmax", "ANY")  # the default method

pmin
showMethods("pmin")
selectMethod("pmin", "ANY")  # the default method

pmax.int
showMethods("pmax.int")
selectMethod("pmax.int", "ANY")  # the default method

pmin.int
showMethods("pmin.int")
selectMethod("pmin.int", "ANY")  # the default method

The Interquartile Range

Description

Compute the interquartile range for a vector.

NOTE: This man page is for the IQR S4 generic function defined in the BiocGenerics package. See ?stats:: for the default method (defined in the stats package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

IQR(x, na.rm = FALSE, type = 7)

Arguments

ArgumentDescription
x, na.rm, typeSee ?stats:: .

Value

See ?stats:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • stats:: for the default IQR method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

IQR
showMethods("IQR")
selectMethod("IQR", "ANY")  # the default method

Generic Ontology getter

Description

Get the Ontology of an object.

Usage

Ontology(object)

Arguments

ArgumentDescription
objectAn object with an Ontology.

Seealso

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • Ontology,GOTerms-method in the AnnotationDbi package for an example of a specific Ontology method (defined for GOTerms objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

Ontology
showMethods("Ontology")

library(AnnotationDbi)
showMethods("Ontology")
selectMethod("Ontology", "GOTerms")
Link to this function

S3_classes_as_S4_classes()

S3 classes as S4 classes

Description

Some old-style (aka S3) classes are turned into formally defined (aka S4) classes by the BiocGenerics package. This allows S4 methods defined in Bioconductor packages to use them in their signatures.

Details

S3 classes currently turned into S4 classes:

  • connection class and subclasses: connection , file, url, gzfile, bzfile, unz, pipe, fifo, sockconn, terminal, textConnection, gzcon. Addtitionally the characterORconnection S4 class is defined as the union of classes character and connection.

  • others: AsIs , dist

Seealso

setOldClass and setClassUnion in the methods package.

Accessing annotation information

Description

Get or set the annotation information contained in an object.

Usage

annotation(object, ...)
annotation(object, ...) <- value

Arguments

ArgumentDescription
objectAn object containing annotation information.
...Additional arguments, for use in specific methods.
valueThe annotation information to set on object .

Seealso

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • annotation,eSet-method in the Biobase package for an example of a specific annotation method (defined for eSet objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

annotation
showMethods("annotation")

library(Biobase)
showMethods("annotation")
selectMethod("annotation", "eSet")

Append elements to a vector-like object

Description

Append (or insert) elements to (in) a vector-like object.

NOTE: This man page is for the append S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like or data-frame-like) not supported by the default method.

Usage

append(x, values, after=length(x))

Arguments

ArgumentDescription
xThe vector-like object to be modified.
valuesThe vector-like object containing the values to be appended to x . values would typically be of the same class as x , but not necessarily.
afterA subscript, after which the values are to be appended.

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages will typically return an object of the same class as x and of length length(x) + length(values) .

Seealso

  • base:: for the default append method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • append,Vector,Vector-method in the S4Vectors package for an example of a specific append method (defined for Vector objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

append  # note the dispatch on the 'x' and 'values' args only
showMethods("append")
selectMethod("append", c("ANY", "ANY"))  # the default method

Coerce an object into a data frame

Description

Function to coerce to a data frame, if possible.

NOTE: This man page is for the as.data.frame S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

as.data.frame(x, row.names=NULL, optional=FALSE, ...)

Arguments

ArgumentDescription
xThe object to coerce.
row.names, optional, ...See ?base:: for a description of these arguments.

Value

A data frame.

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

Examples

as.data.frame  # note the dispatch on the 'x' arg only
showMethods("as.data.frame")
selectMethod("as.data.frame", "ANY")  # the default method

Coerce an object into a vector

Description

Attempt to coerce an object into a vector of the specified mode. If the mode is not specified, attempt to coerce to whichever vector mode is considered more appropriate for the class of the supplied object.

NOTE: This man page is for the as.vector S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

as.vector(x, mode="any")

Arguments

ArgumentDescription
xThe object to coerce.
modeSee ?base:: for a description of this argument.

Value

A vector.

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • base:: for the default as.vector method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • as.vector,Rle-method and as.vector,AtomicList-method in the S4Vectors and IRanges packages, respectively, for examples of specific as.vector methods (defined for Rle and AtomicList objects, respectively).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

as.vector  # note the dispatch on the 'x' arg only
showMethods("as.vector")
selectMethod("as.vector", "ANY")  # the default method

Box plots

Description

Produce box-and-whisker plot(s) of the given (grouped) values.

NOTE: This man page is for the boxplot S4 generic function defined in the BiocGenerics package. See ?graphics:: for the default method (defined in the graphics package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

boxplot(x, ...)

Arguments

ArgumentDescription
x, ...See ?graphics:: .

Value

See ?graphics:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • graphics:: for the default boxplot method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • boxplot,FeatureSet-method in the oligo package for an example of a specific boxplot method (defined for FeatureSet objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

boxplot
showMethods("boxplot")
selectMethod("boxplot", "ANY")  # the default method

Combine objects by rows or columns

Description

cbind and rbind take one or more objects and combine them by columns or rows, respectively.

NOTE: This man page is for the cbind and rbind S4 generic functions defined in the BiocGenerics package. See ?base:: for the default methods (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like or matrix-like) not supported by the default methods.

Usage

cbind(..., deparse.level=1)
rbind(..., deparse.level=1)

Arguments

ArgumentDescription
...One or more vector-like or matrix-like objects. These can be given as named arguments.
deparse.levelSee ?base:: for a description of this argument.

Value

See ?base:: for the value returned by the default methods.

Specific methods defined in Bioconductor packages will typically return an object of the same class as the input objects.

Seealso

  • base:: for the default cbind and rbind methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • cbind,DataFrame-method in the S4Vectors package for an example of a specific cbind method (defined for DataFrame objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

cbind  # note the dispatch on the '...' arg only
showMethods("cbind")
selectMethod("cbind", "ANY")  # the default method

rbind  # note the dispatch on the '...' arg only
showMethods("rbind")
selectMethod("rbind", "ANY")  # the default method

Apply operations using clusters

Description

These functions provide several ways to parallelize computations using a cluster.

NOTE: This man page is for the clusterCall , clusterApply , clusterApplyLB , clusterEvalQ , clusterExport , clusterMap , clusterSplit , parLapply , parSapply , parApply , parRapply , parCapply , parLapplyLB , and parSapplyLB S4 generic functions defined in the BiocGenerics package. See ?parallel:: for the default methods (defined in the parallel package). Bioconductor packages can define specific methods for cluster-like objects not supported by the default methods.

Usage

clusterCall(cl=NULL, fun, ...)
clusterApply(cl=NULL, x, fun, ...)
clusterApplyLB(cl=NULL, x, fun, ...)
clusterEvalQ(cl=NULL, expr)
clusterExport(cl=NULL, varlist, envir=.GlobalEnv)
clusterMap(cl=NULL, fun, ..., MoreArgs=NULL, RECYCLE=TRUE,
           SIMPLIFY=FALSE, USE.NAMES=TRUE,
           .scheduling=c("static", "dynamic"))
clusterSplit(cl=NULL, seq)
parLapply(cl=NULL, X, fun, ..., chunk.size=NULL)
parSapply(cl=NULL, X, FUN, ..., simplify=TRUE,
          USE.NAMES=TRUE, chunk.size=NULL)
parApply(cl=NULL, X, MARGIN, FUN, ..., chunk.size=NULL)
parRapply(cl=NULL, x, FUN, ..., chunk.size=NULL)
parCapply(cl=NULL, x, FUN, ..., chunk.size=NULL)
parLapplyLB(cl=NULL, X, fun, ..., chunk.size=NULL)
parSapplyLB(cl=NULL, X, FUN, ..., simplify=TRUE,
            USE.NAMES=TRUE, chunk.size=NULL)

Arguments

ArgumentDescription
clA cluster-like object.
xA vector-like object for clusterApply and clusterApplyLB . A matrix-like object for parRapply and parCapply .
seqVector-like object to split.
XA vector-like object for parLapply , parSapply , parLapplyLB , and parSapplyLB . An array-like object for parApply .

fun, ..., expr, varlist, envir, MoreArgs, RECYCLE, SIMPLIFY, | | See ?parallel:: for a description of these arguments. |

Value

See ?parallel:: for the value returned by the default methods.

Specific methods defined in Bioconductor packages should behave like the default methods.

Seealso

  • parallel:: for the default methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

clusterCall  # note the dispatch on the 'cl' arg only
showMethods("clusterCall")
selectMethod("clusterCall", "ANY")  # the default method

clusterApply  # note the dispatch on the 'cl' and 'x' args only
showMethods("clusterApply")
selectMethod("clusterApply", c("ANY", "ANY"))  # the default method

clusterApplyLB  # note the dispatch on the 'cl' and 'x' args only
showMethods("clusterApplyLB")
selectMethod("clusterApplyLB", c("ANY", "ANY"))  # the default method

clusterEvalQ  # note the dispatch on the 'cl' arg only
showMethods("clusterEvalQ")
selectMethod("clusterEvalQ", "ANY")  # the default method

clusterExport  # note the dispatch on the 'cl' arg only
showMethods("clusterExport")
selectMethod("clusterExport", "ANY")  # the default method

clusterMap  # note the dispatch on the 'cl' arg only
showMethods("clusterMap")
selectMethod("clusterMap", "ANY")  # the default method

clusterSplit
showMethods("clusterSplit")
selectMethod("clusterSplit", c("ANY", "ANY"))  # the default method

parLapply  # note the dispatch on the 'cl' and 'X' args only
showMethods("parLapply")
selectMethod("parLapply", c("ANY", "ANY"))  # the default method

parSapply  # note the dispatch on the 'cl' and 'X' args only
showMethods("parSapply")
selectMethod("parSapply", c("ANY", "ANY"))  # the default method

parApply  # note the dispatch on the 'cl' and 'X' args only
showMethods("parApply")
selectMethod("parApply", c("ANY", "ANY"))  # the default method

parRapply  # note the dispatch on the 'cl' and 'x' args only
showMethods("parRapply")
selectMethod("parRapply", c("ANY", "ANY"))  # the default method

parCapply  # note the dispatch on the 'cl' and 'x' args only
showMethods("parCapply")
selectMethod("parCapply", c("ANY", "ANY"))  # the default method

parLapplyLB  # note the dispatch on the 'cl' and 'X' args only
showMethods("parLapplyLB")
selectMethod("parLapplyLB", c("ANY", "ANY"))  # the default method

parSapplyLB  # note the dispatch on the 'cl' and 'X' args only
showMethods("parSapplyLB")
selectMethod("parSapplyLB", c("ANY", "ANY"))  # the default method

Combining or merging different Bioconductor data structures

Description

The combine generic function handles methods for combining or merging different Bioconductor data structures. It should, given an arbitrary number of arguments of the same class (possibly by inheritance), combine them into a single instance in a sensible way (some methods may only combine 2 objects, ignoring ... in the argument list; because Bioconductor data structures are complicated, check carefully that combine does as you intend).

Usage

combine(x, y, ...)

Arguments

ArgumentDescription
xOne of the values.
yA second value.
...Any other objects of the same class as x and y .

Details

There are two basic combine strategies. One is an intersection strategy. The returned value should only have rows (or columns) that are found in all input data objects. The union strategy says that the return value will have all rows (or columns) found in any one of the input data objects (in which case some indication of what to use for missing values will need to be provided).

These functions and methods are currently under construction. Please let us know if there are features that you require.

Value

A single value of the same class as the most specific common ancestor (in class terms) of the input values. This will contain the appropriate combination of the data in the input values.

Seealso

Author

Biocore

Examples

combine
showMethods("combine")
selectMethod("combine", c("ANY", "missing"))
selectMethod("combine", c("data.frame", "data.frame"))
selectMethod("combine", c("matrix", "matrix"))

## ---------------------------------------------------------------------
## COMBINING TWO DATA FRAMES
## ---------------------------------------------------------------------
x <- data.frame(x=1:5,
y=factor(letters[1:5], levels=letters[1:8]),
row.names=letters[1:5])
y <- data.frame(z=3:7,
y=factor(letters[3:7], levels=letters[1:8]),
row.names=letters[3:7])
combine(x,y)

w <- data.frame(w=4:8,
y=factor(letters[4:8], levels=letters[1:8]),
row.names=letters[4:8])
combine(w, x, y)

# y is converted to 'factor' with different levels
df1 <- data.frame(x=1:5,y=letters[1:5], row.names=letters[1:5])
df2 <- data.frame(z=3:7,y=letters[3:7], row.names=letters[3:7])
try(combine(df1, df2)) # fails
# solution 1: ensure identical levels
y1 <- factor(letters[1:5], levels=letters[1:7])
y2 <- factor(letters[3:7], levels=letters[1:7])
df1 <- data.frame(x=1:5,y=y1, row.names=letters[1:5])
df2 <- data.frame(z=3:7,y=y2, row.names=letters[3:7])
combine(df1, df2)
# solution 2: force column to be 'character'
df1 <- data.frame(x=1:5,y=I(letters[1:5]), row.names=letters[1:5])
df2 <- data.frame(z=3:7,y=I(letters[3:7]), row.names=letters[3:7])
combine(df1, df2)

## ---------------------------------------------------------------------
## COMBINING TWO MATRICES
## ---------------------------------------------------------------------
m <- matrix(1:20, nrow=5, dimnames=list(LETTERS[1:5], letters[1:4]))
combine(m[1:3,], m[4:5,])
combine(m[1:3, 1:3], m[3:5, 3:4]) # overlap

Accessing SQLite DB information

Description

Get a connection object or file path for a SQLite DB

Usage

dbconn(x)
dbfile(x)

Arguments

ArgumentDescription
xAn object with a SQLite connection.

Value

dbconn returns a connection object to the SQLite DB containing x 's data.

dbfile returns a path (character string) to the SQLite DB (file) containing x 's data.

Seealso

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • dbconn,AnnotationDb-method in the AnnotationDbi package for an example of a specific dbconn method (defined for dbconn objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

dbconn
showMethods("dbconn")
dbfile
showMethods("dbfile")

library(AnnotationDbi)
showMethods("dbconn")
selectMethod("dbconn", "AnnotationDb")

Kernel density estimation

Description

The generic function density computes kernel density estimates.

NOTE: This man page is for the density S4 generic function defined in the BiocGenerics package. See ?stats:: for the default method (defined in the stats package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

density(x, ...)

Arguments

ArgumentDescription
x, ...See ?stats:: .

Value

See ?stats:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • stats:: for the default density method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • density,flowClust-method in the flowClust package for an example of a specific density method (defined for flowClust objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

density
showMethods("density")
selectMethod("density", "ANY")  # the default method

Accessors and generic functions used in the context of count datasets

Description

These generic functions provide basic interfaces to operations on and data access to count datasets.

Usage

counts(object, ...)
counts(object, ...) <- value
dispTable(object, ...)
dispTable(object, ...)  <- value
sizeFactors(object, ...)
sizeFactors(object, ...) <- value
conditions(object, ...)
conditions(object, ...) <- value
design(object, ...)
design(object, ...) <- value
estimateSizeFactors(object, ...)
estimateDispersions(object, ...)
plotDispEsts(object, ...)

Arguments

ArgumentDescription
objectObject of class for which methods are defined, e.g., CountDataSet , DESeqSummarizedExperiment or ExonCountSet .
valueValue to be assigned to corresponding components of object ; supported types depend on method implementation.
...Further arguments, perhaps used by metohds

Details

For the details, please consult the manual pages of the methods in the DESeq , DESeq2 , and DEXSeq packages and the package vignettes.

Author

W. Huber, S. Anders

Get the dimensions of all elements in a list-like object

Description

Get the dimensions of all elements in a list-like object.

Usage

dims(x)

Arguments

ArgumentDescription
xList-like object (or environment) containing one or several array-like objects with the same number of dimensions.

Seealso

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • dims,eSet-method in the Biobase package for an example of a specific dims method (defined for eSet objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

dims
showMethods("dims")

library(Biobase)
showMethods("dims")
selectMethod("dims", "eSet")

Execute a function call

Description

do.call constructs and executes a function call from a name or a function and a list of arguments to be passed to it.

NOTE: This man page is for the do.call S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

do.call(what, args, quote=FALSE, envir=parent.frame())

Arguments

ArgumentDescription
whatThe default method expects either a function or a non-empty character string naming the function to be called. See ?base:: for the details. Specific methods can support other objects. Please refer to the documentation of a particular method for the details.
argsThe default method expects a list of arguments to the function call (the names attribute of args gives the argument names). See ?base:: for the details. Specific methods can support other objects. Please refer to the documentation of a particular method for the details.
quote, envirSee ?base:: for a description of these arguments.

Value

The result of the (evaluated) function call.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • base:: for the default do.call method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

do.call  # note the dispatch on the 'what' and 'args' args only
showMethods("do.call")
selectMethod("do.call", c("ANY", "ANY"))  # the default method

Determine duplicate elements

Description

Determines which elements of a vector-like or data-frame-like object are duplicates of elements with smaller subscripts, and returns a logical vector indicating which elements (rows) are duplicates.

NOTE: This man page is for the duplicated and anyDuplicated S4 generic functions defined in the BiocGenerics package. See ?base:: for the default methods (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like or data-frame-like) not supported by the default method.

Usage

duplicated(x, incomparables=FALSE, ...)
anyDuplicated(x, incomparables=FALSE, ...)

Arguments

ArgumentDescription
xA vector-like or data-frame-like object.
incomparables, ...See ?base:: for a description of these arguments.

Value

The default duplicated method (see ?base:: ) returns a logical vector of length N where N is:

  • length(x) when x is a vector;

  • nrow(x) when x is a data frame.

Specific duplicated methods defined in Bioconductor packages must also return a logical vector of the same length as x when x is a vector-like object, and a logical vector with one element for each row when x is a data-frame-like object.

The default anyDuplicated method (see ?base:: ) returns a single non-negative integer and so must the specific anyDuplicated methods defined in Bioconductor packages.

anyDuplicated should always behave consistently with duplicated .

Seealso

  • base:: for the default duplicated and anyDuplicated methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • duplicated,Rle-method in the S4Vectors package for an example of a specific duplicated method (defined for Rle objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

duplicated
showMethods("duplicated")
selectMethod("duplicated", "ANY")  # the default method

anyDuplicated
showMethods("anyDuplicated")
selectMethod("anyDuplicated", "ANY")  # the default method

Evaluate an (unevaluated) expression

Description

eval evaluates an R expression in a specified environment.

NOTE: This man page is for the eval S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

eval(expr, envir=parent.frame(),
|           enclos=if (is.list(envir) || is.pairlist(envir))|
                  parent.frame() else baseenv())

Arguments

ArgumentDescription
exprAn object to be evaluated. May be any object supported by the default method (see ?base:: ) or by the additional methods defined in Bioconductor packages.
envirThe environment in which expr is to be evaluated. May be any object supported by the default method (see ?base:: ) or by the additional methods defined in Bioconductor packages.
enclosSee ?base:: for a description of this argument.

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • base:: for the default eval method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • eval,expression,Vector-method in the IRanges package for an example of a specific eval method (defined for when the expr and envir arguments are an expression and a Vector object, respectively).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

eval  # note the dispatch on 'expr' and 'envir' args only
showMethods("eval")
selectMethod("eval", c("ANY", "ANY"))  # the default method

Evaluate an (unevaluated) expression

Description

evalq evaluates an R expression (the quoted form of its first argument) in a specified environment.

NOTE: This man page is for the evalq wrapper defined in the BiocGenerics package. See ?base:: for the function defined in the base package. This wrapper correctly delegates to the eval generic, rather than base:: .

Usage

evalq(expr, envir=parent.frame(),
|           enclos=if (is.list(envir) || is.pairlist(envir))|
                  parent.frame() else baseenv())

Arguments

ArgumentDescription
exprQuoted to form the expression that is evaluated.
envirThe environment in which expr is to be evaluated. May be any object supported by methods on the eval generic.
enclosSee ?base:: for a description of this argument.

Value

See ?base:: .

Seealso

  • base:: for the base evalq function.

Examples

evalq  # note just a copy of the original evalq

Accessing the file name of an object

Description

Get the file name of an object.

Usage

fileName(object, ...)

Arguments

ArgumentDescription
objectAn object with a file name.
...Additional arguments, for use in specific methods.

Seealso

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • fileName,MSmap-method in the MSnbase package for an example of a specific fileName method (defined for MSmap objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

fileName
showMethods("fileName")

library(MSnbase)
showMethods("fileName")
selectMethod("fileName", "MSmap")

Common higher-order functions in functional programming languages

Description

Reduce uses a binary function to successively combine the elements of a given list-like or vector-like object and a possibly given initial value. Filter extracts the elements of a list-like or vector-like object for which a predicate (logical) function gives true. Find and Position give the first or last such element and its position in the object, respectively. Map applies a function to the corresponding elements of given list-like or vector-like objects.

NOTE: This man page is for the Reduce , Filter , Find , Map and Position S4 generic functions defined in the BiocGenerics package. See ?base:: for the default methods (defined in the base package). Bioconductor packages can define specific methods for objects (typically list-like or vector-like) not supported by the default methods.

Usage

Reduce(f, x, init, right=FALSE, accumulate=FALSE)
Filter(f, x)
Find(f, x, right=FALSE, nomatch=NULL)
Map(f, ...)
Position(f, x, right=FALSE, nomatch=NA_integer_)

Arguments

ArgumentDescription
f, init, right, accumulate, nomatchSee ?base:: for a description of these arguments.
xA list-like or vector-like object.
...One or more list-like or vector-like objects.

Value

See ?base:: for the value returned by the default methods.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default methods.

Seealso

  • base:: for the default Reduce , Filter , Find , Map and Position methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • Reduce,List-method in the S4Vectors package for an example of a specific Reduce method (defined for List objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

Reduce  # note the dispatch on the 'x' arg only
showMethods("Reduce")
selectMethod("Reduce", "ANY")  # the default method

Filter  # note the dispatch on the 'x' arg only
showMethods("Filter")
selectMethod("Filter", "ANY")  # the default method

Find  # note the dispatch on the 'x' arg only
showMethods("Find")
selectMethod("Find", "ANY")  # the default method

Map  # note the dispatch on the '...' arg only
showMethods("Map")
selectMethod("Map", "ANY")  # the default method

Position  # note the dispatch on the 'x' arg only
showMethods("Position")
selectMethod("Position", "ANY")  # the default method

Return the value of a named object

Description

Search for an object with a given name and return it.

NOTE: This man page is for the get and mget list("S4 generic ", " functions") defined in the list("BiocGenerics") package. See ?base:: for the default methods (defined in the list("base") package). Bioconductor packages can define specific methods for objects (list-like or environment-like) not supported by the default methods.

Usage

get(x, pos=-1, envir=as.environment(pos), mode="any", inherits=TRUE)
mget(x, envir, mode="any", ifnotfound, inherits=FALSE)

Arguments

ArgumentDescription
xFor get : A variable name (or, more generally speaking, a key ), given as a single string. For mget : A vector of variable names (or keys ).
envirWhere to look for the key(s). Typically a list-like or environment-like object.
pos, mode, inherits, ifnotfoundSee ?base:: for a description of these arguments.

Details

See ?base:: for details about the default methods.

Value

For get : The value corresponding to the specified key.

For mget : The list of values corresponding to the specified keys. The returned list must have one element per key, and in the same order as in x .

See ?base:: for the value returned by the default methods.

Seealso

  • base:: for the default get and mget methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • get,ANY,Bimap,missing-method in the AnnotationDbi package for an example of a specific get method (defined for Bimap objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

get  # note the dispatch on the 'x', 'pos' and 'envir' args only
showMethods("get")
selectMethod("get", c("ANY", "ANY", "ANY"))  # the default method

mget  # note the dispatch on the 'x' and 'envir' args only
showMethods("mget")
selectMethod("mget", c("ANY", "ANY"))  # the default method

Pattern Matching and Replacement

Description

Search for matches to argument 'pattern' within each element of a character vector.

NOTE: This man page is for the grep and grepl S4 generic functions defined in the BiocGenerics package. See ?base:: for the default methods (defined in the base package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

grep(pattern, x, ignore.case = FALSE, perl = FALSE, value = FALSE,
          fixed = FALSE, useBytes = FALSE, invert = FALSE)
grepl(pattern, x, ignore.case = FALSE, perl = FALSE,
          fixed = FALSE, useBytes = FALSE)

Arguments

ArgumentDescription
patternThe pattern for searching in x , such as a regular expression.
xThe character vector (in the general sense) to search.
ignore.case, perl, value, fixed, useBytes, invertSee ?base:: for a description of these arguments.

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • base:: for the default grep and grepl methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

grep  # note the dispatch on 'pattern' and 'x' args only
showMethods("grep")
selectMethod("grep", "ANY")  # the default method

Display a color image

Description

Creates a grid of colored or gray-scale rectangles with colors corresponding to the values in z . This can be used to display three-dimensional or spatial data aka images .

NOTE: This man page is for the image S4 generic function defined in the BiocGenerics package. See ?graphics:: for the default method (defined in the graphics package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

image(x, ...)

Arguments

ArgumentDescription
x, ...See ?graphics:: .

Details

See ?graphics:: for the details.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • graphics:: for the default image method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • image,FeatureSet-method in the oligo package for an example of a specific image method (defined for FeatureSet objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

image
showMethods("image")
selectMethod("image", "ANY")  # the default method

Test if a vector-like object is not sorted

Description

Test if a vector-like object is not sorted, without the cost of sorting it.

NOTE: This man page is for the is.unsorted S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like) not supported by the default method.

Usage

is.unsorted(x, na.rm=FALSE, strictly=FALSE, ...)

Arguments

ArgumentDescription
xA vector-like object.
na.rm, strictlySee ?base:: for a description of these arguments.
...Additional arguments, for use in specific methods. Note that base:: (the default method) only takes the x , na.rm , and strictly arguments.

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • base:: for the default is.unsorted method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • is.unsorted,GenomicRanges-method in the GenomicRanges package for an example of a specific is.unsorted method (defined for GenomicRanges objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Note

TO DEVELOPERS:

The is.unsorted method for specific vector-like objects should adhere to the same underlying order used by the order , sort , and rank methods for the same objects.

Examples

is.unsorted  # note the dispatch on the 'x' arg only
showMethods("is.unsorted")
selectMethod("is.unsorted", "ANY")  # the default method

Apply a function over a list-like or vector-like object

Description

lapply returns a list of the same length as X , each element of which is the result of applying FUN to the corresponding element of X .

sapply is a user-friendly version and wrapper of lapply by default returning a vector, matrix or, if simplify="array" , an array if appropriate, by applying simplify2array() . sapply(x, f, simplify=FALSE, USE.NAMES=FALSE) is the same as lapply(x, f) .

NOTE: This man page is for the lapply and sapply S4 generic functions defined in the BiocGenerics package. See ?base:: for the default methods (defined in the base package). Bioconductor packages can define specific methods for objects (typically list-like or vector-like) not supported by the default methods.

Usage

lapply(X, FUN, ...)
sapply(X, FUN, ..., simplify=TRUE, USE.NAMES=TRUE)

Arguments

ArgumentDescription
XA list-like or vector-like object.
FUN, ..., simplify, USE.NAMESSee ?base:: for a description of these arguments.

Value

See ?base:: for the value returned by the default methods.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default methods. In particular, lapply and sapply(simplify=FALSE) should always return a list.

Seealso

  • base:: for the default lapply and sapply methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • lapply,List-method in the S4Vectors package for an example of a specific lapply method (defined for List objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

lapply  # note the dispatch on the 'X' arg only
showMethods("lapply")
selectMethod("lapply", "ANY")  # the default method

sapply  # note the dispatch on the 'X' arg only
showMethods("sapply")
selectMethod("sapply", "ANY")  # the default method

Median Absolute Deviation

Description

Compute the median absolute deviation for a vector, dispatching only on the first argument, x .

NOTE: This man page is for the mad S4 generic function defined in the BiocGenerics package. See ?stats:: for the default method (defined in the stats package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

mad(x, center = median(x), constant = 1.4826,
    na.rm = FALSE, low = FALSE, high = FALSE)

Arguments

ArgumentDescription
x, center, constant, na.rm, low, highSee ?stats:: .

Value

See ?stats:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • stats:: for the default mad method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

mad
showMethods("mad")
selectMethod("mad", "ANY")  # the default method

Apply a function to multiple list-like or vector-like arguments

Description

mapply is a multivariate version of sapply . mapply applies FUN to the first elements of each ... argument, the second elements, the third elements, and so on. Arguments are recycled if necessary.

NOTE: This man page is for the mapply S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects (typically list-like or vector-like) not supported by the default methods.

Usage

mapply(FUN, ..., MoreArgs=NULL, SIMPLIFY=TRUE, USE.NAMES=TRUE)

Arguments

ArgumentDescription
FUN, MoreArgs, SIMPLIFY, USE.NAMESSee ?base:: for a description of these arguments.
...One or more list-like or vector-like objects of strictly positive length, or all of zero length.

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • base:: for the default mapply method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

mapply  # note the dispatch on the '...' arg only
showMethods("mapply")
selectMethod("mapply", "ANY")  # the default method

Value matching

Description

match returns a vector of the positions of (first) matches of its first argument in its second.

NOTE: This man page is for the match S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like) not supported by the default method.

Usage

match(x, table, nomatch=NA_integer_, incomparables=NULL, ...)

Arguments

ArgumentDescription
x, tableVector-like objects (typically of the same class, but not necessarily).
nomatch, incomparablesSee ?base:: for a description of these arguments.
...Additional arguments, for use in specific methods.

Value

The same as the default method, that is, an integer vector of the same length as x giving the position in table of the first match if there is a match, otherwise nomatch .

See ?base:: for more details.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • base:: for the default match method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • match,Hits,Hits-method in the S4Vectors package for an example of a specific match method (defined for Hits objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Note

The default method (defined in the base package) doesn't have the ... argument. We've added it to the generic function defined in the BiocGenerics package in order to allow specific methods to support additional arguments if needed.

Examples

match  # note the dispatch on the 'x' and 'table' args only
showMethods("match")
selectMethod("match", c("ANY", "ANY"))  # the default method
Link to this function

matrix_summary()

Form Row and Column Sums and Means

Description

Form row and column sums and means for rectangular objects..

NOTE: This man page is for the rowSums , colSums , rowMeans , and colMeans S4 generic functions defined in the BiocGenerics package. See ?base:: for the default methods (defined in the base package). Bioconductor packages can define specific methods for objects (typically array-like) not supported by the default method.

Usage

colSums (x, na.rm = FALSE, dims = 1)
     rowSums (x, na.rm = FALSE, dims = 1)
     colMeans(x, na.rm = FALSE, dims = 1)
     rowMeans(x, na.rm = FALSE, dims = 1)

Arguments

ArgumentDescription
xa rectangular object, like a matrix or data frame
na.rm, dimssee colSums

Value

See ?base:: for the value returned by the default methods.

Specific methods defined in Bioconductor packages will typically return an object of the same class as the input object.

Seealso

  • base:: for the default colSums , rowSums , colMeans , and colSums methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

colSums
showMethods("colSums")
selectMethod("colSums", "ANY")  # the default method

Arithmetic Mean

Description

Generic function for the (trimmed) arithmetic mean.

NOTE: This man page is for the mean S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like) not supported by the default method.

Usage

mean(x, ...)

Arguments

ArgumentDescription
xtypically a vector-like object
...see mean

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages will typically return an object of the same class as the input object.

Seealso

  • base:: for the default mean method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • mean,Rle-method in the S4Vectors package for an example of a specific mean method (defined for Rle objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

mean
showMethods("mean")
selectMethod("mean", "ANY")  # the default method

Normalize an object

Description

A generic function which normalizes an object containing microarray data or other data. Normalization is intended to remove from the intensity measures any systematic trends which arise from the microarray technology rather than from differences between the probes or between the target RNA samples hybridized to the arrays.

Usage

normalize(object, ...)

Arguments

ArgumentDescription
objectA data object, typically containing microarray data.
...Additional arguments, for use in specific methods.

Value

An object containing the normalized data.

Seealso

Examples

normalize
showMethods("normalize")

library(affy)
showMethods("normalize")
selectMethod("normalize", "AffyBatch")

The number of rows/columns of an array-like object

Description

Return the number of rows or columns present in an array-like object.

NOTE: This man page is for the nrow , ncol , NROW and NCOL S4 generic functions defined in the BiocGenerics package. See ?base:: for the default methods (defined in the base package). Bioconductor packages can define specific methods for objects (typically matrix- or array-like) not supported by the default methods.

Usage

nrow(x)
ncol(x)
NROW(x)
NCOL(x)

Arguments

ArgumentDescription
xA matrix- or array-like object.

Value

A single integer or NULL .

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default methods.

Seealso

  • base:: for the default nrow , ncol , NROW and NCOL methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • nrow,DataFrame-method in the S4Vectors package for an example of a specific nrow method (defined for DataFrame objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

nrow
showMethods("nrow")
selectMethod("nrow", "ANY")  # the default method

ncol
showMethods("ncol")
selectMethod("ncol", "ANY")  # the default method

NROW
showMethods("NROW")
selectMethod("NROW", "ANY")  # the default method

NCOL
showMethods("NCOL")
selectMethod("NCOL", "ANY")  # the default method

Ordering permutation

Description

order returns a permutation which rearranges its first argument into ascending or descending order, breaking ties by further arguments.

NOTE: This man page is for the order S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like) not supported by the default method.

Usage

order(..., na.last=TRUE, decreasing=FALSE, method=c("auto", "shell", "radix"))

Arguments

ArgumentDescription
...One or more vector-like objects, all of the same length.
na.last, decreasing, methodSee ?base:: for a description of these arguments.

Value

The default method (see ?base:: ) returns an integer vector of length N where N is the common length of the input objects. This integer vector represents a permutation of N elements and can be used to rearrange the first argument in ... into ascending or descending order (by subsetting it).

Specific methods defined in Bioconductor packages should also return an integer vector representing a permutation of N elements.

Seealso

  • base:: for the default order method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • order,IntegerRanges-method in the IRanges package for an example of a specific order method (defined for IntegerRanges objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Note

TO DEVELOPERS:

Specific order methods should preferably be made "stable" for consistent behavior across platforms and consistency with base::order() . Note that C qsort() is not "stable" so order methods that use qsort() at the C-level need to ultimately break ties by position, which can easily be done by adding a little extra code at the end of the comparison function passed to qsort().

order(x, decreasing=TRUE) is not always equivalent to rev(order(x)) .

order , sort , and rank methods for specific vector-like objects should adhere to the same underlying order that should be conceptually defined as a binary relation on the set of all possible vector values. For completeness, this binary relation should also be incarnated by a <= method.

Examples

order
showMethods("order")
selectMethod("order", "ANY")  # the default method
Link to this function

organism_species()

Organism and species accessors

Description

Get or set the organism and/or species of an object.

Usage

organism(object)
organism(object) <- value
species(object)
species(object) <- value

Arguments

ArgumentDescription
objectAn object to get or set the organism or species of.
valueThe organism or species to set on object .

Value

organism should return the scientific name (i.e. genus and species, or genus and species and subspecies) of the organism. Preferably in the format "Genus species" (e.g. "Homo sapiens" ) or "Genus species subspecies" (e.g. "Homo sapiens neanderthalensis" ).

species should of course return the species of the organism. Unfortunately there is a long history of misuse of this accessor in Bioconductor so its usage is now discouraged (starting with BioC 3.1).

Seealso

Note

TO DEVELOPERS:

species has been historically misused in many places in Bioconductor and is redundant with organism . So implementing the species accessor is now discouraged (starting with BioC 3.1). The organism accessor (returning the scientific name ) should be implemented instead.

Examples

## organism() getter:
organism
showMethods("organism")

library(annotate)
showMethods("organism")
selectMethod("organism", "character")
selectMethod("organism", "chromLocation")

## organism() setter:
`organism<-`
showMethods("organism<-")

## species() getter:
species
showMethods("species")

library(AnnotationDbi)
selectMethod("species", "AnnotationDb")

## species() setter:
`species<-`
showMethods("species<-")

Concatenate strings

Description

paste concatenates vectors of strings or vector-like objects containing strings.

NOTE: This man page is for the paste S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like objects containing strings) not supported by the default method.

Usage

paste(..., sep=" ", collapse=NULL)

Arguments

ArgumentDescription
...One or more vector-like objects containing strings.
sep, collapseSee ?base:: for a description of these arguments.

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages will typically return an object of the same class as the input objects.

Seealso

  • base:: for the default paste method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • paste,Rle-method in the S4Vectors package for an example of a specific paste method (defined for Rle objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

paste
showMethods("paste")
selectMethod("paste", "ANY")  # the default method

Accessing the path of an object

Description

Get or set the path of an object.

Usage

path(object, ...)
path(object, ...) <- value
basename(path, ...)
basename(path, ...) <- value
dirname(path, ...)
dirname(path, ...) <- value
## The purpose of the following methods is to make the basename() and
## dirname() getters work out-of-the-box on any object for which the
## path() getter works.
list(list("basename"), list("ANY"))(path, ...)
list(list("dirname"), list("ANY"))(path, ...)
## The purpose of the following replacement methods is to make the
## basename() and dirname() setters work out-of-the-box on any object
## for which the path() getter and setter work.
list(list("basename"), list("character"))(path, ...) <- value
list(list("basename"), list("ANY"))(path, ...) <- value
list(list("dirname"), list("character"))(path, ...) <- value
list(list("dirname"), list("ANY"))(path, ...) <- value

Arguments

ArgumentDescription
objectAn object containing paths. Even though it will typically contain a single path, object can actually contain an arbitrary number of paths.
...Additional arguments, for use in specific methods.
valueFor path<- , the paths to set on object . For basename<- or dirname<- , the basenames or dirnames to set on path .
pathA character vector or an object containing paths .

Value

A character vector for path(object) , basename(path) , and dirname(path) . Typically of length 1 but not necessarily. Possibly with names on it for path(object) .

Seealso

  • base:: for the functions the basename and dirname generics are based on.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • path,RsamtoolsFile-method in the Rsamtools package for an example of a specific path method (defined for RsamtoolsFile objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

## ---------------------------------------------------------------------
## GENERIC FUNCTIONS AND DEFAULT METHODS
## ---------------------------------------------------------------------

path
showMethods("path")

`path<-`
showMethods("path<-")

basename
showMethods("basename")

`basename<-`
showMethods("basename<-")

dirname
showMethods("dirname")

`dirname`
showMethods("dirname<-")


## Default basename() and dirname() getters:
selectMethod("basename", "ANY")
selectMethod("dirname", "ANY")

## Default basename() and dirname() setters:
selectMethod("basename<-", "character")
selectMethod("basename<-", "ANY")
selectMethod("dirname<-", "character")
selectMethod("dirname<-", "ANY")

## ---------------------------------------------------------------------
## OBJECTS CONTAINING PATHS
## ---------------------------------------------------------------------

## Let's define a simple class to represent objects that contain paths:
setClass("A", slots=c(stuff="ANY", path="character"))

a <- new("A", stuff=runif(5),
path=c(one="path/to/file1", two="path/to/file2"))

## path() getter:
setMethod("path", "A", function(object) object@path)

path(a)

## Because the path() getter works on 'a', now the basename() and
## dirname() getters also work:
basename(a)
dirname(a)

## path() setter:
setReplaceMethod("path", "A",
function(object, ..., value)
{
if (length(list(...)) != 0L) {
dots <- match.call(expand.dots=FALSE)[[3L]]
stop(BiocGenerics:::unused_arguments_msg(dots))
}
object@path <- value
object
}
)

a <- new("A", stuff=runif(5))
path(a) <- c(one="path/to/file1", two="path/to/file2")
path(a)

## Because the path() getter and setter work on 'a', now the basename()
## and dirname() setters also work:
basename(a) <- toupper(basename(a))
path(a)
dirname(a) <- "~/MyDataFiles"
path(a)

MA-plot: plot differences versus averages for high-throughput data

Description

A generic function which produces an MA-plot for an object containing microarray, RNA-Seq or other data.

Usage

plotMA(object, ...)

Arguments

ArgumentDescription
objectA data object, typically containing count values from an RNA-Seq experiment or microarray intensity values.
...Additional arguments, for use in specific methods.

Value

Undefined. The function exists for its side effect, producing a plot.

Seealso

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • plotMA in the limma package for a function with the same name that is not dispatched through this generic function.

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

showMethods("plotMA")

suppressWarnings(
if(require("DESeq2"))
example("plotMA", package="DESeq2", local=TRUE)
)

PCA-plot: Principal Component Analysis plot

Description

A generic function which produces a PCA-plot.

Usage

plotPCA(object, ...)

Arguments

ArgumentDescription
objectA data object, typically containing gene expression information.
...Additional arguments, for use in specific methods.

Value

Undefined. The function exists for its side effect, producing a plot.

Seealso

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • plotPCA in the DESeq2 package for an example method that uses this generic.

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

showMethods("plotPCA")

suppressWarnings(
if(require("DESeq2"))
example("plotPCA", package="DESeq2", local=TRUE)
)

Ranks the values in a vector-like object

Description

Returns the ranks of the values in a vector-like object. Ties (i.e., equal values) and missing values can be handled in several ways.

NOTE: This man page is for the rank S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

rank(x, na.last=TRUE,
     ties.method=c("average", "first", "last", "random", "max", "min"),
     ...)

Arguments

ArgumentDescription
xA vector-like object.
na.last, ties.methodSee ?base:: for a description of these arguments.
...Additional arguments, for use in specific methods. Note that base:: (the default method) only takes the x , na.last , and ties.method arguments.

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • base:: for the default rank method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • rank,Vector-method in the S4Vectors package for an example of a specific rank method (defined for Vector objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Note

TO DEVELOPERS:

See note in ?BiocGenerics:: about "stable" order.

order , sort , and rank methods for specific vector-like objects should adhere to the same underlying order that should be conceptually defined as a binary relation on the set of all possible vector values. For completeness, this binary relation should also be incarnated by a <= method.

Examples

rank  # note the dispatch on the 'x' arg only
showMethods("rank")
selectMethod("rank", "ANY")  # the default method

Re-listing an unlist()ed object

Description

relist is a generic function with a few methods in order to allow easy inversion of unlist(x) .

NOTE: This man page is for the relist S4 generic function defined in the BiocGenerics package. See ?utils:: for the default method (defined in the utils package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

relist(flesh, skeleton)

Arguments

ArgumentDescription
fleshA vector-like object.
skeletonA list-like object. Only the "shape" (i.e. the lengths of the individual list elements) of skeleton matters. Its exact content is ignored.

Value

A list-like object with the same "shape" as skeleton and that would give flesh back if unlist()ed.

Seealso

  • utils:: for the default relist method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • relist,ANY,List-method in the IRanges package for an example of a specific relist method (defined for when skeleton is a List object).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

relist
showMethods("relist")
selectMethod("relist", c("ANY", "ANY"))  # the default method

Replicate elements of a vector-like object

Description

rep.int replicates the elements in x .

NOTE: This man page is for the rep.int S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like) not supported by the default method.

Usage

rep.int(x, times)

Arguments

ArgumentDescription
xThe object to replicate (typically vector-like).
timesSee ?base:: for a description of this argument.

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages will typically return an object of the same class as the input object.

Seealso

  • base:: for the default rep.int , intersect , and setdiff methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • rep.int,Rle-method in the S4Vectors package for an example of a specific rep.int method (defined for Rle objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

rep.int
showMethods("rep.int")
selectMethod("rep.int", "ANY")  # the default method

Extract model residuals

Description

residuals is a generic function which extracts model residuals from objects returned by modeling functions.

NOTE: This man page is for the residuals S4 generic function defined in the BiocGenerics package. See ?stats:: for the default method (defined in the stats package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

residuals(object, ...)

Arguments

ArgumentDescription
object, ...See ?stats:: .

Value

Residuals extracted from the object object .

Seealso

  • stats:: for the default residuals method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • residuals,PLMset-method in the affyPLM package for an example of a specific residuals method (defined for PLMset objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

residuals
showMethods("residuals")
selectMethod("residuals", "ANY")  # the default method

Row and column names

Description

Get or set the row or column names of a matrix-like object.

NOTE: This man page is for the rownames , rownames<- , colnames , and colnames<- S4 generic functions defined in the BiocGenerics package. See ?base:: for the default methods (defined in the base package). Bioconductor packages can define specific methods for objects (typically matrix-like) not supported by the default methods.

Usage

rownames(x, do.NULL=TRUE, prefix="row")
rownames(x) <- value
colnames(x, do.NULL=TRUE, prefix="col")
colnames(x) <- value

Arguments

ArgumentDescription
xA matrix-like object.
do.NULL, prefixSee ?base:: for a description of these arguments.
valueEither NULL or a character vector equal of length equal to the appropriate dimension.

Value

The getters will return NULL or a character vector of length nrow for rownames and length ncol for colnames(x) .

See ?base:: for more information about the default methods, including how the setters are expected to behave.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default methods.

Seealso

  • base:: for the default rownames , rownames<- , colnames , and colnames<- methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • rownames,DataFrame-method in the S4Vectors package for an example of a specific rownames method (defined for DataFrame objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

## rownames() getter:
rownames  # note the dispatch on the 'x' arg only
showMethods("rownames")
selectMethod("rownames", "ANY")  # the default method

## rownames() setter:
`rownames<-`
showMethods("rownames<-")
selectMethod("rownames<-", "ANY")  # the default method

## colnames() getter:
colnames  # note the dispatch on the 'x' arg only
showMethods("colnames")
selectMethod("colnames", "ANY")  # the default method

## colnames() setter:
`colnames<-`
showMethods("colnames<-")
selectMethod("colnames<-", "ANY")  # the default method

Score accessor

Description

Get or set the score value contained in an object.

Usage

score(x, ...)
score(x, ...) <- value

Arguments

ArgumentDescription
xAn object to get or set the score value of.
...Additional arguments, for use in specific methods.
valueThe score value to set on x .

Seealso

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • score,GenomicRanges-method in the GenomicRanges package for an example of a specific score method (defined for GenomicRanges objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

score
showMethods("score")

`score<-`
showMethods("score<-")

library(GenomicRanges)

showMethods("score")
selectMethod("score", "GenomicRanges")

showMethods("score<-")
selectMethod("score<-", "GenomicRanges")

Set operations

Description

Performs set union, intersection and (asymmetric!) difference on two vector-like objects.

NOTE: This man page is for the union , intersect and setdiff S4 generic functions defined in the BiocGenerics package. See ?base:: for the default methods (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like) not supported by the default methods.

Usage

union(x, y, ...)
intersect(x, y, ...)
setdiff(x, y, ...)

Arguments

ArgumentDescription
x, yVector-like objects (typically of the same class, but not necessarily).
...Additional arguments, for use in specific methods.

Value

See ?base:: for the value returned by the default methods.

Specific methods defined in Bioconductor packages will typically return an object of the same class as the input objects.

Seealso

  • base:: for the default union , intersect , and setdiff methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • union,GenomicRanges,GenomicRanges-method in the GenomicRanges package for examples of specific union , intersect , and setdiff methods (defined for GenomicRanges objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Note

The default methods (defined in the base package) only take 2 arguments. We've added the ... argument to the generic functions defined in the BiocGenerics package so they can be called with an arbitrary number of effective arguments. For union or intersect , this typically allows Bioconductor packages to define methods that compute the union or intersection of more than 2 objects. However, for setdiff , which is conceptually a binary operation, this typically allows methods to add extra arguments for controlling/altering the behavior of the operation. Like for example the ignore.strand argument supported by the setdiff method for GenomicRanges objects (defined in the GenomicRanges package). (Note that the union and intersect methods for those objects also support the ignore.strand argument.)

Examples

union
showMethods("union")
selectMethod("union", c("ANY", "ANY"))  # the default method

intersect
showMethods("intersect")
selectMethod("intersect", c("ANY", "ANY"))  # the default method

setdiff
showMethods("setdiff")
selectMethod("setdiff", c("ANY", "ANY"))  # the default method

Sorting a vector-like object

Description

Sort a vector-like object into ascending or descending order.

NOTE: This man page is for the sort S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

sort(x, decreasing=FALSE, ...)

Arguments

ArgumentDescription
xA vector-like object.
decreasing, ...See ?base:: for a description of these arguments.

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • base:: for the default sort method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • sort,Vector-method in the S4Vectors package for an example of a specific sort method (defined for Vector objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Note

TO DEVELOPERS:

See note in ?BiocGenerics:: about "stable" order.

order , sort , and rank methods for specific vector-like objects should adhere to the same underlying order that should be conceptually defined as a binary relation on the set of all possible vector values. For completeness, this binary relation should also be incarnated by a <= method.

Examples

sort  # note the dispatch on the 'x' arg only
showMethods("sort")
selectMethod("sort", "ANY")  # the default method

The start(), end(), width(), and pos() generic getters and setters

Description

Get or set the start, end, width, or single positions stored in an object.

NOTE: This man page is for the start , start<- , end , end<- , width , width<- , and pos S4 generic functions defined in the BiocGenerics package. See ?stats:: for the start and end S3 generics defined in the stats package.

Usage

start(x, ...)
start(x, ...) <- value
end(x, ...)
end(x, ...) <- value
width(x)
width(x, ...) <- value
pos(x)

Arguments

ArgumentDescription
xFor the start() , end() , and width() getters/setters: an object containing start, end, and width values. For the pos{} getter: an object containing single positions.
...Additional arguments, for use in specific methods.
valueThe start, end, or width values to set on x .

Value

See specific methods defined in Bioconductor packages.

Seealso

  • stats:: in the stats package for the start and end S3 generics.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • start,IRanges-method in the IRanges package for examples of specific start , end , and width methods (defined for IRanges objects).

  • pos,IPos-method in the IRanges package for an example of a specific pos method (defined for IPos objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

## start() getter:
start
showMethods("start")

library(IRanges)
showMethods("start")
selectMethod("start", "IRanges")  # start() getter for IRanges objects

## start() setter:
`start<-`
showMethods("start<-")
selectMethod("start<-", "IRanges")  # start() setter for IRanges objects

## end() getter:
end
showMethods("end")
selectMethod("end", "IRanges")  # end() getter for IRanges objects

## end() setter:
`end<-`
showMethods("end<-")
selectMethod("end<-", "IRanges")  # end() setter for IRanges objects

## width() getter:
width
showMethods("width")
selectMethod("width", "IRanges")  # width() getter for IRanges objects

## width() setter:
`width<-`
showMethods("width<-")
selectMethod("width<-", "IRanges")  # width() setter for IRanges objects

## pos() getter:
pos
showMethods("pos")
selectMethod("pos", "IPos")  # pos() getter for IPos objects

Accessing strand information

Description

Get or set the strand information contained in an object.

Usage

strand(x, ...)
strand(x, ...) <- value
unstrand(x)
invertStrand(x)
list(list("invertStrand"), list("ANY"))(x)

Arguments

ArgumentDescription
xAn object containing strand information.
...Additional arguments, for use in specific methods.
valueThe strand information to set on x .

Details

All the strand methods defined in the list("GenomicRanges") package use the same set of 3 values (called the "standard strand levels") to specify the strand of a genomic location: + , - , and * . * is used when the exact strand of the location is unknown, or irrelevant, or when the "feature" at that location belongs to both strands.

Note that unstrand is not a generic function, just a convenience wrapper to the generic strand() setter ( strand<- ) that does: list(" strand(x) <- "*" ", " x ") The default method for invertStrand does: list(" strand(x) <- invertStrand(strand(x)) ", " x ")

Value

If x is a vector-like object, strand(x) will typically return a vector-like object parallel to x , that is, an object of the same length as x where the i-th element describes the strand of the i-th element in x .

unstrand(x) and invertStrand(x) return a copy of x with the strand set to "*" for unstrand or inverted for invertStrand (i.e. "+" and "-" switched, and "*" untouched).

Seealso

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • strand,GRanges-method in the GenomicRanges package for an example of a specific strand method (defined for GRanges objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

strand
showMethods("strand")

`strand<-`
showMethods("strand<-")

unstrand

invertStrand
showMethods("invertStrand")
selectMethod("invertStrand", "ANY")  # the default method

library(GenomicRanges)

showMethods("strand")
selectMethod("strand", "missing")
strand()

showMethods("strand<-")

Subsetting vector-like, matrix-like and data-frame-like objects

Description

Return subsets of vector-like, matrix-like or data-frame-like objects which meet conditions.

NOTE: This man page is for the subset S4 generic function defined in the BiocGenerics package. See ?base:: for the subset S3 generic defined in the base package.

Usage

subset(x, ...)

Arguments

ArgumentDescription
xA vector-like, matrix-like or data-frame-like object to be subsetted.
...Additional arguments (e.g. subset , select , drop ), for use in specific methods. See ?base:: for more information.

Value

An object similar to x containing just the selected elements (for a vector-like object), or the selected rows and columns (for a matrix-like or data-frame-like object).

Seealso

  • base:: in the base package for the subset S3 generic.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • subset,DataTable-method in the S4Vectors package for an example of a specific subset method (defined for DataTable objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

subset
showMethods("subset")
selectMethod("subset", "ANY")  # the default method

library(S4Vectors)
showMethods("subset")
selectMethod("subset", "DataTable")  # the "subset" method for
# DataTable objects

Matrix Transponse

Description

Given a rectangular object x , t returns the transpose of x .

NOTE: This man page is for the t S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects (typically array-like) not supported by the default method.

Usage

t(x)

Arguments

ArgumentDescription
xa rectangular object, like a matrix or data frame

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages will typically return an object of the same class as the input object.

Seealso

  • base:: for the default t method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • t,Hits-method in the S4Vectors package for an example of a specific t method (defined for Hits objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

t
showMethods("t")
selectMethod("t", "ANY")  # the default method

Cross tabulation and table creation

Description

table uses the cross-classifying factors to build a contingency table of the counts at each combination of factor levels.

NOTE: This man page is for the table S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

table(...)

Arguments

ArgumentDescription
...One or more objects which can be interpreted as factors (including character strings), or a list (or data frame) whose components can be so interpreted.

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should also return the type of object returned by the default method.

Seealso

  • base:: for the default table method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • table,Rle-method in the S4Vectors package for an example of a specific table method (defined for Rle objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

table
showMethods("table")
selectMethod("table", "ANY")  # the default method

Apply a function over a ragged array

Description

tapply applies a function to each cell of a ragged array, that is to each (non-empty) group of values given by a unique combination of the levels of certain factors.

NOTE: This man page is for the tapply S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects (typically list-like or vector-like) not supported by the default method.

Usage

tapply(X, INDEX, FUN=NULL, ..., default=NA, simplify=TRUE)

Arguments

ArgumentDescription
XThe default method expects an atomic object, typically a vector. See ?base:: for the details. Specific methods can support other objects (typically list-like or vector-like). Please refer to the documentation of a particular method for the details.
INDEXThe default method expects a list of one or more factors, each of same length as X . See ?base:: for the details. Specific methods can support other objects (typically list-like). Please refer to the documentation of a particular method for the details.
FUN, ..., default, simplifySee ?base:: for a description of these arguments.

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • base:: for the default tapply method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • tapply,Vector,ANY-method in the IRanges package for an example of a specific tapply method (defined for Vector objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

tapply  # note the dispatch on the 'X' and 'INDEX' args only
showMethods("tapply")
selectMethod("tapply", c("ANY", "ANY"))  # the default method

Run RUnit package unit tests

Description

testPackage helps developers implement unit tests using the RUnit testing conventions.

Usage

testPackage(pkgname=NULL, subdir="unitTests", pattern="^test_.*\.R$",
    path=getwd())

Arguments

ArgumentDescription
pkgnameThe name of the package whose installed unit tests are to be run. A missing or NULL value implies that the testPackage command will look for tests within the package source directory indicated by path .
subdirA character(1) vector providing the subdirectory in which unit tests are located. The directory is searched first in the (installed or source) package root, or in a subdirectory inst/ below the root.
patternA character(1) regular expression describing the file names to be evaluated; typically used to restrict tests to a subset of all test files.
pathA character(1) directory path indicating, when pkgname is missing or NULL, where unit tests will be searched. path can be any location at or below the package root.

Details

This function is not exported from the package namespace, and must be invoked using triple colons, BiocGenerics:::testPackage() ; it is provided primarily for the convenience of developers.

When invoked with missing or NULL pkgname argument, the function assumes that it has been invoked from within the package source tree (or that the source tree is located above path ), and finds unit tests in subdir="unitTests" in either the base or inst/ directories at the root of the package source tree. This mode is useful when developing unit tests, since the package does not have to be re-installed to run an updated test.

When invoked with pkgname set to the name of an installed package, unit tests are searched for in the installed package directory.

Value

The function returns the result of RUnit::runTestSuite invoked on the unit tests specified in the function call.

Seealso

http://bioconductor.org/developers/how-to/unitTesting-guidelines/

Examples

## Run unit tests found in the library location where
## BiocGenerics is installed
BiocGenerics:::testPackage("BiocGenerics")
## Run unit tests for the package whose source tree implied
## by getwd()
BiocGenerics:::testPackage()

An alternative to as.data.frame()

Description

toTable() is an S4 generic function provided as an alternative to as.data.frame .

Usage

toTable(x, ...)

Arguments

ArgumentDescription
xThe object to turn into a data frame.
...Additional arguments, for use in specific methods.

Value

A data frame.

Seealso

  • The as.data.frame S4 generic defined in the BiocGenerics package.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • toTable,Bimap-method in the AnnotationDbi package for an example of a specific toTable method (defined for Bimap objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

toTable
showMethods("toTable")

library(AnnotationDbi)
showMethods("toTable")
selectMethod("toTable", "Bimap")

Extract unique elements

Description

unique returns an object of the same class as x (typically a vector-like, data-frame-like, or array-like object) but with duplicate elements/rows removed.

NOTE: This man page is for the unique S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like or data-frame-like) not supported by the default method.

Usage

unique(x, incomparables=FALSE, ...)

Arguments

ArgumentDescription
xA vector-like, data-frame-like, or array-like object.
incomparables, ...See ?base:: for a description of these arguments.

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages will typically return an object of the same class as the input object.

unique should always behave consistently with BiocGenerics:: .

Seealso

  • base:: for the default unique method.

  • BiocGenerics:: for determining duplicate elements.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • unique,Rle-method in the S4Vectors package for an example of a specific unique method (defined for Rle objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

unique
showMethods("unique")
selectMethod("unique", "ANY")  # the default method

Flatten list-like objects

Description

Given a list-like object x , unlist produces a vector-like object obtained by concatenating (conceptually thru c ) all the top-level elements in x (each of them being expected to be a vector-like object, typically).

NOTE: This man page is for the unlist S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

unlist(x, recursive=TRUE, use.names=TRUE)

Arguments

ArgumentDescription
xA list-like object.
recursive, use.namesSee ?base:: for a description of these arguments.

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • base:: for the default unlist method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • unlist,List-method in the S4Vectors package for an example of a specific unlist method (defined for List objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

unlist  # note the dispatch on the 'x' arg only
showMethods("unlist")
selectMethod("unlist", "ANY")  # the default method

Unsplit a list-like object

Description

Given a list-like object value and grouping f , unsplit produces a vector-like object x by conceptually reversing the split operation value <- split(x, f) .

NOTE: This man page is for the unsplit S4 generic function defined in the BiocGenerics package. See ?base:: for the default method (defined in the base package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

unsplit(value, f, drop=FALSE)

Arguments

ArgumentDescription
valueA list-like object.
fA factor or other grouping object that corresponds to the f symbol in value <- split(x, f) .
dropSee ?base:: for a description of this argument.

Value

See ?base:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • base:: for the default unsplit method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • unsplit,List-method in the IRanges package for an example of a specific unsplit method (defined for List objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

unsplit  # note the dispatch on the 'value' and 'f' args only
showMethods("unsplit")
selectMethod("unsplit", "ANY")  # the default method

Update an object to its current class definition

Description

updateObject is a generic function that returns an instance of object updated to its current class definition.

Usage

updateObject(object, ..., verbose=FALSE)
## Related utilities:
updateObjectFromSlots(object, objclass=class(object), ..., verbose=FALSE)
getObjectSlots(object)

Arguments

ArgumentDescription
objectObject to be updated for updateObject and updateObjectFromSlots . Object for slot information to be extracted from for getObjectSlots .
...Additional arguments, for use in specific updateObject methods.
verboseTRUE or FALSE , indicating whether information about the update should be reported. Use message to report this information.
objclassOptional character string naming the class of the object to be created.

Details

Updating objects is primarily useful when an object has been serialized (e.g., stored to disk) for some time (e.g., months), and the class definition has in the mean time changed. Because of the changed class definition, the serialized instance is no longer valid.

updateObject requires that the class of the returned object be the same as the class of the argument object , and that the object is valid (see validObject ). By default, updateObject has the following behaviors: list(" ", " ", list(list(list("updateObject(ANY, ", list(), ", verbose=FALSE)")), list(" ", " By default, ", list("updateObject"), " uses heuristic methods to determine ", " whether the object should be the new' S4 type (introduced in R 2.4.0), ", " but is not. If the heuristics indicate an update is required, ", " the ", list("updateObjectFromSlots"), " function tries to update the ", " object. The default method returns the original S4 object or the ", " successfully updated object, or issues an error if an update is ", " required but not possible. ", " The optional named argument ", list("verbose"), " causes a message to be ", " printed describing the action. ", " Arguments ", list(list()), " are passed to ", list("updateObjectFromSlots"), ". ", " ")), " ", " ", list(list(list("updateObject(list, ", list(), ", verbose=FALSE)")), list(" ", " Visit each element in ", list("list"), ", applying ", " ", list("updateObject(list[[elt]], ", list(), ", verbose=verbose)"), ". ", " ")), " ", " ", list(list(list("updateObject(environment, ", list(), ", verbose=FALSE)")), list(" ", " Visit each element in ", list("environment"), ", applying ", " ", list("updateObject(environment[[elt]], ", list(), ", verbose=verbose)"), " ", " ")), " ", " ", list(list(list("updateObject(formula, ", list(), ", verbose=FALSE)")), list(" ", " Do nothing; the environment of the formula may be too general ", " (e.g., ", list("R_GlobalEnv"), ") to attempt an update. ", " ")), " ", " ", list(list(list("updateObject(envRefClass, ", list(), ", verbose=FALSE)")), list(" ", " Attempt to update objects from fields using a strategy like ", " ", list("updateObjectFromSlots"), " Method 1. ", " ")), " ", " ")updateObjectFromSlots(object, objclass=class(object), is a utility function that identifies the intersection of slots defined in theobjectinstance andobjclassdefinition. Under Method 1, the corresponding elements inobjectare then updated (withupdateObject(elt, ) and used as arguments to a call tonew(class,, with list() replaced by slots from the original object. If this fails, then Method 2 triesnew(class)and assigns slots ofobjectto the newly created instance.getObjectSlots(object)extracts the slot names and contents fromobject. This is useful whenobjectwas created by a class definition that is no longer current, and hence the contents ofobjectcannot be determined by accessing known slots. ## ValueupdateObjectreturns a valid instance ofobject.updateObjectFromSlotsreturns an instance of classobjclass.getObjectSlotsreturns a list of named elements, with each element corresponding to a slot inobject. ## Seealso * [updateObjectTo](#updateobjectto) in the Biobase package for updating an object to the class definition of a template (might be useful for updating a virtual superclass). * [validObject](#validobject) for testing the validity of an object. * [showMethods](#showmethods) for displaying a summary of the methods defined for a given generic function. * [selectMethod`](#selectmethod) for getting the definition of a specific method.
* BiocGenerics for a summary of all the generics defined in the BiocGenerics package. ## Examples r updateObject showMethods("updateObject") selectMethod("updateObject", "ANY") # the default method library(Biobase) ## update object, same class data(sample.ExpressionSet) obj <- updateObject(sample.ExpressionSet) setClass("UpdtA", representation(x="numeric"), contains="data.frame") setMethod("updateObject", "UpdtA", function(object, ..., verbose=FALSE) { if (verbose) message("updateObject object = 'A'") object <- callNextMethod() object@x <- -object@x object } ) a <- new("UpdtA", x=1:10) ## See steps involved updateObject(a) removeMethod("updateObject", "UpdtA") removeClass("UpdtA")

Variance and Standard Deviation

Description

var and sd compute the variance and standard deviation of a vector x .

NOTE: This man page is for the var and sd , S4 generic functions defined in the BiocGenerics package. See ?stats:: and ?stats:: for the default methods (defined in the stats package). Bioconductor packages can define specific methods for objects (typically array-like) not supported by the default method.

Usage

var(x, y = NULL, na.rm = FALSE, use)
     sd(x, na.rm = FALSE)

Arguments

ArgumentDescription
xa vector-like object
ya vector-like object, or NULL
na.rm, usesee var

Value

See ?stats:: and ?stats:: for the value returned by the default methods.

Specific methods defined in Bioconductor packages will typically return an object of the same class as the input object.

Seealso

  • stats:: and stats:: for the default methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

var
showMethods("var")
selectMethod("var", "ANY")  # the default method

Extract model weights

Description

weights is a generic function which extracts fitting weights from objects returned by modeling functions.

NOTE: This man page is for the weights S4 generic function defined in the BiocGenerics package. See ?stats:: for the default method (defined in the stats package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

weights(object, ...)

Arguments

ArgumentDescription
object, ...See ?stats:: .

Value

Weights extracted from the object object .

See ?stats:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

Seealso

  • stats:: for the default weights method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • weights,PLMset-method in the affyPLM package for an example of a specific weights method (defined for PLMset objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

weights
showMethods("weights")
selectMethod("weights", "ANY")  # the default method

Subscript generators

Description

These functions all return a vector of subscripts into their input.

NOTE: This man page is for the which , which.max and which.min S4 generic functions defined in the BiocGenerics package. See ?base:: and ?base:: for the default methods (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like) not supported by the default methods.

Usage

which(x, arr.ind = FALSE, useNames = TRUE, ...)
which.max(x, ...)
which.min(x, ...)

Arguments

ArgumentDescription
xVector-like object, logical for which , numeric for the others.
arr.ind, useNamesSee ?base:: for a description of these arguments.
...Additional arguments, for use in specific methods.

Value

See ?base:: and ?base:: for the value returned by the default methods.

Specific methods defined in Bioconductor packages will typically return an object of the same class as the input objects.

Seealso

  • base:: for the default which , base:: for the others.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • which.max,NumericList-method in the IRanges package for an example of a specific which.max method (defined for NumericList objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Note

The default methods (defined in the base package) only take a fixed set of arguments. We've added the ... argument to the generic functions defined in the BiocGenerics package so they can be called with an arbitrary number of effective arguments. This typically allows methods to add extra arguments for controlling/altering the behavior of the operation. Like for example the global argument supported by the which.max method for NumericList objects (defined in the IRanges package).

Examples

which
showMethods("which")
selectMethod("which", c("ANY", "ANY"))  # the default method

which.max
showMethods("which.max")
selectMethod("which.max", c("ANY", "ANY"))  # the default method

which.min
showMethods("which.min")
selectMethod("which.min", c("ANY", "ANY"))  # the default method

Cross tabulation

Description

xtabs creates a contingency table (optionally a sparse matrix) from cross-classifying factors, usually contained in a data-frame-like object, using a formula interface.

NOTE: This man page is for the xtabs S4 generic function defined in the BiocGenerics package. See ?stats:: for the default method (defined in the stats package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

xtabs(formula=~., data=parent.frame(), subset, sparse=FALSE, 
      na.action, addNA=FALSE, exclude=if(!addNA)c(NA, NaN),
      drop.unused.levels=FALSE)

Arguments

ArgumentDescription
formula, subset, sparse, na.action, addNA, exclude, drop.unused.levelsSee ?stats:: for a description of these arguments.
dataA data-frame-like object.

Value

See ?stats:: for the value returned by the default method.

Specific methods defined in Bioconductor packages should also return the type of object returned by the default method.

Seealso

  • stats:: for the default xtabs method.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • xtabs,DataTable-method in the S4Vectors package for an example of a specific xtabs method (defined for DataTable objects).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

xtabs  # note the dispatch on the 'data' arg only
showMethods("xtabs")
selectMethod("xtabs", "ANY")  # the default method