MassBank / RMassBank

Playground for experiments on the official http://bioconductor.org/packages/devel/bioc/html/RMassBank.html
Other
12 stars 15 forks source link

Building vignettes from github fail #92

Closed stanstrup closed 9 years ago

stanstrup commented 9 years ago
devtools:::install_github("meowcat/RMassBank",build_vignettes=T)
..........
..........
..........
..........
mbWorkflow: Step 1. Gather info from CTS
mbWorkflow: Step 2. Export infolist (if required)
No new data added.
mbWorkflow: Step 3. Data reformatting
mbWorkflow: Step 4. Spectra compilation
Compiling: Glucolesquerellin_2184_1.mzData_2184
mbWorkflow: Step 5. Flattening records
mbWorkflow: Step 6. Generate molfiles
mbWorkflow: Step 7. Generate subdirs and export
Warning in dir.create(paste(getOption("RMassBank")$annotations$entry_prefix,  :
  'XX/moldata' already exists
Warning in dir.create(paste(getOption("RMassBank")$annotations$entry_prefix,  :
  'XX/recdata' already exists
mbWorkflow: Step 8. Create list.tsv
Warning in findRt(cpdID) : NAs introduced by coercion

Error: processing vignette 'RMassBankXCMS.Rnw' failed with diagnostics:
 chunk 10 
Error in if (is.na(rt)) return(list(RT = NA)) else return(list(RT = rt)) : 
  argument is of length zero
Execution halted
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] devtools_1.6.1 httr_0.5       RCurl_1.95-4.3 stringr_0.6.2  tools_3.1.2   

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.

stanstrup commented 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")
schymane commented 9 years ago

@ermueller - the error is in msmsPeaklist, can you look into this?

stanstrup commented 9 years ago

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)

stanstrup commented 9 years ago

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"                                                                                
stanstrup commented 9 years ago

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?

stanstrup commented 9 years ago

Or even better:

splitfn <- strsplit(basename(w@files), "_")
      cpdIDs <- sapply(splitfn, function(splitted) {
        as.numeric(return(splitted[2]))
      })
ermueller commented 9 years ago

Whoops, that somehow slipped by me. I'm fixing it. That code snippet should work, thanks for that :)