Learn R Programming

metamorphr (version 0.2.0)

filter_blank: Filter Features based on their occurrence in blank samples

Description

Filters Features based on their occurrence in blank samples. For example, if min_frac = 3 the maximum intensity in samples must be at least 3 times as high as in blanks for a Feature not to be filtered out.

Usage

filter_blank(
  data,
  blank_samples,
  min_frac = 3,
  blank_as_group = FALSE,
  group_column = NULL
)

Value

A filtered tibble.

Arguments

data

A tidy tibble created by read_featuretable.

blank_samples

Defines the blanks. If blank_as_group = FALSE a character vector containing the names of the blank samples as in the Sample column of data. If blank_as_group = TRUE the name(s) of the group(s) that define blanks, as in the Group column of data. The latter can only be used if sample metadata is provided.

min_frac

A numeric defining how many times higher the maximum intensity in samples must be in relation to blanks.

blank_as_group

A logical indicating if blank_samples are the names of samples or group(s).

group_column

Only relevant if blank_as_group = TRUE. Which column should be used for grouping blank and non-blank samples? Usually group_column = Group. Uses args_data_masking.

Examples

Run this code
# Example 1: Define blanks by sample name
toy_metaboscape %>%
  filter_blank(blank_samples = c("Blank1", "Blank2"), blank_as_group = FALSE, min_frac = 3)

# Example 2: Define blanks by group name
# toy_metaboscape %>%
#  join_metadata(toy_metaboscape_metadata) %>%
#  filter_blank(blank_samples = "blank",
#               blank_as_group = TRUE,
#               min_frac = 3,
#               group_column = Group)

Run the code above in your browser using DataLab