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
Concatenating spectra is straightforward using c. However, I noticed some odd behaviour when concatenating repeatedly.
Example: out is a list of 3 Spectra. Processing has been applied.
head(out)
[[1]]
MSn data (Spectra) with 1 spectra in a MsBackendDataFrame backend:
msLevel rtime scanIndex
<integer> <numeric> <integer>
1 1 274.117 144
... 110 more variables/columns.
Processing:
Switch backend from MsBackendMzR to MsBackendDataFrame [Mon Apr 12 16:26:30 2021]
Filter: select retention time [273.804252..286.451748] on MS level(s) 1 2 [Tue Apr 13 10:20:51 2021]
Filter: removed empty spectra. [Tue Apr 13 10:20:51 2021]
...8 more processings. Use 'processingLog' to list all.
[[2]]
MSn data (Spectra) with 1 spectra in a MsBackendDataFrame backend:
msLevel rtime scanIndex
<integer> <numeric> <integer>
1 1 200.403 1
... 117 more variables/columns.
Processing:
Switch backend from MsBackendMzR to MsBackendDataFrame [Mon Apr 12 16:26:30 2021]
Filter: select retention time [197.1202026..209.1037974] on MS level(s) 1 2 [Tue Apr 13 10:20:53 2021]
Filter: removed empty spectra. [Tue Apr 13 10:20:53 2021]
...10 more processings. Use 'processingLog' to list all.
[[3]]
MSn data (Spectra) with 1 spectra in a MsBackendDataFrame backend:
msLevel rtime scanIndex
<integer> <numeric> <integer>
1 1 231.774 62
... 120 more variables/columns.
Processing:
Switch backend from MsBackendMzR to MsBackendDataFrame [Mon Apr 12 16:26:30 2021]
Filter: select retention time [231.51235702061..242.71660942061] on MS level(s) 1 2 [Tue Apr 13 10:21:02 2021]
Filter: removed empty spectra. [Tue Apr 13 10:21:02 2021]
...10 more processings. Use 'processingLog' to list all.
Now the following doesn't work, and the error is quite obtuse.
Reduce(c, out[c(1,2,3)])
Error in length(xi) <- max_len : cannot set length of non-(vector or list)
Can you eventually try to use concatenateSpectra instead of c? concatenateSpectra(out) should work - or alternatively do.call("c", out)? It might not be related, but I noticed that c fails if spectra have names.
Actually, I've never heard of Reduce, so do.call is what I usually use. The concatenateSpectra is in the devel version - it does the same than c, but it does not break when the provided list of Spectra has names.
Concatenating spectra is straightforward using
c
. However, I noticed some odd behaviour when concatenating repeatedly.Example:
out
is a list of 3 Spectra. Processing has been applied.Now the following doesn't work, and the error is quite obtuse.
Error in length(xi) <- max_len : cannot set length of non-(vector or list)
However, the following all work (!)
e.g.:
Thoughts?
The text was updated successfully, but these errors were encountered: