An entire FacileDataSet or a subset of it can be converted into bioconductor-standard assay containers, like a SummarizedExperiment, DGEList, or ExpressionSet "at any time" using various as.XXX functions, like as.DGEList(...).

as.DGEList(x, ...)

# S3 method for data.frame
as.DGEList(
  x,
  covariates = TRUE,
  feature_ids = NULL,
  assay_name = NULL,
  .fds = NULL,
  custom_key = Sys.getenv("USER"),
  ...
)

# S3 method for tbl
as.DGEList(
  x,
  covariates = TRUE,
  feature_ids = NULL,
  assay_name = NULL,
  .fds = NULL,
  custom_key = Sys.getenv("USER"),
  ...
)

# S3 method for facile_frame
as.DGEList(
  x,
  covariates = TRUE,
  feature_ids = NULL,
  assay_name = NULL,
  custom_key = Sys.getenv("USER"),
  ...
)

# S3 method for FacileDataSet
as.DGEList(
  x,
  covariates = TRUE,
  feature_ids = NULL,
  assay_name = NULL,
  custom_key = Sys.getenv("USER"),
  ...
)

as.ExpressionSet(x, ...)

# S3 method for data.frame
as.ExpressionSet(
  x,
  covariates = TRUE,
  feature_ids = NULL,
  assay_name = default_assay(.fds),
  .fds = fds(x),
  custom_key = Sys.getenv("USER"),
  ...
)

# S3 method for FacileDataSet
as.ExpressionSet(
  x,
  covariates = TRUE,
  feature_ids = NULL,
  assay_name = default_assay(.fds),
  .fds = fds(x),
  custom_key = Sys.getenv("USER"),
  ...
)

as.SummarizedExperiment(x, ...)

# S3 method for data.frame
as.SummarizedExperiment(
  x,
  covariates = TRUE,
  feature_ids = NULL,
  assay_name = default_assay(.fds),
  .fds = fds(x),
  custom_key = Sys.getenv("USER"),
  ...
)

# S3 method for FacileDataSet
as.SummarizedExperiment(
  x,
  covariates = TRUE,
  feature_ids = NULL,
  assay_name = default_assay(.fds),
  .fds = fds(x),
  custom_key = Sys.getenv("USER"),
  ...
)

Arguments

x

a facile expression-like result

covariates

The covariates the user wants to add to the $samples of the DGEList. This can take the following forms:

  • TRUE: All covariates are retrieved from the FacileDataSet

  • FALSE: TODO: Better handle FALSE

  • character: A vector of covariate names to fetch from the FacileDataSet. Must be elements of names(sample_definitions(x))

  • data.frame: A wide covariate table (dataset, sample_id, covariates ...) This may be external covariates for samples not available within x (yet), ie. a table of covariates provided by a third party.

  • NULL: do not decorate with any covariates.

feature_ids

the features to get expression for (if not specified in x descriptor). These correspond to the elements found in the feature_info_tbl(x)$feature_id column.

assay_name

the name of the assay matrix to use when populating the default assay matrix of the bioconductor container (the $counts matrix of a DGEList, the exprs() of an ExpressionSet, etc.). The default value is the entry provided by default_assay()

.fds

The FacileDataSet that x was retrieved from

custom_key

the custom key to use to fetch custom annotations from .fds

Value

the appropriate bioconductor assay container, ie. an edgeR::DGEList for as.DGEList, a Biobase::ExpressionSet for as.ExpressionSet, or a SummarizedExperiment::SummarizedExperiment for as.SummarizedExperiment.

a ExpressionSet

a SummarizedExperiment

Details

We use the term "facile object" to refer to either the entirety of a FacileDataStore or any sample-descriptor that specifies subsets of the data, eg. where fds(x) returns a FacileDataStore. See examples for specifics.

Note that the order that the samples and features are materialized into the expression container are not guaranteed.

Examples

fds <- exampleFacileDataSet() # Retrieve DGEList of gene expression for all samples y.all <- as.DGEList(fds) # gene expression of all samples # Retrieve data for only 3 genes # Suppose we only wanted female samples in our DGEList y.fem <- fds %>% filter_samples(sex == "f") %>% as.DGEList() # or `as.ExpressionSet()`