get_spectra_names: Extract spectra names and check for uniqueness

View source: R/get_spectra_names.R

get_spectra_namesR Documentation

Extract spectra names and check for uniqueness

Description

Given the list of raw spectra, get_spectra_names() extracts the spectra names using the file metadata, and warns if the associated sanitized names are not unique.

Usage

get_spectra_names(spectra_list)

Arguments

spectra_list

A list of MALDIquant::MassSpectrum objects.

Value

A tibble with four columns

  • sanitized_name: spectra names based on fullName where dots and dashes are converted to underscores

  • name: spectra name using the name label in the spectra metadata

  • fullName: spectra full name using the fullName label in the spectra metadata

  • file: the path to the raw spectra data

Examples

# Get an example directory of six Bruker MALDI Biotyper spectra
directory_biotyper_spectra <- system.file(
  "toy-species-spectra",
  package = "maldipickr"
)
# Import the six spectra
spectra_list <- import_biotyper_spectra(directory_biotyper_spectra)
# Extract the names
get_spectra_names(spectra_list)

# Artificially create duplicated entries to show the warning
get_spectra_names(spectra_list[c(1,1)])

maldipickr documentation built on Sept. 13, 2024, 1:12 a.m.