Closed ococrook closed 3 years ago
What happens when you use
PhosB_raw <- Spectra(fl, source = MsBackendMzR(), backend = MsBackendDataFrame())
With source
you would then specify that you use the mzR backend for import and then it should change (after import) to the MsBackendDataFrame()
. I know it's a little confusing...
It looks the same to me
> fl <- "data/191115_PhosB_HDMSe_0sec_01_vial01.mzML"
> PhosB_raw <- Spectra(fl, source = MsBackendMzR(), backend = MsBackendDataFrame())
> PhosB_raw
MSn data (Spectra) with 362200 spectra in a MsBackendMzR backend:
msLevel rtime scanIndex
<integer> <numeric> <integer>
1 1 1.422 1
2 1 1.422 2
3 1 1.422 3
4 1 1.422 4
5 1 1.422 5
... ... ... ...
362196 2 659.956 362196
362197 2 659.956 362197
362198 2 659.956 362198
362199 2 659.956 362199
362200 2 659.956 362200
... 33 more variables/columns.
file(s):
191115_PhosB_HDMSe_0sec_01_vial01.mzML
Now, that's a little tricky - I had to check the code to understand what's going on. The problem is that MsBackendMzR
inherits from MsBackendDataFrame
. Inside the Spectra
constructor function the data is read using the source = MsBackendMzR()
and then it checks if the backend is the same class than the source. If they are different setBackend
is called to change the backend.
For now I would suggest to call the setBackend
after reading the data. I will have to investigate a little how to change this without breaking anything.
Thanks for the investigating! I'll keep to my original solution then
I made already a PR (https://github.com/rformassspectrometry/Spectra/pull/144) which fixes this.
Hi - me again...
I'm confused by what "backend = " is doing.
The following code chunk doesn't seem to do what I expected. Specifying 'backend = MsBackendDataFrame()' seems to set MsBackendMzR. Though it happily changes the backend using setBackend.
MSn data (Spectra) with 362200 spectra in a MsBackendMzR backend: msLevel rtime scanIndex