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_merging
Background
- 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:
length(sps_final_l_noNull[[1]]@processingQueue)
sps_final_l_noNull[[1]] <- applyProcessing(sps_final_l_noNull[[1]])
length(sps_rep@processingQueue)
- I got the following error:
[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
I am trying to merge spectra objects based on the function
concatenateSpectrayou used in this session: https://bioconductor.org/packages/devel/bioc/vignettes/Spectra/inst/doc/Spectra.html#33_Filtering,_subsetting_and_mergingBackground
filterMzand subset the original MS2 spectra (derived from several files of MS2 run) based on the precursor Mz.Error by running
concatenateSpectraapplyProcessingto the object:Could you help me figure out what is going wrong?
Thanks very much!
Best regards,
Minghao Gong