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
)
#> 2024-09-18 14:32:59 Directory data/source created. 
#> [1] "data/source/example_spectra.mgf"
import_spectra(file = get_default_paths()$data$source$spectra)
#> 2024-09-18 14:33:00 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 Sep 18 14:33:00 2024]
#>  For groups of peaks with similar m/z keep the one with the highest intensity. [Wed Sep 18 14:33:00 2024]
#>  Remove fast fourier artefacts. [Wed Sep 18 14:33:00 2024]
#>  ...4 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.