bioconductor v3.9.0 Biobase

Functions that are needed by many other packages or which

Link to this section Summary

Functions

A Simple Aggregation Mechanism.

Biobase Package Overview

Utility classes for length one (scalar) objects

Retrieve Meta-data from eSets and ExpressionSets.

Add Menu Items to an Existing/New Menu of Window

Methods for Function annotatedDataFrameFrom in Package Biobase' ## DescriptionannotatedDataFrameFromis a convenience for creating [AnnotatedDataFrame`](#annotateddataframe) objects. ## Author Biocore team

Checks if there are any missing values in an object or not

Retrieve assay data from eSets and ExpressionSets.

Evaluate an expression if its value is not already cached.

Create a new ExpressionSet instance by selecting a specific channel

Retrieve and set channel names from object

Class Containing Measured Variables and Their Meta-Data Description.

Class "AssayData"

Class to Contain and Describe High-Throughput Expression Level Assays.

Class for Storing Microarray Experiment Information

MIAxE objects

Class to Contain and Describe High-Throughput Expression Level Assays.

Class to contain data from multiple channel array technologies

Class to Contain Objects Describing High-Throughput SNP Assays.

Retrieve information about versioned classes

Class "Versioned"

Class "VersionedBiobase"

Class "Versions"

Class "VersionsNull"

A Simple Class for Aggregators

Class to Make Older Versions Compatible

A Lockable List Structure with Constraints on Content

Class to Contain High-Throughput Assays and Experimental Metadata

Function to retrieve contents of environments

List-Environment interactions

Copy Between Connections or Files with Configure-Like Name-Value Substitution

Create a Package Directory from a Template

Dataset: Names and Characteristics of Amino Acids

Sample expression matrix and phenotype data.frames.

Example data.frame representing reporter information

Dataset of class 'ExpressionSet'

Data set of class 'MultiSet'

Biobase Deprecated and Defunct

Retrieve and set overall experimental information eSet-like classes.

Dump Textual Description of a Package

An apply-like function for ExpressionSet and related structures.

Retrieve expression data from eSets.

Retrieve information on features recorded in eSet-derived classes.

Retrieve feature and sample names from eSets.

List Vignette Files for a Package

Internals

Use version information to test whether class is current

Determine Unique Elements

Determine whether object or class contains versioning information

Compute the longest common prefix or suffix of a string

Lengths of list elements

Make an R package from a data object

Nearest neighbor search.

Assign Values to a Names

Informational Messages

Retrieve and set eSet notes.

Open PDF Files in a Standard Viewer

Open a Vignette or Show Vignette Selection Menu

Report Version of a Package

Retrieve information on experimental phenotypes recorded in eSet and ExpressionSet-derived classes.

Protocol Metadata

Read and write 'AnnotatedDataFrame'

Read 'ExpressionSet'

Read MIAME Information into an Instance of Class 'MIAME'

A function to reverse the role of names and values in a list.

Calculates the median for each row in a matrix

A function to compute empirical row quantiles.

Create a new NChannelSet instance by selecting specific channels

Extract elements of a vector for concise rendering

Get and retrieve SNP call and call probability data.

Retrieve or set storage mode for eSets.

Break Character Strings to Fit Width

Extract the same element from the sublists of a list

A function to check internet connectivity to Bioconductor

Update an object to the class definition of a template

Update previously created eSet object to current eSet structure

A function to query the user for input

Conditionally append result to validity message

Link to this section Functions

A Simple Aggregation Mechanism.

Description

