| cleanMGF | R Documentation |
For each MS2 spectrum, the precursor neutral mass is derived from
PEPMASS, CHARGE and the supplied adduct, candidate
parent formulae are enumerated with Rdisop, and fragment peaks that
can be explained as sub-formulae of the best candidate (the one explaining
the most peaks) are kept. Spectra without PEPMASS or without any
candidate formula are written back unchanged.
cleanMGF(
file,
out_file = NULL,
adduct = "[M+H]+",
charge = NULL,
mass_accuracy = 5,
elements = "CHNOPS",
max_candidates = 3,
intensity_cutoff = 0,
min_peaks = 2
)
file |
character. Path to an MGF file. |
out_file |
character. Output MGF path. Default NULL writes
|
adduct |
character. Single adduct name (see |
charge |
integer. Precursor charge state used when the |
mass_accuracy |
numeric. Mass accuracy in ppm for both precursor decomposition and fragment matching. Default 5. |
elements |
character. Elements allowed in precursor formula enumeration, e.g. "CHNOPS". Default "CHNOPS". |
max_candidates |
integer. Maximum number of precursor formula candidates to evaluate per spectrum. Default 3. |
intensity_cutoff |
numeric. Discard peaks below this absolute intensity before annotation. Default 0 (keep all). |
min_peaks |
integer. Drop spectra left with fewer than this many peaks after cleaning. Default 2. |
The cleaned file preserves the original header lines and peak
line formatting; the chosen parent formula is appended as a
FORMULA= header when a candidate is found.
Invisibly, a data.frame with one row per spectrum: title, pepmass, charge, chosen formula, peak counts before/after, kept fraction and status ("cleaned", "kept" = unchanged, or "dropped").
HRMF, getMSP
## Not run:
summary <- cleanMGF("ms2.mgf", adduct = "[M+H]+")
summary[, c("title", "formula", "n_before", "n_kept", "status")]
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.