Learn R Programming

metamorphr (version 0.2.0)

filter_mz: Filter Features based on their mass-to-charge ratios

Description

Facilitates filtering by given mass-to-charge ratios (m/z) with a defined tolerance. Can also be used to filter based on exact mass.

Usage

filter_mz(data, m_z_col, masses, tolerance = 5, tolerance_type = "ppm")

Value

A filtered tibble.

Arguments

data

A tidy tibble created by read_featuretable.

m_z_col

Which column holds the precursor m/z (or exact mass)? Uses args_data_masking.

masses

The mass(es) to filter by.

tolerance

A numeric. The tolerance to apply to the masses Either an absolute value in Da (if tolerance_type = "absolute") or in ppm (if tolerance_type = "ppm").

tolerance_type

Either "absolute" or "ppm". Should the tolerance be an absolute value or in ppm?

Examples

Run this code
# Use a tolerance of plus or minus 5 ppm
toy_metaboscape %>%
  filter_mz(m_z_col = `m/z`, 162.1132, tolerance = 5, tolerance_type = "ppm")

# Use a tolerance of plus or minus 0.005 Da
toy_metaboscape %>%
  filter_mz(m_z_col = `m/z`, 162.1132, tolerance = 0.005, tolerance_type = "absolute")

Run the code above in your browser using DataLab