View source: R/53_ms2_spectra_matching_scores.R
match_ms2_fragments | R Documentation |
Matches MS2 fragment ions between an experimental spectrum and a library spectrum.
match_ms2_fragments(
experimental.spectrum,
library.spectrum,
ms2.match.ppm = 30,
mz.ppm.thr = 400,
direction = c("reverse", "forward"),
remove.noise = TRUE
)
experimental.spectrum |
A data frame with 'mz' and 'intensity' columns representing the experimental MS2 spectrum. |
library.spectrum |
A data frame with 'mz' and 'intensity' columns representing the reference MS2 spectrum. |
ms2.match.ppm |
Numeric, mass tolerance in parts per million (ppm) for fragment matching. Default is 30 ppm. |
mz.ppm.thr |
Numeric, minimum m/z threshold for ppm-based error calculation. Default is 400. |
direction |
Character, either '"reverse"' (library to experimental matching) or '"forward"' (experimental to library matching). Default is '"reverse"'. |
remove.noise |
Logical, whether to remove low-intensity fragment ions before matching. Default is 'TRUE'. |
This function aligns the fragment ions from an experimental MS2 spectrum with those from a library spectrum based on m/z similarity within a given ppm tolerance.
- If 'direction = "reverse"', the function looks for matches of each **library fragment ion** in the **experimental spectrum**. - If 'direction = "forward"', the function looks for matches of each **experimental fragment ion** in the **library spectrum**.
If multiple matches are found for a given fragment, the most intense one is selected.
A data frame containing the matched fragment ions with the following columns:
Lib.index |
Index of the fragment in the library spectrum. |
Exp.index |
Index of the fragment in the experimental spectrum. |
Lib.mz |
m/z value of the library fragment ion. |
Lib.intensity |
Intensity of the library fragment ion. |
Exp.mz |
m/z value of the experimental fragment ion. |
Exp.intensity |
Intensity of the experimental fragment ion. |
Unmatched peaks in either spectrum are included with missing values ('NA') in the corresponding columns.
Xiaotao Shen xiaotao.shen@outlook.com
# Example data for experimental and library MS2 spectra
experimental.spectrum <- data.frame(mz = c(100.1, 150.2, 200.3), intensity = c(300, 500, 200))
library.spectrum <- data.frame(mz = c(100.09, 150.25, 210.4), intensity = c(250, 600, 150))
# Perform MS2 fragment matching
matched_fragments <- match_ms2_fragments(
experimental.spectrum = experimental.spectrum,
library.spectrum = library.spectrum,
ms2.match.ppm = 30,
direction = "reverse"
)
print(matched_fragments)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.