Creating a vignette that works without unduly confusing the end user is sometimes not that simple. Often times a package author will supply data with the package to use for examples, but accessing those data is something the end user usually isn't going to do, and showing the code used to access the data can be unnecessarily confusing. The usual paradigm in that instance is to have example code that is meant to show what one should do, and then hidden functional code that reads in the example data and generates the output. That's how RiboProfiling
works. If you look at the script for the vignette, you will see this sort of thing:
## ----Import_library_noEcho,echo=TRUE,eval=FALSE-------------------------------
# library(RiboProfiling)
# listInputBam <- c(
# BamFile("http://genomique.info/data/public/RiboProfiling/ctrl.bam"),
# BamFile("http://genomique.info/data/public/RiboProfiling/nutlin2h.bam")
# )
# covData <- riboSeqFromBAM(listInputBam, genomeName="hg19")
## ----Import_library,echo=FALSE------------------------------------------------
suppressWarnings(suppressMessages(library(RiboProfiling)))
## ----riboSeqfromBam,echo=FALSE,eval=TRUE,dev=c("png"),fig.width=7-------------
myFileCtrl <- system.file("extdata", "ctrl_sample.bam", package="RiboProfiling")
myFileNutlin2h <- system.file("extdata", "nutlin2h_sample.bam", package="RiboProfiling")
listeInputBam <- c(myFileCtrl, myFileNutlin2h)
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene::TxDb.Hsapiens.UCSC.hg19.knownGene
covData <-
suppressMessages(
suppressWarnings(
riboSeqFromBAM(
listeInputBam,
txdb=txdb,
listShiftValue=c(-14, -14)
)
)
)
The first chunk (under Import_library_noEcho) is what you see in the vignette, but that code isn't evaluated! Note that the header says echo = TRUE, eval = FALSE, so it's echoed but not evaluated. Instead the next two chunks are evaluated but the code isn't shown (echo = FALSE, eval = TRUE). The first chunk just loads the package, and the second one provides paths to BAM files that come with the package and then runs riboSeqFromBAM
.
If you are trying to step through the code, you should use the evaluated code in the vignette rather than the unevaluated example code. Does that make sense?
Thanks I understand what you're saying.
Perhaps the best bet is just to post in more detail about where I'm running into errors, but I believe the problem is that a piece of my data just has some kind of formatting difference from what the package is expecting. I was hoping to use the example data as a reference to troubleshoot by myself, but it's not available.
Since the package was just updated this year, I was hoping the package author would be able to fix the broken link, I'd be able to get the data and solve my own problem!
In the meantime, I will put together my code to actually address the errors I'm getting. Thanks again for your assistance.
I think you might be misunderstanding what I said. The example data are available, just not in the way that's shown in the vignette. If I run this code
I get
Which is what I believe you are getting. But you can do this instead: