rformassspectrometry / Spectra

Low level infrastructure to handle MS spectra
https://rformassspectrometry.github.io/Spectra/
34 stars 24 forks source link

feat: add spectraVariableMapping generic #233

Closed jorainer closed 2 years ago

jorainer commented 2 years ago

This PR adds a generic for the spectraVariableMapping method. Backend instances are thus expected to implement that method (if needed). This should avoid overriding the different spectraVariableMapping function that are already implemented in the MsBackendMgf, MsBackendMassbank and MsBackendMsp packages.

Usage is supposed to be changed in these packages to:

be <- MsBackendMsp()
map <- spectraVariableMapping(be)

## Or to use different file format flavors
map <- spectraVariableMapping(be, "MoNa")
jorainer commented 2 years ago

That's an potential reference implementation in the MsBackendMsp package

That's how it's intended to be used https://github.com/rformassspectrometry/MsBackendMsp/blob/jomain/R/MsBackendMsp.R#L79