# Get an example directory of six Bruker MALDI Biotyper spectra
directory_biotyper_spectra <- system.file(
"toy-species-spectra",
package = "maldipickr"
)
# Import only the first two spectra
spectra_list <- import_biotyper_spectra(directory_biotyper_spectra)[1:2]
# Introduce artificially an empty raw spectra
spectra_list <- c(spectra_list, MALDIquant::createMassSpectrum(0, 0))
# Empty spectra are detected by `check_spectra()`
# and can be removed by `remove_spectra()`
spectra_list %>%
remove_spectra(to_remove = check_spectra(.))
# Get an example processed spectra
processed_path <- system.file(
"three_processed_spectra_with_one_peakless.RDS",
package = "maldipickr")
processed <- readRDS(processed_path) %>% list()
# Remove a specific spectra
remove_spectra(processed, "empty_H12")
Run the code above in your browser using DataLab