sample_metadata_custom: For advanced users: import sample metadata directly from the...

View source: R/sample_metadata.R

sample_metadata_customR Documentation

For advanced users: import sample metadata directly from the sample names using regular expressions

Description

For advanced users: import sample metadata directly from the sample names using regular expressions

Usage

sample_metadata_custom(
  dataset,
  sample_property_regex = list(),
  sample_exclude_regex = "",
  group_order = NA,
  group_regex_array = NA
)

Arguments

dataset

your dataset

sample_property_regex

a named list of regular expressions to extract sample properties. name=sample property, value = array of length two with the regex and the replace string (first 2 arguments of sub())

sample_exclude_regex

optionally, regex to select samples that should be flagged as 'exclude'

group_order

optionally, you can provide a preferred ordering of the sample groups as a character array

group_regex_array

optionally, a regex that specifically extracts sample groups and leaves non-matches in an 'unassigned' group

Examples

# example of a regex applied to sample names to extract the sample shortname and group
## Not run: sample_property_regex = list(
  shortname = c(".*experimentname_([A-Z]+.\\d).*", "\\1"),
  group = c(".*experimentname_([A-Z]+)_.*", "\\1")
  )

## End(Not run)

ftwkoopmans/msdap documentation built on March 5, 2025, 12:15 a.m.