I am trying to use Shiny to build an app with a function that output a pdf file. Specifically, the function I am trying to use is the msaPrettyPrint
function from the msa
package. It uses the texi2pdf
function from the tools
package to generate a pdf file.
For example, if you run the following code, you will generate a pdf called "myFirstAlignment.pdf" with an amino acid sequence alignment in your working directory.
# source("http://www.bioconductor.org/biocLite.R")
# biocLite("msa")
library(msa)
mySequenceFile <- system.file("examples", "exampleAA.fasta", package="msa")
mySequences <- readAAStringSet(mySequenceFile)
myFirstAlignment <- msa(mySequences)
msaPrettyPrint(myFirstAlignment, output="pdf", showNames="left",showLogo="top",consensusColor="BlueRed", logoColors="accessible area", askForOverwrite=FALSE)
I was wondering if there is a way to make the following code works? I think the problem might be because the output is already a pdf file. I want to see the pdf output on screen if possible. If not possible to see it on screen, where is the pdf file and if I can download it?
library(shiny)
runApp(list(
#Load the exmaple from the msa package.
mySequenceFile <- system.file("examples", "exampleAA.fasta", package="msa"),
mySequences <- readAAStringSet(mySequenceFile),
myFirstAlignment <- msa(mySequences),
# A simple shiny app.
# Is it possible to see the generated pdf file on screen?
ui = fluidPage(plotOutput('plot')),
server = function(input, output) {
output$plot <- renderPlot(msaPrettyPrint(myFirstAlignment, output="pdf", showNames="left",showLogo="top",consensusColor="BlueRed", logoColors="accessible area", askForOverwrite=FALSE))
}
))
One thing to mention is that this code needs LaTeX to work. You would need LaTeX to run the example. Thanks a lot!