Closed stanstrup closed 9 years ago
The errors occurs in the last command of the vignette:
> msmsPeaklist <- msmsWorkflow(msmsPeaklist, steps=1:8,
+ mode="mH", readMethod="peaklist")
Error in if (is.na(rt)) return(list(RT = NA)) else return(list(RT = rt)) :
argument is of length zero
In addition: Warning message:
In findRt(cpdID) : NAs introduced by coercion
> traceback()
3: findRt(cpdID)
2: addPeaksManually(w, cpdIDs[i], peaklist, mode = mode)
1: msmsWorkflow(msmsPeaklist, steps = 1:8, mode = "mH", readMethod = "peaklist")
@ermueller - the error is in msmsPeaklist, can you look into this?
I tracked down the problem I think.
I believe that in msmsWorkflow:
cpdIDs <- sapply(splitfn, function(splitted) {
as.numeric(return(splitted[2]))
})
Should be:
cpdIDs <- sapply(splitfn, function(splitted) {
as.numeric(return(splitted[3]))
})
(2-->3)
Ah it is not so simple. I have found the underlying problem.
> w@files
[1] "/home/jan/R/x86_64-pc-linux-gnu-library/3.1/RMassBankData/spectra.Glucolesquerellin/Glucolesquerellin_2184_1.csv"
so:
> strsplit(w@files, "_")
[[1]]
[1] "/home/jan/R/x86"
[2] "64-pc-linux-gnu-library/3.1/RMassBankData/spectra.Glucolesquerellin/Glucolesquerellin"
[3] "2184"
[4] "1.csv"
Perhaps you can do this instead:
sapply(splitfn, function(splitted) {
as.numeric(return(splitted[length(splitted)-1]))
})
btw.: shouldn't the as.numeric
be inside the return
?
Or even better:
splitfn <- strsplit(basename(w@files), "_")
cpdIDs <- sapply(splitfn, function(splitted) {
as.numeric(return(splitted[2]))
})
Whoops, that somehow slipped by me. I'm fixing it. That code snippet should work, thanks for that :)
Same error if I build from sneumann/RMassBank.
install_url('http://bioconductor.org/packages/3.0/bioc/src/contrib/RMassBank_1.8.0.tar.gz',build_vignettes=T)
works.