Skip to contents

This function imports spectra from a file (.mgf or .sqlite)

Usage

import_spectra(
  file,
  cutoff = 0,
  dalton = 0.01,
  polarity = NA,
  ppm = 10,
  sanitize = TRUE
)

Arguments

file

File path of the spectrum file to be imported

cutoff

Absolute minimal intensity

dalton

Dalton tolerance

polarity

Polarity

ppm

PPM tolerance

sanitize

Flag indicating whether to sanitize. Default TRUE

Value

Spectra object containing the imported spectra

Examples

get_file(
  url = get_default_paths()$urls$examples$spectra_mini,
  export = get_default_paths()$data$source$spectra
)
#> Directory data/source created.
#> [1] "data/source/example_spectra.mgf"
import_spectra(file = get_default_paths()$data$source$spectra)
#> 2024-12-18 14:28:23 Applying sanitization of the spectra 
#> Filtering MS2 only
#> MSn data (Spectra) with 20 spectra in a MsBackendMemory backend:
#>       msLevel     rtime scanIndex
#>     <integer> <numeric> <integer>
#> 1           2        NA        NA
#> 2           2        NA        NA
#> 3           2        NA        NA
#> 4           2        NA        NA
#> 5           2        NA        NA
#> ...       ...       ...       ...
#> 16          2        NA        NA
#> 17          2        NA        NA
#> 18          2        NA        NA
#> 19          2        NA        NA
#> 20          2        NA        NA
#>  ... 17 more variables/columns.
#> Lazy evaluation queue: 5 processing step(s)
#> Processing:
#>  Filter: select MS level(s) 2 [Wed Dec 18 14:28:23 2024]
#>  For groups of peaks with similar m/z keep the one with the highest intensity. [Wed Dec 18 14:28:23 2024]
#>  Remove fast fourier artefacts. [Wed Dec 18 14:28:23 2024]
#>  ...3 more processings. Use 'processingLog' to list all. 
import_spectra(
  file = get_default_paths()$data$source$spectra,
  sanitize = FALSE
)
#> MSn data (Spectra) with 20 spectra in a MsBackendMemory backend:
#>       msLevel     rtime scanIndex
#>     <integer> <numeric> <integer>
#> 1           2        NA        NA
#> 2           2        NA        NA
#> 3           2        NA        NA
#> 4           2        NA        NA
#> 5           2        NA        NA
#> ...       ...       ...       ...
#> 16          2        NA        NA
#> 17          2        NA        NA
#> 18          2        NA        NA
#> 19          2        NA        NA
#> 20          2        NA        NA
#>  ... 17 more variables/columns.