You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have performed filterMz and subset the original MS2 spectra (derived from several files of MS2 run) based on the precursor Mz.
Then I did several processings including the removal of small peaks.
> sps_final_l_noNull[[1]]
MSn data (Spectra) with 1 spectra in a MsBackendMzR backend:
msLevel rtime scanIndex
<integer> <numeric> <integer>
1 2 195.912 2100
... 39 more variables/columns.
file(s):
ID_01.mzML
Lazy evaluation queue: 2 processing step(s)
Processing:
Filter: select spectra with a precursor m/z within [348.06886830525, 348.070260583508] [Thu Jun 3 15:23:47 2021]
Filter: select retention time [-202.776397705078..400.525695800781] on MS level(s) 2 [Thu Jun 3 15:23:47 2021]
Remove peaks based on their intensities and a user-provided function in spectra of MS level(s) 2. [Thu Jun 3 15:24:39 2021]
And then I match the spectra with hmdb/massbank, filtering by score > 0.7.
It results in a list of annotated spectra objects.
Now I want to merge the list of spectra back together as a single spectra object and export them as a data frame.
Error by running concatenateSpectra
# `sps_final_l_noNull` is a list of spectra objects that were matched with massbank or hmdb spectra.
sps_final <- NULL
for (i in (1:length(sps_final_l_noNull))) {
print(i)
if (i == 1) {
sps_final <- sps_final_l_noNull[[i]]
}
else {
sps_final <- concatenateSpectra(sps_final,sps_final_l_noNull[[i]])
}
}
Here it is the error message:
Error in .concatenate_spectra(unlist(unname(list(unname(x), ...)))) : Can not concatenate 'Spectra' objects with non-empty processing queue. Consider calling 'applyProcessing' before.
Then I try to test the suggestion by applyProcessing to the object:
[1] 2
Error in applyProcessing(sps_final_l_noNull[[1]]) : MsBackendMzR is read-only. 'applyProcessing' works only with backends that support writing data.
Could you help me figure out what is going wrong?
Thanks very much!
Best regards,
Minghao Gong
The text was updated successfully, but these errors were encountered:
Spectra that use a MsBackendMzR for data storage are considered read-only because they read the m/z and intensity data on demand from the mzML files (same as the on-disk mode we had in MSnbase, maybe also have a look here to understand the difference). All data subsetting and manipulation operation work on them but these operations are not directly applied to the data because we don't want to change the original data in the mzML files. All operations are thus cached in the lazy processing queue and applied to the data on demand (i.e. whenever you access mz or intensity values with intensity(), mz() or $intensity and $mz. Thus, if you use this backend you can also not use the applyProcessing function (because we can not (and don't want to) modify the data in the mzML file).
The solution to this would be to switch to an in-memory backend which causes the data from the mzML file to be loaded into memory. In that case you can apply any processing steps. This can be done with sps <- setBackend(sps, MsBackendDataFrame()). In your case the following should work:
Note that you could switch backends also earlier - having the data in memory (as with the MsBackendDataFrame) can speed-up some operations. The advantage of the MsBackendMzR is mostly to keep the memory footprint low and hence allowing also to analyze very big data sets on "conventional" computer infrastructure.
I am trying to merge spectra objects based on the function
concatenateSpectra
you used in this session: https://bioconductor.org/packages/devel/bioc/vignettes/Spectra/inst/doc/Spectra.html#33_Filtering,_subsetting_and_mergingBackground
filterMz
and subset the original MS2 spectra (derived from several files of MS2 run) based on the precursor Mz.Error by running
concatenateSpectra
applyProcessing
to the object:Could you help me figure out what is going wrong?
Thanks very much!
Best regards,
Minghao Gong
The text was updated successfully, but these errors were encountered: