#' @title Cleanup spectra
#'
#' @description This function cleans up spectra (keeps only merged MS2)
#'
#' @param spectra Spectra object to clean
#'
#' @return Spectra object containing the imported spectra
#'
#' @export
#'
#' @examples NULL
cleanup_spectra <- function(spectra) {
spectra <- spectra |>
Spectra::reduceSpectra() |>
Spectra::applyProcessing()
if ("MSLEVEL" %in% colnames(spectra@backend@spectraData)) {
spectra <- spectra[spectra$MSLEVEL == 2]
}
if ("FEATURE_ID" %in% colnames(spectra@backend@spectraData)) {
message("Combining spectra in case...")
spectra <- spectra |>
Spectra::combineSpectra(f = spectra$FEATURE_ID)
}
spectra <- spectra |>
Spectra::filterEmptySpectra()
return(spectra)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.