rformassspectrometry / MsIO

Serializing/importing mass spectrometry data objects eventually using language-agnostic formats.
https://rformassspectrometry.github.io/MsIO
2 stars 0 forks source link

Addition of MsBackendMzr saving and loading. Discussion needed #4

Closed philouail closed 3 months ago

philouail commented 4 months ago

Alright so here is the code that allows to save and load an MsBakendMzR object. This refer to #2

Few topics of discussion:

Once this is pushed I will continue to move and change the code for saving/loading a Spectra object,...

philouail commented 4 months ago

So, unfortunately I tried the alabaster saveObject() and loadObject() for the spectraData() and it seems to not work:

>library(xcms)
>library(alabaster)
>library(Spectra)
> xmse <- loadXcmsData()
> df <- spectraData(spectra(xmse))
> tmp <- tempfile()
> saveObject(df, tmp)
> list.files(tmp)
[1] "basic_columns.h5" "OBJECT"          
> validateObject(tmp)
> loadObject(tmp)
Error in info[["$schema"]] : subscript out of bounds

or

> b <- MsBackendMzR()
> b
MsBackendMzR with 0 spectra
> spectraData(b)
DataFrame with 0 rows and 19 columns
> df <- spectraData(b)
> tmp <- tempfile()
> saveObject(df, tmp)
> list.files(tmp)
[1] "basic_columns.h5" "OBJECT"           "other_columns"   
> validateObject(tmp)
> loadObject(tmp)
Error in info[["$schema"]] : subscript out of bounds

I will look more into it and maybe create and issue.

On the brighter side they have a package to serialize the SummarizedExperiment object: https://github.com/ArtifactDB/alabaster.se

jorainer commented 3 months ago

Regarding the alabastter issues/errors above: you should use readObject() instead of loadObject() :)

philouail commented 3 months ago

Regarding the alabastter issues/errors above: you should use readObject() instead of loadObject() :)

Well i should have figured that out, thaanks :)

philouail commented 3 months ago

Hi @jorainer, i've updated to fix the dependency. Can you check again and merge if it's all good ? also I cannot see the comments you made during our meeting but i think i fixed everything, do tell me if i am missing something.