Given an environment and an aggregator (an object of class aggregate simple aggregations are made.

Usage

Aggregate(x, agg)

Arguments

ArgumentDescription
xThe data to be aggregated.
aggThe aggregator to be used.

Details

Given some data, x the user can accumulate (or aggregate) information in env using the two supplied functions. See the accompanying documentation for a more complete example of this function and its use.

Value

No value is returned. This function is evaluated purely for side effects. The symbols and values in env are altered.

Seealso

new.env , class:aggregator

Author

R. Gentleman

Examples

agg1 <- new("aggregator")
Aggregate(letters[1:10], agg1)
# the first 10 letters should be symbols in env1 with values of 1
Aggregate(letters[5:11], agg1)
# now letters[5:10] should have value 2
bb <- mget(letters[1:11], env=aggenv(agg1), ifnotfound=NA)
t1 <- as.numeric(bb); names(t1) <- names(bb)
t1
# a b c d e f g h i j k
# 1 1 1 1 2 2 2 2 2 2 1
Link to this function

Biobase_package()

Biobase Package Overview

Description

Biobase Package Overview

Details

Important data classes: ExpressionSet , AnnotatedDataFrame MIAME . Full help on methods and associated functions is available from within class help pages.

Additional data classes: eSet , MIAxE , MultiSet . Additional manipulation and data structuring classes: Versioned , VersionedBiobase , aggregator , container .

Vignette routines: openVignette , getPkgVigs , openPDF .

Package manipulation functions: createPackage and package.version

Data sets: aaMap , sample.ExpressionSet , geneData .

Introductory information is available from vignettes, type openVignette() .

Full listing of documented articles is available in HTML view by typing help.start() and selecting Biobase package from the Packages menu or via library(help="Biobase") .

Author

O. Sklyar

Link to this function

ScalarObject_class()

Utility classes for length one (scalar) objects

Description

These classes represent scalar quantities, such as a string or a number and are useful because they provide their own validity checking. The classes ScalarCharacter , ScalarLogical , ScalarInteger , and ScalarNumeric all extend their respective base vector types and can be used interchangeably (except they should always have length one).

The mkScalar factory function provides a convenient way of creating Scalar<type> objects (see the examples section below).

Usage

mkScalar(obj)

Arguments

ArgumentDescription
objAn object of type character , logical , integer , or double

Author

Seth Falcon

Examples

v <- list(mkScalar("a single string"),
mkScalar(1),
mkScalar(1L),
mkScalar(TRUE))
sapply(v, class)
sapply(v, length)

Retrieve Meta-data from eSets and ExpressionSets.

Description

These generic functions access generic data, abstracts, PubMed IDs and experiment data from instances of the eSet-class or ExpressionSet-class .

Usage

abstract(object)
pubMedIds(object)
pubMedIds(object) <- value
experimentData(object)
experimentData(object) <- value

Arguments

ArgumentDescription
objectObject, possibly derived from eSet-class or MIAME-class
valueValue to be assigned; see class of object (e.g., eSet-class ) for specifics.

Value

abstract returns a character vector containing the abstract (as in a published paper) associated with object .

pubMedIds returns a character vector of PUBMED IDs associated with the experiment.

experimentData returns an object representing the description of an experiment, e.g., an object of MIAME-class

Seealso

ExpressionSet-class , eSet-class , MIAME-class

Author

Biocore

Add Menu Items to an Existing/New Menu of Window

Description

This function adds a menu item for a package's vignettes.

Usage

addVigs2WinMenu(pkgName)

Arguments

ArgumentDescription
pkgNamepkgName - a character string for the name of an R package

Details

The original functions addVig2Menu , addVig4Win , addVig4Unix , addNonExisting , addPDF2Vig have been replaced by addVigs2WinMenu , please use those instead.

Value

The functions do not return any value.

Author

Jianhua Zhang and Jeff Gentry

Examples

# Only works for windows now
if(interactive() && .Platform$OS.type == "windows" &&
.Platform$GUI == "Rgui"){
addVigs2WinMenu("Biobase")
}
Link to this function

annotatedDataFrameFrom_methods()

Methods for Function annotatedDataFrameFrom in Package Biobase' ## DescriptionannotatedDataFrameFromis a convenience for creating [AnnotatedDataFrame`](#annotateddataframe) objects. ## Author Biocore team

Checks if there are any missing values in an object or not

Description

Checks if there are any missing values in an object or not.

Usage

anyMissing(x=NULL)

Arguments

ArgumentDescription
xA vector .

Details

The implementation of this method is optimized for both speed and memory.

Value

Returns TRUE if a missing value was detected, otherwise FALSE .

Author

Henrik Bengtsson ( http://www.braju.com/R/ )

Examples

x <- rnorm(n=1000)
x[seq(300,length(x),by=100)] <- NA
stopifnot(anyMissing(x) == any(is.na(x)))

Retrieve assay data from eSets and ExpressionSets.

Description

This generic function accesses assay data stored in an object derived from the eSet or ExpressionSet class.

Usage

assayData(object)
assayData(object) <- value

Arguments

ArgumentDescription
objectObject derived from class eSet
valueNamed list or environment containing one or more matrices with identical dimensions

Value

assayData applied to eSet -derived classes returns a list or environment; applied to ExpressionSet , the method returns an environment. See the class documentation for specific details.

Seealso

eSet-class , ExpressionSet-class , SnpSet-class

Author

Biocore

Evaluate an expression if its value is not already cached.

Description

Cache the evaluation of an expression in the file system.

Usage

cache(expr, dir=".", prefix="tmp_R_cache_")

Arguments

ArgumentDescription
exprAn expression of the form LHS <- RHS , Where LHS is a variable name, RHS is any valid expression, and <- must be used ( = will not work).
dirA string specifying the directory into which cache files should be written (also where to go searching for an appropriate cache file).
prefixA string giving the prefix to use when naming and searching for cache files. The default is "tmp_R_cache_"

Details

This function can be useful during the development of computationally intensive workflows, for example in vignettes or scripts. The function uses a cache file in dir which defaults to the current working directory whose name is obtained by paste(prefix, name, .

When cache is called and the cache file exists, it is loaded and the object whose name is given on the left of <- in expr is returned. In this case, expr is not evaluted.

When cache is called and the cache file does not exist, expr is evaluted, its value is saved into a cache file, and then its value is returned.

The expr argument must be of the form of someVar <- . That is, the left hand side must be a single symbol name and the next syntactic token must be <- .

To flush the cache and force recomputation, simply remove the cache files. You can use file.remove to do this.

Value

The (cached) value of expr .

Author

Wolfgang Huber, huber@ebi.ac.uk Seth Falcon, sfalcon@fhcrc.org

Examples

bigCalc <- function() runif(10)
cache(myComplicatedObject <- bigCalc())
aCopy <- myComplicatedObject
remove(myComplicatedObject)
cache(myComplicatedObject <- bigCalc())
stopifnot(all.equal(myComplicatedObject, aCopy))
allCacheFiles <-
list.files(".", pattern="^tmp_R_cache_.*\.RData$", full.name=TRUE)
file.remove(allCacheFiles)

Create a new ExpressionSet instance by selecting a specific channel

Description

This generic function extracts a specific element from an object, returning a instance of the ExpressionSet class.

Usage

channel(object, name, ...)

Arguments

ArgumentDescription
objectAn S4 object, typically derived from class eSet
nameThe name of the channel, a (length one) character vector.
...Additional arguments.

Value

An instance of class ExpressionSet .

Author

Biocore

Examples

obj <- NChannelSet(
R=matrix(runif(100), 20, 5),
G=matrix(runif(100), 20, 5))
## G channel as ExpressionSet
channel(obj, "G")

Retrieve and set channel names from object

Description

This generic function reports or updates the channels in an object.

Usage

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

Arguments

ArgumentDescription
objectAn S4 object, typically derived from class eSet
valueReplacement value, either a character vector (to re-order existing channel names or a named character vector or list (to change channel names from the vector elements to the corresponding names).
...Additional argument, not currently used.

Details

channelNames returns the names of the channels in a defined order. Change the order using the replacement method with a permuation of the channel names as value . Rename channels using the replacement method with a named list, where the vector elements are a permutation of the current channels, with corresponding names the new identifier for the channel.

Value

character .

Author

Biocore

Examples

## channelNames default to alphabetical order of channels
obj <- NChannelSet(
R=matrix(runif(100), 20, 5),
G=matrix(-runif(100), 20, 5))
channelNames(obj)
channelNames(obj) <- c(Gn="G", Rd="R")   ## rename
channelNames(obj)
channelNames(obj) <- c("Rd", "Gn")       ## reorder
channelNames(obj)
all(assayData(obj)[["Gn"]] <= 0)
all(assayData(obj)[["Rd"]] >= 0)
Link to this function

classAnnotatedDataFrame()

Class Containing Measured Variables and Their Meta-Data Description.

Description

An AnnotatedDataFrame consists of two parts. There is a collection of samples and the values of variables measured on those samples. There is also a description of each variable measured. The components of an AnnotatedDataFrame can be accessed with pData and varMetadata .

Seealso

eSet , ExpressionSet , read.AnnotatedDataFrame

Author

V.J. Carey, after initial design by R. Gentleman

Examples

df <- data.frame(x=1:6,
y=rep(c("Low", "High"),3),
z=I(LETTERS[1:6]),
row.names=paste("Sample", 1:6, sep="_"))
metaData <-
data.frame(labelDescription=c(
"Numbers",
"Factor levels",
"Characters"))

AnnotatedDataFrame()
AnnotatedDataFrame(data=df)
AnnotatedDataFrame(data=df, varMetadata=metaData)
as(df, "AnnotatedDataFrame")

obj <- AnnotatedDataFrame()
pData(obj) <- df
varMetadata(obj) <- metaData
validObject(obj)
Link to this function

classAssayData()

Class "AssayData"

Description

Container class defined as a class union of list and environment . Designed to contain one or more matrices of the same dimension.

Seealso

eSet-class ExpressionSet-class

Author

Biocore

Link to this function

classExpressionSet()

Class to Contain and Describe High-Throughput Expression Level Assays.

Description

Container for high-throughput assays and experimental metadata. ExpressionSet class is derived from eSet , and requires a matrix named exprs as assayData member.

Usage

## Instance creation
ExpressionSet(assayData,
    phenoData=annotatedDataFrameFrom(assayData, byrow=FALSE),
    featureData=annotatedDataFrameFrom(assayData, byrow=TRUE),
    experimentData=MIAME(), annotation=character(),
    protocolData=annotatedDataFrameFrom(assayData, byrow=FALSE),
    ...)
## Additional methods documented below

Arguments

ArgumentDescription
assayDataA matrix of expression values, or an environment . When assayData is a matrix , the rows represent probe sets ( features in ExpressionSet parlance). Columns represent samples. When present, row names identify features and column names identify samples. Row and column names must be unique, and consistent with row names of featureData and phenoData , respectively. The assay data can be retrieved with exprs() . When assayData is an environment, it contains identically dimensioned matrices like that described in the previous paragraph. One of the elements of the environment must be named exprs ; this element is returned with exprs() .
phenoDataAn optional AnnotatedDataFrame containing information about each sample. The number of rows in phenoData must match the number of columns in assayData . Row names of phenoData must match column names of the matrix / matricies in assayData .
featureDataAn optional AnnotatedDataFrame containing information about each feature. The number of rows in featureData must match the number of rows in assayData . Row names of featureData must match row names of the matrix / matricies in assayData .
experimentDataAn optional MIAME instance with meta-data (e.g., the lab and resulting publications from the analysis) about the experiment.
annotationA character describing the platform on which the samples were assayed. This is often the name of a Bioconductor chip annotation package, which facilitated down-stream analysis.
protocolDataAn optional AnnotatedDataFrame containing equipment-generated information about protocols. The number of rows and row names of protocolData must agree with the dimension and column names of assayData .
list()Additional arguments, passed to new("ExpressionSet", ...) and available for classes that extend ExpressionSet .

Seealso

eSet-class , ExpressionSet-class .

Author

Biocore team

Examples

# create an instance of ExpressionSet
ExpressionSet()

ExpressionSet(assayData=matrix(runif(1000), nrow=100, ncol=10))

# update an existing ExpressionSet
data(sample.ExpressionSet)
updateObject(sample.ExpressionSet)

# information about assay and sample data
featureNames(sample.ExpressionSet)[1:10]
sampleNames(sample.ExpressionSet)[1:5]
experimentData(sample.ExpressionSet)

# subset: first 10 genes, samples 2, 4, and 10
expressionSet <- sample.ExpressionSet[1:10,c(2,4,10)]

# named features and their expression levels
subset <- expressionSet[c("AFFX-BioC-3_at","AFFX-BioDn-5_at"),]
exprs(subset)

# samples with above-average 'score' in phenoData
highScores <- expressionSet$score > mean(expressionSet$score)
expressionSet[,highScores]

# (automatically) coerce to data.frame
lm(score~AFFX.BioDn.5_at + AFFX.BioC.3_at, data=subset)

Class for Storing Microarray Experiment Information

Description

Class MIAME covers MIAME entries that are not covered by other classes in Bioconductor. Namely, experimental design, samples, hybridizations, normalization controls, and pre-processing information. The MIAME class is derived from MIAxE .

Seealso

class:characterORMIAME , read.MIAME

Author

Rafael A. Irizarry

References

http://www.mged.org/Workgroups/MIAME/miame_1.1.html

MIAxE objects

Description

The MIAxE virtual class is a general container for storing experiment metadata. Information such as experimental design, samples, normalization methods and pre-processing information can be stored in these objets.

The MIAxE class is virtual and MIAxE objects cannot be instantiated directly. The following classes derive directly from the MIAxE class: MIAME.

Seealso

Related classes MIAME-class , ExpressionSet-class . Derived classes MIAME-class .

Author

Biocore team

Examples

# Create a new class
MyData <- setClass("MyData", contains="MIAxE")
MyData()

# MIAxE objects cannot be instantiated directly
try(new("MIAxE"))
Link to this function

classMultiSet()

Class to Contain and Describe High-Throughput Expression Level Assays.

Description

Container for high-throughput assays and experimental metadata. MutliSet is derived from eSet-class . MultiSet differs from ExpressionSet-class because MultiSet can contain any element(s) in assayData ( ExpressionSet must have an element named exprs ).

Seealso

eSet-class , ExpressionSet-class

Author

Biocore team

Examples

# create an instance of ExpressionSet
new("MultiSet")
Link to this function

classNChannelSet()

Class to contain data from multiple channel array technologies

Description

Container for high-throughput assays and experimental meta-data. Data are from experiments where a single chip contains several (more than 1) different channels . All channels on a chip have the same set of features . An experiment consists of a collection of several N-channel chips; each chip is a sample .

An NChannelSet provides a way to coordinate assay data (expression values) with phenotype information and references to chip annotation data; it extends the eSet class.

An NChannelSet allows channels to be extracted (using the channels method, mentioned below), and subsets of features or samples to be selected (using [<features>, ). Selection and subsetting occur so that relevant phenotypic data is maintained by the selection or subset.

Seealso

eSet , ExpressionSet .

Author

Martin Morgan mtmorgan@fhcrc.org

Examples

## An empty NChannelSet
obj <- NChannelSet()

## An NChannelSet with two channels (R, G) and no phenotypic data
obj <- NChannelSet(R=matrix(0,10,5), G=matrix(0,10,5))

## An NChannelSet with two channels and channel-specific phenoData
R <- matrix(0, 10, 3, dimnames=list(NULL, LETTERS[1:3]))
G <- matrix(1, 10, 3, dimnames=list(NULL, LETTERS[1:3]))
assayData <- assayDataNew(R=R, G=G)
data <- data.frame(ChannelRData=numeric(ncol(R)),
ChannelGData=numeric(ncol(R)),
ChannelRAndG=numeric(ncol(R)))
varMetadata <- data.frame(labelDescription=c(
"R-specific phenoData",
"G-specific phenoData",
"Both channel phenoData"),
channel=factor(c("R", "G", "_ALL_")))
phenoData <- AnnotatedDataFrame(data=data, varMetadata=varMetadata)
obj <- NChannelSet(assayData=assayData, phenoData=phenoData)
obj

## G channel as NChannelSet
selectChannels(obj, "G")

## G channel as ExpressionSet
channel(obj, "G")

## Samples "A" and "C"
obj[,c("A", "C")]

Class to Contain Objects Describing High-Throughput SNP Assays.

Description

Container for high-throughput assays and experimental metadata. SnpSet class is derived from eSet , and requires matrices call , callProbability as assay data members.

Seealso

eSet , ExpressionSet

Author

Martin Morgan, V.J. Carey, after initial design by R. Gentleman

Retrieve information about versioned classes

Description

These generic functions return version information for classes derived from Versioned-class , or VersionsNull-class for unversioned objects. The version information is an object of Versions-class .

By default, classVersion has the following behaviors: list(" ", " ", list(list(list("classVersion(Versioned-instance)")), list("Returns a ", list("Versions-class"), " object obtained from the object.")), " ", " ", list(list(list("classVersion{"class"}")), list("Consults the definition of ", list("class"), " and return the current version information, if available.")), " ", " ", list(list(list("classVersion(ANY)")), list("Return a ", list(list("VersionsNull-class")), " object to indicate no version information available.")), " ", " ")

By default, the classVersion<- method has the following behavior: list(" ", " ", list(list(list("classVersion(Versioned-instance)["id"] <- value")), list("Assign (update or add) ", list("value"), " to ", list("Versions-instance"), ". ", list("value"), " is coerced to a valid version description. see ", list(list("Versions-class")), " for additional access methods.")), " ", " ")

Usage

classVersion(object)
classVersion(object) <- value

Arguments

ArgumentDescription
objectObject whose version is to be determined, as described above.
valueVersion-class object to assign to object of Versioned-class object.

Value

classVersion returns an instance of Versions-class

Seealso

Versions-class

Author

Biocore team

Examples

obj <- new("VersionedBiobase")

classVersion(obj)
classVersion(obj)["Biobase"]
classVersion(1:10) # no version
classVersion("ExpressionSet") # consult ExpressionSet prototype

classVersion(obj)["MyVersion"] <- "1.0.0"
classVersion(obj)
Link to this function

classVersioned()

Class "Versioned"

Description

Use this class as a superclass' for classes requiring information about versions. ## Seealso [Versions-class`](#versions-class) ## Author Biocore ## Examples r obj <- new("Versioned", versions=list(A="1.0.0")) obj classVersion(obj) A <- setClass("A", contains="Versioned") classVersion("A") a <- A() a # 'show' nothing by default classVersion(a) B <- setClass("B", contains="Versioned", prototype=prototype(new("Versioned",versions=list(B="1.0.0")))) classVersion("B") b <- B() classVersion(b) classVersion(b)["B"] <- "1.0.1" classVersion(b) classVersion("B") classVersion("B") < classVersion(b) classVersion(b) == "1.0.1" C <- setClass("C", representation(x="numeric"), contains=("VersionedBiobase"), prototype=prototype(new("VersionedBiobase", versions=c(C="1.0.1")))) setMethod("show", signature(object="C"), function(object) print(object@x)) c <- C(x=1:10) c classVersion(c)

Link to this function

classVersionedBiobase()

Class "VersionedBiobase"

Description

Use this class as a superclass' for classes requiring information about versions. By default, the class contains versions for R and Biobase. See [Versioned-class](#versioned-class) for additional details. ## Seealso [Versioned-class`](#versioned-class) ## Author Biocore ## Examples r obj <- new("VersionedBiobase") classVersion(obj) obj <- new("VersionedBiobase", versions=list(A="1.0.0")) classVersion(obj) A <- setClass("A", contains="VersionedBiobase") classVersion("A") a <- A() classVersion(a) obj <- new("VersionedBiobase", versions=c(MyVersion="1.0.0")) classVersion(obj) B <- setClass("B", contains="VersionedBiobase", prototype=prototype(new("VersionedBiobase",versions=list(B="1.0.0")))) classVersion("B") b <- B() classVersion(b) removeClass("A") removeClass("B")

Link to this function

classVersions()

Class "Versions"

Description

A class to record version number information. This class is used to report versions; to add version information to your own class, use Versioned-class .

Seealso

classVersion isCurrent isVersioned

Author

Biocore

Examples

obj <- new("Versions", A="1.0.0")
obj

obj["A"] <- "1.0.1"
obj
obj["B"] <- "2.0"
obj

obj1 <- obj
obj1["B"] <- "2.0.1"

obj1 == obj
obj1["B"] > "2.0.0"
obj["B"] == "2.0" # TRUE!
Link to this function

classVersionsNull()

Class "VersionsNull"

Description

A class used to represent the version' of unversioned objects. Useful primarily for method dispatch. ## Seealso [classVersion`](#classversion) ## Author Biocore ## Examples r obj <- new("VersionsNull") obj obj <- new("VersionsNull", A="1.0.0") # warning obj

Link to this function

classaggregator()

A Simple Class for Aggregators

Description

A class of objects designed to help aggregate calculations over an iterative computation. The aggregator consists of three objects. An environment to hold the values. A function that sets up an initial value the first time an object is seen. An aggregate function that increments the value of an object seen previously.

Details

This class is used to help aggregate different values over function calls. A very simple example is to use leave one out cross-validation for prediction. At each stage we first perform feature selection and then cross-validate. To keep track of how often each feature is selected we can use an aggregator. At the end of the cross-validation we can extract the names of the features chosen from aggenv .

Seealso

Aggregate

Link to this function

classcharacterORmiame()

Class to Make Older Versions Compatible

Description

This class can be either character or MIAME .

Seealso

See also MIAME

Link to this function

classcontainer()

A Lockable List Structure with Constraints on Content

Description

Container class that specializes the list construct of R to provide content and access control

Examples

x1 <- new("container", x=vector("list", length=3), content="lm")
lm1 <- lm(rnorm(10)~runif(10))
x1[[1]] <- lm1

Class to Contain High-Throughput Assays and Experimental Metadata

Description

Container for high-throughput assays and experimental metadata. Classes derived from eSet contain one or more identical-sized matrices as assayData elements. Derived classes (e.g., ExpressionSet-class , SnpSet-class ) specify which elements must be present in the assayData slot.

eSet object cannot be instantiated directly; see the examples for usage.

Seealso

Method use in ExpressionSet-class . Related classes AssayData-class , AnnotatedDataFrame-class , MIAME-class . Derived classes ExpressionSet-class , SnpSet-class . To update objects from previous class versions, see updateOldESet .

Author

Biocore team

Examples

# update previous eSet-like class oldESet to existing derived class
updateOldESet(oldESet, "ExpressionSet")

# create a new, ad hoc, class, for personal use
# all methods outlined above are available automatically
.MySet <- setClass("MySet", contains="eSet")
.MySet()

# Create a more robust class, with constructor and validation methods
# to ensure assayData contains specific matricies
.TwoColorSet <- setClass("TwoColorSet", contains="eSet")

TwoColorSet <-
function(phenoData=AnnotatedDataFrame(), experimentData=MIAME(),
annotation=character(), R=new("matrix"), G=new("matrix"),
Rb=new("matrix"), Gb=new("matrix"), ...)
{
.TwoColorSet(phenoData=phenoData, experimentData=experimentData,
annotation=annotation, R=R, G=G, Rb=Rb, Gb=Gb, ...)
}

setValidity("TwoColorSet", function(object) {
assayDataValidMembers(assayData(object), c("R", "G", "Rb", "Gb"))
})

TwoColorSet()

# eSet objects cannot be instantiated directly, only derived objects
try(new("eSet"))

removeClass("MySet")
removeClass("TwoColorSet")

Function to retrieve contents of environments

Description

The contents method is used to retrieve the values stored in an environment.

Usage

contents(object, all.names)

Arguments

ArgumentDescription
objectThe environment (data table) that you want to get all contents from
all.namesa logical indicating whether to copy all values in as.list.environment

Value

A named list is returned, where the elements are the objects stored in the environment. The names of the elements are the names of the objects.

The all.names argument is identical to the one used in as.list.environment .

Seealso

as.list.environment

Author

R. Gentleman

Examples

z <- new.env()
multiassign(letters, 1:26, envir=z)
contents(z)

List-Environment interactions

Description

These functions can be used to make copies of environments, or to get/assign all of the objects inside of an environment.

Usage

copyEnv(oldEnv, newEnv, all.names=FALSE)

Arguments

ArgumentDescription
oldEnvAn environment to copy from
newEnvAn environment to copy to. If missing, a new environment with the same parent environment as oldEnv.
all.namesWhether to retrieve objects with names that start with a dot.

Details

copyEnv : This function will make a copy of the contents from oldEnv and place them into newEnv .

Seealso

environment , as.list

Author

Jeff Gentry and R. Gentleman

Examples

z <- new.env(hash=TRUE, parent=emptyenv(), size=29L)
multiassign(c("a","b","c"), c(1,2,3), z)

a <- copyEnv(z)
ls(a)
Link to this function

copySubstitute()

Copy Between Connections or Files with Configure-Like Name-Value Substitution

Description

Copy files, directory trees or between connections and replace all occurences of a symbol by the corresponding value.

Usage

copySubstitute(src, dest, symbolValues, symbolDelimiter="@", allowUnresolvedSymbols=FALSE,
               recursive = FALSE, removeExtension = "\.in$")

Arguments

ArgumentDescription
srcSource, either a character vector with filenames and/or directory names, or a connection object.
destDestination, either a character vector of length 1 with the name of an existing, writable directory, or a connection object. The class of the dest argument must match that of the src argument.
symbolValuesA named list of character strings.
symbolDelimiterA character string of length one with a single character in it.
allowUnresolvedSymbolsLogical. If FALSE , then the function will execute stop if it comes across symbols that are not defined in symbolValues .
recursiveLogical. If TRUE , the function works recursively down a directory tree (see details).
removeExtensionCharacter. Matches to this regular expression are removed from filenames and directory names.

Details

Symbol substitution: this is best explained with an example. If the list symbolValues contains an element with name FOO and value bar , and symbolDelimiter is @ , then any occurrence of @FOO@ is replaced by bar . This applies both the text contents of the files in src as well as to the filenames. See examples.

If recursive is FALSE , both src and dest must be connection or a filenames. The text in src is read through the function readLines , symbols are replaced by their values, and the result is written to dest through the function writeLines .

If recursive is TRUE , copySubstitute works recursively down a directory tree (see details and example). src must be a character vector with multiple filenames or directory names, dest a directory name.

One use of this function is in createPackage for the automatic generation of packages from a template package directory.

Value

None. The function is called for its side effect.

Author

Wolfgang Huber http://www.dkfz.de/mga/whuber

Examples

## create an example file
infile  = tempfile()
outfile = tempfile()

writeLines(text=c("We will perform in @WHAT@:",
"So, thanks to @WHOM@ at once and to each one,",
"Whom we invite to see us crown'd at @WHERE@."),
con = infile)

## create the symbol table
z = list(WHAT="measure, time and place", WHOM="all", WHERE="Scone")

## run copySubstitute
copySubstitute(infile, outfile, z)

## display the results
readLines(outfile)



##--------------------------------------------------------------
## This is a slightly more complicated example that demonstrates
## how copySubstitute works on nested directories
##--------------------------------------------------------------
d = tempdir()
my.dir.create = function(x) {dir.create(x); return(x)}

unlink(file.path(d, "src"), recursive=TRUE)
unlink(file.path(d, "dest"), recursive=TRUE)

## create some directories and files:
src  = my.dir.create(file.path(d, "src"))
dest = file.path(d, "dest")
d1   = my.dir.create(file.path(src, "dir1.in"))
d2   = my.dir.create(file.path(src, "dir2@FOO@.in"))
d3   = my.dir.create(file.path(d2, "dir3"))
d4   = my.dir.create(file.path(d3, "dir4"))
d5   = my.dir.create(file.path(d4, "dir5@BAR@"))
writeLines(c("File1:", "FOO: @FOO@"),     file.path(d1, "file1.txt.in"))
writeLines(c("File2:", "BAR: @BAR@"),     file.path(d2, "file2.txt.in"))
writeLines(c("File3:", "SUN: @SUN@"),     file.path(d3, "file3.txt.in"))
writeLines(c("File4:", "MOON: @MOON@"),   file.path(d4, "@SUN@.txt"))

## call copySubstitute
copySubstitute(src, dest, recursive=TRUE,
symbolValues = list(FOO="thefoo", BAR="thebar",
SUN="thesun", MOON="themoon"))

## view the result
listsrc  = dir(src,  full.names=TRUE, recursive=TRUE)
listdest = dir(dest, full.names=TRUE, recursive=TRUE)
listsrc
listdest

cat(unlist(lapply(listsrc,  readLines)), sep="
")
cat(unlist(lapply(listdest, readLines)), sep="
")
Link to this function

createPackage()

Create a Package Directory from a Template

Description

Create a package directory from a template, with symbol-value substitution

Usage

createPackage(pkgname, destinationDir, originDir, symbolValues, unlink=FALSE, quiet=FALSE)

Arguments

ArgumentDescription
pkgnameCharacter. The name of the package to be written.
destinationDirCharacter. The path to a directory where the package is to be written.
originDirCharacter. The path to a directory that contains the template package. Usually, this will contain a file named DESCRIPTION , and subdirectories R , man , data . In all files and filenames, symbols will be replaced by their respective values, see the parameter symbolValues .
symbolValuesNamed list of character strings. The symbol-to-value mapping. See copySubstitute for details.
unlinkLogical. If TRUE , and destinationDir already contains a file or directory with the name pkgname , try to unlink (remove) it.
quietLogical. If TRUE , do not print information messages.

Details

The intended use of this function is for the automated mass production of data packages, such as the microarray annotation, CDF, and probe sequence packages.

No syntactic or other checking of the package is performed. For this, use R CMD check.

The symbols @PKGNAME@ and @DATE@ are automatically defined with the values of pkgname and date() , respectively.

Value

The function returns a list with one element pkgdir : the path to the package.

Seealso

copySubstitute , the reference manual Writing R extensions .

Author

Wolfgang Huber http://www.dkfz.de/mga/whuber

Examples

sym  = list(AUTHOR = "Hesiod", VERSION = "1.0",
TITLE = "the nine muses",
FORMAT = "Character vector containg the names of the 9 muses.")

res  = createPackage("muses",
destinationDir = tempdir(),
originDir      = system.file("Code", package="Biobase"),
symbolValues   = sym,
unlink = TRUE, quiet = FALSE)

muses = c("Calliope", "Clio", "Erato", "Euterpe", "Melpomene",
"Polyhymnia", "Terpsichore", "Thalia", "Urania")

dir.create(file.path(res$pkgdir, "data"))

save(muses, file = file.path(res$pkgdir, "data", "muses.rda"))

res$pkgdir

Dataset: Names and Characteristics of Amino Acids

Description

The aaMap data frame has 20 rows and 6 columns. Includes elementary information about amino acids.

Format

This data frame contains the following columns: list(" ", " ", list(list("name"), list("amino acid name")), " ", " ", list(list("let.1"), list("one-letter code")), " ", " ", list(list("let.3"), list("three-letter code")), " ", " ", list(list("scProp"), list("side chain property at pH 7 (polar/nonpolar)")), " ", " ", list(list("hyPhilic"), list("logical: side chain is hydrophilic at pH 7")), " ", " ", list(list("acidic"), list("logical: side chain is acidic at pH 7")), " ", " ")

Usage

data(aaMap)

Examples

data(aaMap)

Sample expression matrix and phenotype data.frames.

Description

The geneData data.frame has 500 rows and 26 columns. It consists of a subset of real expression data from an Affymetrix U95v2 chip. The data are anonymous. The covariate data geneCov and geneCovariate are made up. The standard error data seD is also made up.

Format

A 500 by 26 data frame.

Usage

data(geneData)

Examples

data(geneData)
data(geneCovariate)
data(seD)

Example data.frame representing reporter information

Description

The reporter object is a 500 by 1 data frame. The rows represent the 500 probe IDs in the geneData data. The values in reporter are the predefined probe types for the probes. reporter is used in conjunction with the geneData object and its associates.

Format

A 500 by 1 data frame

Usage

data(reporter)

Details

There are 10 predefined probe types:

  • AFFX- Quality Control (QC)

  • _f_ SequenceFamily

  • _g_ CommonGroups

  • _s_ SimilarityConstraint

  • _r_ RulesDropped

  • _i_ Incomplete

  • _b_ AmbiguousProbeSet

  • _l_ LongProbeSet

  • _at AntiSenseTarget

  • _st SenseTarget

Examples

data(reporter)
## maybe str(reporter) ; plot(reporter) ...
Link to this function

datasampleExpressionSet()

Dataset of class 'ExpressionSet'

Description

The expression data are real but anonymized. The data are from an experiment that used Affymetrix U95v2 chips. The data were processed by dChip and then exported to R for analysis.

The data illustrate ExpressionSet-class , with assayData containing the required matrix element exprs and an additional matrix se.exprs . se.exprs has the same dimensions as exprs .

The phenoData and standard error estimates (se.exprs) are made up. The information in the "description" slot is fake.

Format

The data for 26 cases, labeled A to Z and 500 genes. Each case has three covariates: sex (male/female); type (case/control); and score (testing score).

Usage

data(sample.ExpressionSet)

Examples

data(sample.ExpressionSet)
Link to this function

datasampleMultiSet()

Data set of class 'MultiSet'

Description

The expression data are real but anonymized. The data are from an experiment that used Affymetrix U95v2 chips. The data were processed by dChip and then exported to R for analysis.

The phenoData, standard error estimates, and description data are fake.

Format

The data for 4 cases, labeled a to d and 500 genes. Each case has five covariates: SlideNumber: number; FileName: name; Cy3: genotype labeled Cy3; Cy5: genotype labeled Cy5; Date: date.

Usage

data(sample.MultiSet)

Examples

data(sample.MultiSet)

Biobase Deprecated and Defunct

Description

The function, class, or data object you have asked for has been deprecated or made defunct.

Retrieve and set overall experimental information eSet-like classes.

Description

These generic functions access experimental information associated with eSet-class .

Usage

description(object, list())
description(object) <- value

Arguments

ArgumentDescription
objectObject, possibly derived from class eSet-class .
valueStructured information describing the experiment, e.g., of MIAME-class .
list()Further arguments to be used by other methods.

Value

description returns an object of MIAME-class .

Seealso

eSet-class , MIAME-class

Author

Biocore

Dump Textual Description of a Package

Description

Dump textual description of a package

Usage

dumpPackTxt(package)

Arguments

ArgumentDescription
packageCharacter string naming an R package

Details

dumps DESCRIPTION and INDEX files from package sources

Value

stdout output

Note

Other approaches using formatDL are feasible

Author

stvjc@channing.harvard.edu

Examples

dumpPackTxt("stats")

An apply-like function for ExpressionSet and related structures.

Description

esApply is a wrapper to apply for use with ExpressionSet s. The application of a function to rows of an expression array usually involves variables in pData . esApply uses a special evaluation paradigm to make this easy. The function FUN may reference any data in pData by name.

Usage

esApply(X, MARGIN, FUN, list())

Arguments

ArgumentDescription
XAn instance of class ExpressionSet .
MARGINThe margin to apply to, either 1 for rows (samples) or 2 for columns (features).
FUNAny function
list()Additional parameters for FUN .

Details

The pData from X is installed in an environment. This environment is installed as the environment of FUN . This will then provide bindings for any symbols in FUN that are the same as the names of the pData of X . If FUN has an environment already it is retained but placed after the newly created environment. Some variable shadowing could occur under these circumstances.

Value

The result of with(pData(x), apply(exprs(X), MARGIN, FUN, ...)) .

Seealso

apply , ExpressionSet

Author

V.J. Carey stvjc@channing.harvard.edu, R. Gentleman

Examples

data(sample.ExpressionSet)
## sum columns of exprs
res <- esApply(sample.ExpressionSet, 1, sum)

## t-test, spliting samples by 'sex'
f <- function(x) {
xx <- split(x, sex)
t.test(xx[[1]], xx[[2]])$p.value
}
res <- esApply(sample.ExpressionSet, 1, f)

## same, but using a variable passed in the function call

f <- function(x, s) {
xx <- split(x, s)
mean(xx[[1]]) - mean(xx[[2]])
}
sex <- sample.ExpressionSet[["sex"]]
res <- esApply(sample.ExpressionSet, 1, f, s = sex)

# obtain the p-value of the t-test for sex difference
mytt.demo <- function(y) {
ys <- split(y, sex)
t.test(ys[[1]], ys[[2]])$p.value
}
sexPValue <- esApply(sample.ExpressionSet, 1, mytt.demo)

# obtain the p-value of the slope associated with score, adjusting for sex
# (if we were concerned with sign we could save the z statistic instead at coef[3,3]
myreg.demo <- function(y) {
summary(lm(y ~ sex + score))$coef[3,4]
}
scorePValue <- esApply(sample.ExpressionSet, 1, myreg.demo)

# a resampling method
resamp <- function(ESET) {
ntiss <- ncol(exprs(ESET))
newind <- sample(1:ntiss, size = ntiss, replace = TRUE)
ESET[newind,]
}

# a filter
q3g100filt <- function(eset) {
apply(exprs(eset), 1, function(x) quantile(x,.75) > 100)
}

# filter after resampling and then apply
set.seed(123)
rest <- esApply({bool <- q3g100filt(resamp(sample.ExpressionSet)); sample.ExpressionSet[bool,]},
1, mytt.demo)

Retrieve expression data from eSets.

Description

These generic functions access the expression and error measurements of assay data stored in an object derived from the eSet-class .

Usage

exprs(object)
exprs(object) <- value
se.exprs(object)
se.exprs(object) <- value

Arguments

ArgumentDescription
objectObject derived from class eSet .
valueMatrix with rows representing features and columns samples.

Value

exprs returns a (usually large!) matrix of expression values; se.exprs returns the corresponding matrix of standard errors, when available.

Seealso

eSet-class , ExpressionSet-class , SnpSet-class

Author

Biocore

Retrieve information on features recorded in eSet-derived classes.

Description

These generic functions access feature data (experiment specific information about features) and feature meta-data (e.g., descriptions of feature covariates).

Usage

featureData(object)
featureData(object) <- value
fData(object)
fData(object) <- value
fvarLabels(object)
fvarLabels(object) <- value
fvarMetadata(object)
fvarMetadata(object) <- value

Arguments

ArgumentDescription
objectObject, possibly derived from eSet-class or AnnotatedDataFrame-class .
valueValue to be assigned to corresponding object.

Value

featureData returns an object containing information on both variable values and variable meta-data. fvarLabels returns a character vector of measured variable names. fData returns a data frame with features as rows, variables as columns. fvarMetadata returns a data frame with variable names as rows, description tags (e.g., unit of measurement) as columns.

Seealso

eSet , ExpressionSet

Author

Biocore

Retrieve feature and sample names from eSets.

Description

These generic functions access the feature names (typically, gene or SNP identifiers) and sample names stored in an object derived from the eSet-class .

Usage

featureNames(object)
featureNames(object) <- value
sampleNames(object)
sampleNames(object) <- value

Arguments

ArgumentDescription
objectObject, possibly derived from class eSet .
valueCharacter vector containing feature or sample names.

Value

featureNames returns a (usually long!) character vector uniquely identifying each feature. sampleNames returns a (usually shorter) character vector identifying samples.

Seealso

ExpressionSet-class , SnpSet-class

Author

Biocore

List Vignette Files for a Package

Description

This function will return a listing of all vignettes stored in a package's doc directory.

Usage

getPkgVigs(package = NULL)

Arguments

ArgumentDescription
packageA character vector of packages to search or NULL . The latter is for all attached packages (in search ).

Value

A data.frame with columns package , filename , title .

Seealso

openVignette

Author

Jeff Gentry, modifications by Wolfgang Huber.

Examples

z <- getPkgVigs()
z # and look at them

Internals

Description

Use help.search("your keyword", package="Biobase").

Use version information to test whether class is current

Description

This generic function uses Versioned-class information to ask whether an instance of a class (e.g., read from disk) has current version information.

By default, isCurrent has the following behaviors: list(" ", " ", list(list(list("isCurrent(Versioned-instance)")), list("Returns a vector of ", " logicals, indicating whether each version matches the current version ", " from the class prototype.")), " ", " ", list(list(list("isCurrent(ANY)")), list("Return ", list("NA"), ", indicating that the ", " version cannot be determined")), " ", " ", list(list(list("isCurrent(Versioned-instance, "class")")), list("Returns a ", " logical vector indicating whether version identifiers shared between ",

"     ", list("Versioned-instance"), " and ", list(""class""), " are current.")), "

", " ")

Starting with R-2.6 / Bioconductor 2.1 / Biobase 1.15.1, isCurrent(Versioned-instance, ...) returns an element S4 indicating whether the class has the S4' bit set; a value ofFALSEindicates that the object needs to be recreated. ## Usage ```r isCurrent(object, value) ``` ## Arguments |Argument |Description| |------------- |----------------| |object| Object whose version is to be determined, as described above.| |value| (Optional) character string identifying a class with which to compare versions.| ## ValueisCurrentreturns a logical vector. ## Seealso [Versions-class`](#versions-class) ## Author Biocore team ## Examples r obj <- new("VersionedBiobase") isCurrent(obj) isCurrent(1:10) # NA A <- setClass("A", contains="VersionedBiobase", prototype=prototype(new("VersionedBiobase", versions=c(A="1.0.0")))) a <- A() classVersion(a) isCurrent(a, "VersionedBiobase") # is the 'VersionedBiobase' portion current? classVersion(a)["A"] <- "1.0.1" classVersion(a) isCurrent(a, "VersionedBiobase") isCurrent(a) # more recent, so does not match 'current' defined by prototype removeClass("A")

Determine Unique Elements

Description

Determines which elements of a vector occur exactly once.

Usage

isUnique(x)

Arguments

ArgumentDescription
xa vector

Value

A logical vector of the same length as x , in which TRUE indicates uniqueness.

Seealso

unique , duplicated .

Author

Wolfgang Huber

Examples

x <- c(9:20, 1:5, 3:7, 0:8)
isUnique(x)

Determine whether object or class contains versioning information

Description

This generic function checks to see whether Versioned-class information is present. When the argument to isVersioned is a character string, the prototype of the class corresponding to the string is consulted.

By default, isVersioned has the following behaviors: list(" ", " ", list(list(list("isVersioned(Versioned-instance)")), list("Returns ", list("TRUE"), " when the instance have version information.")), " ", " ", list(list(list("isCurrent("class-name")")), list("Returns ", list("TRUE"), " when the named class extends ", list(list("Versioned-class")), ".")), " ", " ", list(list(list("isVersioned(ANY)")), list("Returns ", list("FALSE"))), " ", " ")

Usage

isVersioned(object)

Arguments

ArgumentDescription
objectObject or class name to check for version information, as described above.

Value

isVersioned returns a logical indicating whether version information is present.

Seealso

Versions-class

Author

Biocore team

Examples

obj <- new("VersionedBiobase")
isVersioned(obj)

isVersioned(1:10) # FALSE

A <- setClass("A", contains="VersionedBiobase",
prototype=prototype(new("VersionedBiobase", versions=c(A="1.0.0"))))
a <- A()
isVersioned(a)

removeClass("A")

Compute the longest common prefix or suffix of a string

Description

These functions find the longest common prefix or suffix among the strings in a character vector.

Usage

lcPrefix(x, ignore.case=FALSE)
lcPrefixC(x, ignore.case=FALSE)
lcSuffix(x, ignore.case=FALSE)

Arguments

ArgumentDescription
xa character vector.
ignore.caseA logical value indicating whether or not to ignore the case in making comparisons.

Details

Computing the longest common suffix is helpful for truncating names of objects, like microarrays, that often have a common suffix, such as .CEL.

There are some potential problems with the approach used if multibyte character encodings are being used.

lcPrefixC is a faster implementation in C. It only handles ascii characters.

Value

The common prefix or suffix.

Seealso

nchar , nchar

Author

R. Gentleman

Examples

s1 <- c("ABC.CEL", "DEF.CEL")
lcSuffix(s1)

s2 <- c("ABC.123", "ABC.456")
lcPrefix(s2)


CHK <- stopifnot

CHK(".CEL" == lcSuffix(s1))
CHK("bc" == lcSuffix(c("abc", "333abc", "bc")))
CHK("c" == lcSuffix(c("c", "abc", "xxxc")))
CHK("" == lcSuffix(c("c", "abc", "xxx")))

CHK("ABC." == lcPrefix(s2))
CHK("ab" == lcPrefix(c("abcd", "abcd123", "ab", "abc", "abc333333")))
CHK("a" == lcPrefix(c("abcd", "abcd123", "ax")))
CHK("a" == lcPrefix(c("a", "abcd123", "ax")))
CHK("" == lcPrefix(c("a", "abc", "xxx")))

CHK("ab" == lcPrefixC(c("abcd", "abcd123", "ab", "abc", "abc333333")))
CHK("a" == lcPrefixC(c("abcd", "abcd123", "ax")))
CHK("a" == lcPrefixC(c("a", "abcd123", "ax")))
CHK("" == lcPrefixC(c("a", "abc", "xxx")))

Lengths of list elements

Description

This function returns an integer vector with the length of the elements of its argument, which is expected to be a list.

Usage

listLen(x)

Arguments

ArgumentDescription
xA list

Details

This function returns a vector of the same length as the list x containing the lengths of each element.

The current implementation is intended for lists containing vectors and the C-level length function is used to determine length. This means no dispatch is done for the elements of the list. If your list contains S4 objects, you should use sapply(x, length) instead.

Seealso

sapply

Author

Jeff Gentry and R. Gentleman

Examples

foo = lapply(1:8, rnorm)
listLen(foo)
Link to this function

makeDataPackage()

Make an R package from a data object

Description

This generic creates a valid R package from an R data object.

Usage

makeDataPackage(object, author, email,
                packageName=deparse(substitute(object)),
                packageVersion=package_version("1.0.0"),
                license="Artistic-2.0",
                biocViews="ExperimentData",
                filePath=tempdir(),
                list())

Arguments

ArgumentDescription
objectAn instance of an R data object.
authorThe author, as a character string.
emailA valid email address for the maintainer, as a character string.
packageNameThe name of the package, defaults to the name of the object instance.
packageVersionThe version number, as a character string.
licenseThe license, as a character string.
biocViewsA character vector of valid biocViews views.
filePathThe location to create the package.
list()Additional arguments to specific methods.

Details

The function makes use of various tools in R and Bioconductor to automatically generate the source files for a valid R package.

Value

The return value is that from a call to link{createPackage} which is invoked once the default arguments are set up. The data instance is stored in the data directory with a name the same as that of the resulting package.

Seealso

createPackage

Note

Developers implementing derived methods might force correct package name evaluation by including 'packageName' in any callNextMethod() .

Author

R. Gentleman

Examples

data(sample.ExpressionSet)
## package created in tempdir()
s1 <- makeDataPackage(sample.ExpressionSet,
author = "Foo Author",
email = "foo@bar",
packageName = "FooBarPkg",
packageVersion = "1.0.0")

Nearest neighbor search.

Description

Find the nearest neighbors of a set of query points in the same or another set of points in an n-dimensional real vector space, using the Euclidean distance.

Usage

matchpt(x, y)

Arguments

ArgumentDescription
xA matrix (or vector) of coordinates. Each row represents a point in an ncol(x) -dimensional real vector space.
yOptional, matrix (or vector) with the same number of columns as x .

Details

If y is provided, the function searches for each point in x its nearest neighbor in y . If y is missing, it searches for each point in x its nearest neighbor in x , excluding that point itself. In the case of ties, only the neighbor with the smaller index is given.

The implementation is simple and of complexity nrow(x) times nrow(y) . For larger problems, please consider one of the many more efficient nearest neighbor search algorithms.

Value

A data.frame with two columns and nrow(x) rows. The first column is the index of the nearest neighbor, the second column the distance to the nearest neighbor. If y was given, the index is a row number in y , otherwise, in x . The row names of the result are those of x .

Author

Oleg Sklyar osklyar@ebi.ac.uk

Examples

a <- matrix(c(2,2,3,5,1,8,-1,4,5,6), ncol=2L, nrow=5L)
rownames(a) = LETTERS[seq_len(nrow(a))]
matchpt(a)
b <- c(1,2,4,5,6)
d <- c(5.3, 3.2, 8.9, 1.3, 5.6, -6, 4.45, 3.32)
matchpt(b, d)
matchpt(d, b)

Assign Values to a Names

Description

Assign values to names in an environment.

Usage

multiassign(x, value, envir = parent.frame(), inherits=FALSE)

Arguments

ArgumentDescription
xA vector or list of names, represented by strings.
valuea vector or list of values to be assigned.
envirthe environment to use. See the details section.
inheritsshould the enclosing frames of the environment be inspected?

Details

The pos argument can specify the environment in which to assign the object in any of several ways: as an integer (the position in the search list); as the character string name of an element in the search list; or as an environment (including using sys.frame to access the currently active function calls). The envir argument is an alternative way to specify an environment, but is primarily there for back compatibility.

If value is missing and x has names then the values in each element of x are assigned to the names of x .

Value

This function is invoked for its side effect, which is assigning the values to the variables in x . If no envir is specified, then the assignment takes place in the currently active environment.

If inherits is TRUE , enclosing environments of the supplied environment are searched until the variable x is encountered. The value is then assigned in the environment in which the variable is encountered. If the symbol is not encountered then assignment takes place in the user's workspace (the global environment).

If inherits is FALSE , assignment takes place in the initial frame of envir .

Examples

#-- Create objects  'r1', 'r2', ... 'r6' --
nam <- paste("r",1:6, sep=".")

multiassign(nam, 11:16)
ls(pat="^r..$")

#assign the values in y to variables with the names from y

y<-list(a=4,d=mean,c="aaa")
multiassign(y)

Informational Messages

Description

Generates an informational message that corresponds to its argument(s). Similar to warning() except prefaced by "Note:" instead of "Warning message:".

Usage

note(...)

Arguments

ArgumentDescription
list()character vectors (which are pasted together) or NULL

Details

This function essentially cat()'s the created string to the screen. It is intended for messages to the user that are deemed to be 'informational', as opposed to warnings, etc.

Seealso

warning , stop

Author

Jeff Gentry

Examples

note("This is an example of a note")

Retrieve and set eSet notes.

Description

These generic functions access notes (unstructured descriptive data) associated eSet-class .

notes(<ExpressionSet>) <- <character> is unusual, in that the character vector is appended to the list of notes; use notes(<ExpressionSet>) <- <list> to entirely replace the list.

Usage

notes(object)
notes(object) <- value

Arguments

ArgumentDescription
objectObject, possibly derived from class eSet-class .
valueCharacter vector containing unstructured information describing the experinement.

Value

notes returns a list.

Seealso

ExpressionSet-class , SnpSet-class

Author

Biocore

Open PDF Files in a Standard Viewer

Description

Displays the specified PDF file.

Usage

openPDF(file, bg=TRUE)

Arguments

ArgumentDescription
fileA character string, indicating the file to view
bgShould the pdf viewer be opened in the background.

Details

Currently this function works on Windows and Unix platforms. Under Windows, whatever program is associated with the file extension will be used. Under Unix, the function will use the program named in the % option "pdfViewer" (default is 'acroread'). -- the code checks pdfviewer! % and that's the option that options() documents. option "pdfviewer" (see help(options) for information on how this is set.)

The bg argument is only interpreted on Unix.

Value

This function is executed for its side effects. The specified PDF file is opened in the PDF viewer and TRUE is returned.

Author

Jeff Gentry

Examples

openPDF("annotate.pdf")

Open a Vignette or Show Vignette Selection Menu

Description

Using the data returned by vignette this function provides a simple easy to use interface for opening vignettes.

Usage

openVignette(package=NULL)

Arguments

ArgumentDescription
packagecharacter string indicating the package to be used.

Details

If package is NULL then all packages are scanned for vignettes. The list of vignettes is presented to the user via the menu command. The user may select one of the vignettes to be opened in a PDF viewer.

Value

No value is returned; this function is run entirely for the side effect of opening the pdf document in the PDF viewer.

Seealso

vignette , openPDF , menu , getPkgVigs

Author

R. Gentleman

Examples

if( interactive() )
openVignette("Biobase")
Link to this function

packageversion()

Report Version of a Package

Description

Will report the version number of a requested installed package

Usage

package.version(pkg, lib.loc = NULL)

Arguments

ArgumentDescription
pkgThe name of the package
lib.loca character vector describing the location of R library trees to search through, or NULL'. The default value ofNULL' corresponds to all libraries currently known.

Details

This function is a convenience wrapper around package.description , and will report simply the version number of the requested package. If the package does not exist or if the DESCRIPTION file can not be read, then an error will be thrown.

Value

A character string reporting the version number.

Seealso

package.description

Author

Jeff Gentry

Examples

package.version("Biobase")

Retrieve information on experimental phenotypes recorded in eSet and ExpressionSet-derived classes.

Description

These generic functions access the phenotypic data (e.g., covariates) and meta-data (e.g., descriptions of covariates) associated with an experiment.

Usage

phenoData(object)
phenoData(object) <- value
varLabels(object)
varLabels(object) <- value
varMetadata(object)
varMetadata(object) <- value
pData(object)
pData(object) <- value

Arguments

ArgumentDescription
objectObject, possibly derived from eSet-class or AnnotatedDataFrame .
valueValue to be assigned to corresponding object.

Value

phenoData returns an object containing information on both variable values and variable meta-data. varLabels returns a character vector of measured variables. pData returns a data frame with samples as rows, variables as columns. varMetadata returns a data frame with variable names as rows, description tags (e.g., unit of measurement) as columns.

Seealso

eSet-class , ExpressionSet-class , SnpSet-class

Author

Biocore

Protocol Metadata

Description

This generic function handles methods for adding and retrieving protocol metadata for the samples in eSets.

Usage

protocolData(object)
protocolData(object) <- value

Arguments

ArgumentDescription
objectObject derived from class eSet
valueObject of class AnnotatedDataFrame

Value

protocolData(object) returns an AnnotatedDataFrame containing the protocol metadata for the samples.

Seealso

phenoData , AnnotatedDataFrame-class , eSet-class , ExpressionSet-class , SnpSet-class

Author

Biocore

Link to this function

readAnnotatedDataFrame()

Read and write 'AnnotatedDataFrame'

Description

Create an instance of class AnnotatedDataFrame by reading a file, or save an AnnotatedDataFrame to a file.

Usage

read.AnnotatedDataFrame(filename, path,
     sep = "    ", header = TRUE, quote = "", stringsAsFactors = FALSE, 
     row.names = 1L,
     varMetadata.char="#",
     widget = getOption("BioC")$Base$use.widgets,
     sampleNames = character(0), ...) 
write.AnnotatedDataFrame(x, file="", varMetadata.char="#", ...,
     append=FALSE, fileEncoding="")

Arguments

ArgumentDescription
filename, filefile or connection from which to read / write.
xAn instance of class AnnotatedDataFrame .
path(optional) directory in which to find filename .
row.namesthis argument gets passed on to read.table and will be used for the row names of the phenoData slot.
varMetadata.charlines beginning with this character are used for the varMetadata slot. See examples.
sep, header, quote, stringsAsFactors, ...further arguments that get passed on to read.table or write.table .
widgetlogical. Currently this is not implemented, and setting this option to TRUE will result in an error. In a precursor of this function, read.phenoData , this option could be used to open an interactive GUI widget for entering the data.
sampleNamesoptional argument that could be used in conjunction with widget ; do not use.
append, fileEncodingArguments as described in write.table

Details

The function read.table is used to read pData . The argument varMetadata.char is passed on to that function as its argument comment.char . Lines beginning with varMetadata.char are expected to contain further information on the column headers of pData . The format is of the form: # variable: textual explanation of the (assuming that # is the value of varMetadata.char ). See also examples.

write.AnnotatedDataFrame outputs varLabels and varMetadata(x)$labelDescription as commented header lines, and pData(x) as a with write.table .

Value

read.AnnotatedDataFrame : An instance of class AnnotatedDataFrame

write.AnnotatedDataFrame : NULL , invisibly.

Seealso

AnnotatedDataFrame for additional methods, read.table for details of reading in phenotypic data

Author

Martin Morgan mtmorgan@fhcrc.org and Wolfgang Huber, based on read.phenoData by Rafael A. Irizarry.

Examples

exampleFile = system.file("extdata", "pData.txt", package="Biobase")

adf <- read.AnnotatedDataFrame(exampleFile)
adf
head(pData(adf))
head(noquote(readLines(exampleFile)), 11)

write.AnnotatedDataFrame(adf)           # write to console by default
Link to this function

readExpressionSet()

Read 'ExpressionSet'

Description

Create an instance of class ExpressionSet by reading data from files. widget functionality is not implemented for readExpressionSet.

Usage

readExpressionSet(exprsFile,
      phenoDataFile,
      experimentDataFile,
      notesFile,
      path,
      annotation,
      ## arguments to read.* methods 
      exprsArgs=list(sep=sep, header=header, row.names=row.names,
        quote=quote, ...),
      phenoDataArgs=list(sep=sep, header=header, row.names=row.names,
        quote=quote, stringsAsFactors=stringsAsFactors, ...),
      experimentDataArgs=list(sep=sep, header=header,
        row.names=row.names, quote=quote,
        stringsAsFactors=stringsAsFactors, ...),
      sep = "   ", header = TRUE, quote = "", stringsAsFactors = FALSE,
      row.names = 1L,
      ## widget
      widget = getOption("BioC")$Base$use.widgets,
      ...)

Arguments

ArgumentDescription
exprsFile(character) File or connection from which to read expression values. The file should contain a matrix with rows as features and columns as samples. read.table is called with this as its file argument and further arguments given by exprsArgs .
phenoDataFile(character) File or connection from which to read phenotypic data. read.AnnotatedDataFrame is called with this as its file argument and further arguments given by phenoDataArgs .
experimentDataFile(character) File or connection from which to read experiment data. read.MIAME is called with this as its file argument and further arguments given by experimentDataArgs .
notesFile(character) File or connection from which to read notes; readLines is used to input the file.
path(optional) directory in which to find all the above files.
annotation(character) A single character string indicating the annotation associated with this ExpressionSet.
exprsArgsA list of arguments to be used with read.table when reading in the expression matrix.
phenoDataArgsA list of arguments to be used (with read.AnnotatedDataFrame ) when reading the phenotypic data.
experimentDataArgsA list of arguments to be used (with read.MIAME ) when reading the experiment data.
sep, header, quote, stringsAsFactors, row.namesarguments used by the read.table -like functions.
widgetA boolean value indicating whether widgets can be used. Widgets are NOT yet implemented for read.AnnotatedDataFrame .
list()Further arguments that can be passed on to the read.table -like functions.

Details

Expression values are read using the read.table function. Phenotypic data are read using the read.AnnotatedDataFrame function. Experiment data are read using the read.MIAME function. Notes are read using the readLines function. The return value must be a valid ExpressionSet . Only the exprsFile argument is required.

Value

An instance of the ExpressionSet class.

Seealso

ExpressionSet for additional methods.

Author

Martin Morgan mtmorgan@fhcrc.org

Examples

exprsFile = system.file("extdata", "exprsData.txt", package="Biobase")
phenoFile = system.file("extdata", "pData.txt", package="Biobase")

## Read ExpressionSet with appropriate parameters
obj = readExpressionSet(exprsFile, phenoFile, sep = "   ", header=TRUE)
obj

Read MIAME Information into an Instance of Class 'MIAME'

Description

Reads MIAME information from a file or using a widget.

Usage

read.MIAME(filename = NULL, widget = getOption("BioC")$Base$use.widgets, ...)

Arguments

ArgumentDescription
filenameFilename from which to read MIAME information.
widgetLogical. If TRUE and a filename is not given, a widget is used to enter information.
list()Further arguments to scan .

Details

Notice that the MIAME class tries to cover the MIAME entries that are not covered by other classes in Bioconductor. Namely, experimental design, samples, hybridizations, normalization controls, and pre-processing information.

The function scan is used to read. The file must be a flat file with the different entries for the instance of MIAME class separated by carriage returns. The order should be: name, lab, contact, title, abstract, and url.

Alternatively a widget can be used.

Value

An object of class MIAME .

Seealso

MIAME , tkMIAME

Author

Rafael Irizarry rafa@jhu.edu

Examples

miame <- read.MIAME(widget=FALSE) ##creates an empty instance
show(miame)

A function to reverse the role of names and values in a list.

Description

Given a list with names x and values in a set y this function returns a list with names in y and values in x .

Usage

reverseSplit(inList)

Arguments

ArgumentDescription
inListA named list with values that are vectors.

Details

First the list is unrolled to provide a two long vectors, names are repeated, once for each of their values. Then the names are split by the values.

This turns out to be useful for inverting mappings between one set of identifiers and an other.

Value

A list with length equal to the number of distinct values in the input list and values from the names of the input list.

Seealso

split

Author

R. Gentleman

Examples

l1 = list(a=1:4, b=c(2,3), d=c(4,5))
reverseSplit(l1)

Calculates the median for each row in a matrix

Description

Calculates the median for each row in a matrix.

Usage

rowMedians(x, na.rm=FALSE, ...)

Arguments

ArgumentDescription
xA numeric NxK matrix .
na.rmIf TRUE , NA s are excluded first, otherwise not.
...Not use.

Details

The implementation of rowMedians() is optimized for both speed and memory. To avoid coercing to double s (and hence memory allocation), there is a special implementation for integer matrices. That is, if x is an integer matrix , then rowMedians(as.double(x)) would require three times the memory of rowMedians(x) , but all this is avoided.

Value

Returns a numeric vector of length N.

Seealso

See rowMeans() in colSums ().

Author

Henrik Bengtsson

Examples

set.seed(1)
x <- rnorm(n=234*543)
x[sample(1:length(x), size=0.1*length(x))] <- NA
dim(x) <- c(234,543)
y1 <- rowMedians(x, na.rm=TRUE)
y2 <- apply(x, MARGIN=1, FUN=median, na.rm=TRUE)
stopifnot(all.equal(y1, y2))

x <- cbind(x1=3, x2=c(4:1, 2:5))
stopifnot(all.equal(rowMeans(x), rowMedians(x)))

A function to compute empirical row quantiles.

Description

This function computes the requested quantile for each row of a matrix, or of an ExpressionSet .

Usage

rowQ(imat, which)
rowMax(imat)
rowMin(imat)

Arguments

ArgumentDescription
imatEither a matrix or an ExpressionSet .
whichAn integer indicating which order statistic should be returned.

Details

rowMax and rowMin simply call rowQ with the appropriate argument set.

The argument which takes values between 1, for the minimum per row, and ncol(imat) , for the maximum per row.

Value

A vector of length equal to the number of rows of the input matrix containing the requested quantiles.

Seealso

rowMedians . rowMeans() in colSums ().

Author

R. Gentleman

Examples

data(sample.ExpressionSet)
rowMin(sample.ExpressionSet)
rowQ(sample.ExpressionSet, 4)
Link to this function

selectChannels()

Create a new NChannelSet instance by selecting specific channels

Description

This generic function extracts specific elements from an object, returning a instance of that object.

Usage

selectChannels(object, names, ...)

Arguments

ArgumentDescription
objectAn S4 object, typically derived from class eSet
namesCharacter vector of named channels.
...Additional arguments.

Value

Instance of class object .

Author

Biocore

Examples

obj <- NChannelSet(R=matrix(runif(100), 20, 5), G=matrix(runif(100), 20, 5))

## G channel as NChannelSet
selectChannels(obj, "G")

Extract elements of a vector for concise rendering

Description

Extract the first and last several elements of a vector for concise rendering; insert ellipses to indicate elided elements. This function is primarily meant for developer rather than end-user use.

Usage

selectSome(obj, maxToShow=5)

Arguments

ArgumentDescription
objA vector.
maxToShowThe number of elements (including "...") to render.

Details

This function can be used in 'show' methods to give users exemplars of the tokens used in a vector. For example, an ExpressionSet built from a yeast experiment might have features enumerated using systematic gene names (e.g., YPR181C) or standard gene names (e.g., SEC23). The show method for ExpressionSet uses selectSome to alert the user to the tokens used, and thereby to indicate what vocabulary must be understood to work with the feature names.

Value

A string vector with at most maxToShow plus 1 elements, where an ellipsis ("...") is included to indicate incompleteness of the excerpt.

Author

Martin Morgan mtmorgan@fhcrc.org

Examples

selectSome(1:20)

Get and retrieve SNP call and call probability data.

Description

These generic functions access the calls and call probabilities stored in objects.

Usage

snpCall(object, ...)
snpCall(object, ...) <- value
snpCallProbability(object, ...)
snpCallProbability(object, ...) <- value

Arguments

ArgumentDescription
objectObject, possibly derived from class SnpSet .
valueMatrix with rows representing SNP calls or call probabilities and columns samples.
...Additional arguments available to methods.

Value

snpCall returns a matrix of SNP calls; snpCallProbability returns the corresponding matrix of standard errors, when available.

Seealso

SnpSet-class

Author

Biocore

Retrieve or set storage mode for eSets.

Description

These generic functions report or change the storage mode used for assayData .

Usage

storageMode(object)
storageMode(object) <- value

Arguments

ArgumentDescription
objectObject, derived from class eSet
valueCharacter vector containing "lockedEnvironment" , "environment" , or "list" . See AssayData-class for details.

Value

storageMode returns a length-1 character vector

Seealso

AssayData-class , eSet-class ExpressionSet-class , SnpSet-class

Author

Biocore

Break Character Strings to Fit Width

Description

Inserts line breaks ( collapse ) into input character strings. The main intention of this function is to prepare long strings for printing, so the output is not wider than width .

Usage

strbreak(x, width=getOption("width"), exdent=2, collapse="
")

Arguments

ArgumentDescription
xa character vector
widtha positive integer giving the width of the output.
exdenta positive integer specifying the indentation of subsequent lines after the first line.
collapsea character. This is inserted to break lines.

Seealso

strwrap , substring

Author

Wolfgang Huber http://www.ebi.ac.uk/huber

Examples

longString = paste(rep(LETTERS, 10), collapse="", sep="")
cat(strbreak(longString))
Link to this function

subListExtract()

Extract the same element from the sublists of a list

Description

Given a list of lists, this function can be used to extract a named element from each sublist.

Usage

subListExtract(L, name, simplify = FALSE, keep.names = TRUE)

Arguments

ArgumentDescription
LA list of named lists
nameThe name of the element in the sublists that should be extracted. This should be a length one character vector.
simplifyWhen TRUE , the return value will be an atomic vector. If any extracted sublist value has length not equal to one and simplify=TRUE , an error will be raised. When FALSE , a list is returned containing the extracted elements.
keep.namesIf TRUE (default), the names of L will be attached to the returned vector.

Details

This function is implemented in C and is intended to be faster than calling lapply or sapply .

Value

If simplify=FALSE , a list will be returned having the same length as L , but with each element containing the element named name from the corresponding inner list of L .

When simplify=TRUE , an atomic vector will be returned containing the extracted elements. If any of the inner list elements do not have length one or cannot be put inside an atomic vector, an error will be raised.

Author

Seth Falcon

Examples

list_size = 500000
innerL = list(foo="foo", bar="bar")
L = rep(list(innerL), list_size)

system.time({j0 = sapply(L, function(x) x$foo)})
system.time({j1 = subListExtract(L, "foo", simplify=TRUE)})
stopifnot(all.equal(j0, j1))

LS = L[1:3]
names(LS) = LETTERS[1:3]
subListExtract(LS, "bar", simplify=TRUE)
subListExtract(LS, "bar", simplify=FALSE)
subListExtract(LS, "bar", simplify=TRUE, keep.names=FALSE)
Link to this function

testBioCConnection()

A function to check internet connectivity to Bioconductor

Description

This function will attempt to determine if the user has internet connectivity to the Bioconductor website. This is useful in many situations dealing with code that uses automated downloads and other such things.

Usage

testBioCConnection()

Value

TRUE if a connection is possible, FALSE if not.

Author

Jeff Gentry

Examples

z <- testBioCConnection()
Link to this function

updateObjectTo()

Update an object to the class definition of a template

Description

The updateObjectTo generic function returns an instance of object updated to the class definition of template .

It requires that the class of the returned object be the same as the class of the template argument, and that the object is valid. Usually, updating proceeds by modifying slots in template with information from object , and returning template . Use as to coerce an object from one type to another; updateObjectTo might be useful to update a virtual superclass. By default, updateObjectTo has the following behavior: list(" ", " ", list(list(list("updateObjectTo(ANY-object,ANY-template)")), list("Attempt ", list("as(ANY-object,class(ANY-template))"), ".")), " ", " ")

Usage

updateObjectTo(object, template, list(), verbose=FALSE)

Arguments

ArgumentDescription
objectObject to be updated.
templateInstance representing a template for updating object.
list()Additional arguments, for use in specific update methods.
verboseA logical, indicating whether information about the update should be reported. Use message to report this.

Value

updateObjectTo returns a valid instance of template .

Seealso

updateObject , Versions-class

Author

Biocore team

Link to this function

updateOldESet()

Update previously created eSet object to current eSet structure

Description

This function updates eSet objects created in previous versions of Biobase to the current class structure. Warnings indicate when coercions change how data in the from object are altered. If the from object was not a valid object of the original eSet class, then updateOldESet may fail.

Usage

updateOldESet(from, toClass, ...)

Arguments

ArgumentDescription
fromObject created using a previous version of the eSet class.
toClassCharacter string identifying new class, e.g., "ExpressionSet"
...Additional arguments passed to the initialization method for class toClass

Value

Valid object of class toClass .

Seealso

eSet-class , ExpressionSet-class , SnpSet-class

Author

Biocore

Examples

updateOldESet(oldESet, "ExpressionSet")

A function to query the user for input

Description

This function will output a given message and seek a response from the user, repeating the message until the input is from a valid set provided by the code.

Usage

userQuery(msg, allowed = c("y", "n"), default = "n", case.sensitive = FALSE)

Arguments

ArgumentDescription
msgThe output message
allowedAllowed input from the user
defaultDefault response if called in batch mode
case.sensitiveIs the response case sensitive? Defaults to FALSE

Value

The input from the user

Author

Jeff Gentry

Conditionally append result to validity message

Description

This function facilitates constructing messages during S4 class validation, and is meant for developer rather than end-user use.

Usage

validMsg(msg, result)

Arguments

ArgumentDescription
msgA character vector or NULL.
resultAny vector.

Details

This function appends result to msg , but only if result is a character vector.

Author

Martin Morgan mtmorgan@fhcrc.org

Examples

msg <- NULL
validMsg(msg, FALSE) # still NULL
msg <- validMsg(msg, "one")
validMsg(msg, "two")