filter_samples.FacileDataSet: Filter against the sample_covariate_tbl EAV table as if it...

View source: R/NSE-filter-samples.R

filter_samples.FacileDataSetR Documentation

Filter against the sample_covariate_tbl EAV table as if it were wide.

Description

This allows the user to query the FacileDataSet as if it were a wide pData data.frame of all its covariates.

Usage

## S3 method for class 'FacileDataSet'
filter_samples(
  x,
  ...,
  samples. = samples(x),
  custom_key = Sys.getenv("USER"),
  with_covariates = FALSE
)

Arguments

x

A FacileDataSet

...

NSE claused to use in dplyr::filter() expressions

Details

This feature is only really meant to be used interactively, and with extreme caution ... programatically specifying the covariates, for instance, does not work right now.

TODO: Implement using tidyeval

Value

a sample-descriptor data.frame that includes the dataset,sample_id pairs that match the virtual filter(covaries, ...) clause executed here.

See Also

Other API: fetch_assay_score.FacileDataSet(), fetch_custom_sample_covariates.FacileDataSet(), fetch_sample_covariates(), fetch_sample_statistics.FacileDataSet(), fetch_samples.FacileDataSet(), filter_features.FacileDataSet(), organism.FacileDataSet(), samples.FacileDataSet()

Examples

fds <- exampleFacileDataSet()

# To identify all samples that are of "CMS3" or "CMS4" subtype(
# stored in the "subtype_crc_cms" covariate:
crc.34 <- filter_samples(fds, subtype_crc_cms %in% c("CMS3", "CMS4"))
eav.query <- fds |>
  fetch_sample_covariates(covariates = "subtype_crc_cms") |>
  filter(value %in% c("CMS3", "CMS4")) |>
  collect()
setequal(crc.34$sample_id, eav.query$sample_id)

# You can keep filtering a filtered dataset
crc.34.male <- filter_samples(crc.34, sex == "m")

facilebio/FacileData documentation built on Feb. 23, 2024, 9:14 a.m.