library("tima")
annotate_masses()Annotate masses
Description
Mass-based MS1 annotation:
1. **Pairs in RT windows.** Group co-eluting features within `tolerance_rt` and orient every pair from the higher `m/z` peak (`feature_source`) to the lower `m/z` peak (`feature_target`) so mass differences (`delta_mz >= 0`) have a fixed direction. 2. **Adduct, cluster, and neutral-loss edges.** Match `delta_mz` against mode-specific adduct differences, solvent/salt clusters, and in-source neutral losses. Because pairs are oriented from heavier to lighter ions, a `-18.01 Da` difference below an `[M+H]+` parent attributes `[M-H2O+H]+` to the lighter product ion, whereas solvent clusters (`[M+H2O+H]+`) are only tested when enabled in `clusters_list`. 3. **Intensity co-variance edges.** Pairs Detected together across `>= 3` samples are tested for positive Pearson correlation (BH-adjusted `p < correlation_p_threshold`), reinforcing adduct support. 4. **Node hypotheses & library matching.** Combine graph-supported adducts, upstream pre-assigned adducts, and the baseline ion (`[M+H]+` or `[M-H]-`), then match implied neutral masses `M` against the structure library within `max(tolerance_ppm, tolerance_dalton)`. 5. **Formula & network consistency.** Drop neutral-loss structure matches whose molecular formula lacks the lost atoms (e.g. `[M-H3N+H]+` on a nitrogen-free structure), prune unsupported adduct hypotheses when a graph-supported alternative exists, and keep unmatched adduct hypotheses for downstream inspection.
Usage
annotate_masses(
features = get_params(step = "annotate_masses")\$files\$features\$prepared,
output_annotations = get_params(step =
"annotate_masses")\$files\$annotations\$prepared\$structural\$ms1,
output_edges = get_params(step =
"annotate_masses")\$files\$networks\$spectral\$edges\$raw\$ms1,
name_source = get_params(step = "annotate_masses")\$names\$source,
name_target = get_params(step = "annotate_masses")\$names\$target,
library = get_params(step = "annotate_masses")\$files\$libraries\$sop\$merged\$keys,
str_stereo = get_params(step =
"annotate_masses")\$files\$libraries\$sop\$merged\$structures\$stereo,
str_met = get_params(step =
"annotate_masses")\$files\$libraries\$sop\$merged\$structures\$metadata,
str_nam = NULL,
str_tax_cla = get_params(step =
"annotate_masses")\$files\$libraries\$sop\$merged\$structures\$taxonomies\$cla,
str_tax_npc = get_params(step =
"annotate_masses")\$files\$libraries\$sop\$merged\$structures\$taxonomies\$npc,
adducts_list = get_params(step = "annotate_masses")\$ms\$adducts,
clusters_list = get_params(step = "annotate_masses")\$ms\$clusters,
solvents_list = get_params(step = "annotate_masses")\$ms\$solvents,
neutral_losses_list = get_params(step = "annotate_masses")\$ms\$neutral_losses,
ms_mode = get_params(step = "annotate_masses")\$ms\$polarity,
tolerance_ppm = get_params(step = "annotate_masses")\$ms\$tolerances\$mass\$ppm\$ms1,
tolerance_dalton = get_params(step = "annotate_masses")\$ms\$tolerances\$mass\$dalton\$ms1,
tolerance_rt = get_params(step = "annotate_masses")\$ms\$tolerances\$rt\$adducts,
correlation_p_threshold = get_params(step =
"annotate_masses")\$ms\$tolerances\$correlation\$p_value
)
Arguments
features
|
Table containing your previous annotation to complement |
output_annotations
|
Output for mass based structural annotations |
output_edges
|
Output for mass based edges |
name_source
|
Name of the source features column |
name_target
|
Name of the target features column |
library
|
Library containing the keys |
str_stereo
|
File containing structures stereo |
str_met
|
File containing structures metadata |
str_nam
|
Optional file containing structures names |
str_tax_cla
|
File containing Classyfire taxonomy |
str_tax_npc
|
File containing NPClassifier taxonomy |
adducts_list
|
List of adducts to be used |
clusters_list
|
List of clusters to be used |
solvents_list
|
List of solvents to be used |
neutral_losses_list
|
List of neutral losses to be used |
ms_mode
|
Ionization mode. Must be ‘pos’ or ‘neg’ |
tolerance_ppm
|
Relative mass tolerance (ppm) to perform annotation. Should be <= 20 ppm. A match within either tolerance_ppm or tolerance_dalton is accepted, so the effective window is the larger of the two.
|
tolerance_dalton
|
Absolute mass tolerance (Da) to perform annotation. Acts as a floor for low masses: the default (0.0025 Da) equals 10 ppm at m/z 250, so it only widens the window below that. |
tolerance_rt
|
Tolerance to group adducts. Should be <= 0.05 minutes |
correlation_p_threshold
|
False discovery rate threshold for the Pearson correlation of feature intensities across samples (needs >= 3 samples where both features are detected). P-values of all pairs tested are Benjamini-Hochberg adjusted; positively correlated pairs with adjusted p < threshold are exported as covariance edges, and an adduct neighbor that co-varies counts twice in adduct_support. Pairs that fail the test are not rejected.
|
Value
Named character of paths to the annotations and edges files.
See Also
Other annotation: annotate_spectra(), filter_annotations(), weight_annotations(), write_mztab()