rformassspectrometry / Spectra

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

Version 1.8.x Spectra objects not readable by earlier package versions? #284

Closed AharoniLab closed 1 year ago

AharoniLab commented 1 year ago

Hi,

I just noticed that a spectra objects created by version 1.8.2 are not readable by an earlier version of the package (1.6.0 running on R 4.2.1): object length always equals one and class methods return this error:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘spectraData’ for signature ‘"MsBackendMemory"’

Is this issue documented somewhere?

Thanks,

jorainer commented 1 year ago

You are right - Spectra objects created by newer package versions use the MsBackendMemory backend by default. This backend was introduced with Spectra version 1.7.4 (see NEWS.md).

What you could do as a workaround: load your Spectra in the newer R/Spectra version and call:

sps <- setBackend(sps, MsBackendDataFrame())

with that you change the backend to the older MsBackendDataFrame that is also supported by older R/Spectra versions. So, if you save that Spectra object again it should also work with version 1.6.0

AharoniLab commented 1 year ago

Perfect. Thanks!