either return a valid Spectra object with 0 spectra and potentially warn that the file list was empty
or error because the file list was empty.
Note that no-input MsBackendMzR (and also MsBackendMgf) objects seem to be invalid anyway. I don't know if this is intended, so this would influence what behaviour we expect from a no-file MzBackendMzR.
sp <- Spectra(source = MsBackendMzR())
sp2 <- setBackend(sp, MsBackendMemory())
# Error in validObject(object) :
# invalid class “MsBackendMemory” object: The following columns have a wrong data type: mz, intensity.
# The expected data type(s) is/are: NumericList, NumericList
(Discovered accidentally because I did not have package "msdata" installed when building the Spectra.Rmd vignette.)
When constructing
MzBackendMzR
with an empty file list, the returned error message is misleading:This lets me think that I should be using
Spectra(files = fls, ...)
instead, which in fact does not error:However
files
is not the right argument, in factsp <- Spectra(files = fls, source = MsBackendMzR())
completely ignoresfls
:Passing
fls
as anonymous parameter works as expected:Expected behaviour:
fls <- c(); sp <- Spectra(fls, source = MsBackendMzR())
shouldSpectra
object with 0 spectra and potentially warn that the file list was emptyNote that no-input
MsBackendMzR
(and alsoMsBackendMgf
) objects seem to be invalid anyway. I don't know if this is intended, so this would influence what behaviour we expect from a no-fileMzBackendMzR
.(Discovered accidentally because I did not have package "msdata" installed when building the
Spectra.Rmd
vignette.)