returnSamples: Return Samples Across Studies

View source: R/returnSamples.R

returnSamplesR Documentation

Return Samples Across Studies

Description

To return samples across studies, users will use returnSamples() along with the sampleMetadata data.frame subset to include only desired samples and metadata. The subset sampleMetadata data.frame will be used to get the desired resources, mergeData will be used to merge them, and the subset sampleMetadata data.frame will be used again to subset the SummarizedExperiment or TreeSummarizedExperiment object to include only desired samples and metadata.

Usage

returnSamples(sampleMetadata, dataType, counts = FALSE, rownames = "long")

Arguments

sampleMetadata

the sampleMetadata data.frame subset to include only desired samples and metadata

dataType

the data type to be returned; one of the following:

  • "gene_families"

  • "marker_abundance"

  • "marker_presence"

  • "pathway_abundance"

  • "pathway_coverage"

  • "relative_abundance"

counts

if FALSE (the default), relative abundance proportions are returned; if TRUE, relative abundance proportions are multiplied by read depth and rounded to the nearest integer prior to being returned

rownames

the type of rownames to use for relative_abundance resources, one of: "long" (the default), "short" (species name), or "NCBI" (NCBI Taxonomy ID)

Details

At present, curatedMetagenomicData resources exists only as entire studies which requires potentially getting many resources for a limited number of samples. Furthermore, because it is necessary to use mergeData internally, the same caveats detailed under Details in mergeData apply here.

Value

when dataType = "relative_abundance", a TreeSummarizedExperiment object is returned; otherwise, a SummarizedExperiment object is returned

Examples

sampleMetadata |>
    dplyr::filter(age >= 18) |>
    dplyr::filter(!base::is.na(alcohol)) |>
    dplyr::filter(body_site == "stool") |>
    dplyr::select(where(~ !base::all(base::is.na(.x)))) |>
    returnSamples("relative_abundance")


vobencha/curatedMetagenomicData documentation built on Oct. 26, 2023, 5:34 a.m.