Learn R Programming

rqubic (version 1.18.0)

eSetDimName: Get dimname from an eSet object

Description

This function is implemented to automatically validate and choose feature (sample) names from the user input. This function is exported for the purpose of easing other Bioconductor developers performing the similar job, and is not tended to be called by end-user directly.

Usage

eSetDimName(eset, input, type = c("feature", "sample"))

Arguments

eset
An object of eSet class, mostly an ExpressionSet class.
input
The user input, see details below
type
Either ‘feature’ or ‘sample’, indicating which dimension should be determined

Value

dimension of the input object.

Details

The input can be one of the following three possibilities:
  • Missing. Depending on the type, the results of calling featureNames (“feature”) or sampleNames (“sample”) on the eset object will be returned.
  • A character string of length 1. Depending on the type, it is first to be machted to the column names of either fData or pData results of the eset object. If found, the values in that column are returned (coerced to characters if necessary). If not found, the function stops by raising an error.
  • A character vector of the length equal to one of the two dimensions of the eset. In this scenario, the function only validates the equality of the length, coerces the input into characters, and return them.

If none of the scenarios above was met, the function stops by raising an error.

See Also

sampleNames, featureNames, fData, pData

writeQubicInputFile calls the function.

Examples

Run this code
data(sample.ExpressionSet, package="Biobase")
sub.eset <- sample.ExpressionSet[1:3, 1:3]

## usage one:
eSetDimName(sub.eset, type="feature")
eSetDimName(sub.eset, type="sample")

## usage two
## "sex" is one column in the pData(sub.eset) 
eSetDimName(sub.eset, input="sex", type="sample")
## Not run: eSetDimName(sub.eset, input="foo", type="sample")

## usage three
eSetDimName(sub.eset, input=paste("Sample", 1:3), type="sample")
## Not run: eSetDimName(sub.eset, input=paste("Sample", 1:4),
# type="sample")## End(Not run)

## special case: dim equals to one
eSetDimName(sub.eset[,1], input="foo", type="sample")

Run the code above in your browser using DataLab