Как определить вывод для отображения на экране блестящего приложения? - PullRequest
0 голосов
/ 01 июля 2019

Я разрабатываю блестящее приложение для прогнозирования субклеточной локализации белков таким образом, что последовательность fastta будет входить и будет доступно 3 варианта функций (AAC, DC, PseAAC).Пользователь должен выбрать любой из них, и когда пользователь выбирает объект, соответствующий сценарий R для объекта будет запущен на заднем конце, и субклеточное местоположение будет предсказано и должно быть напечатано в результате на блестящем экране приложения.

Я пробовал много вариантов вывода, включая verbatimTextOutput, renderPrint, textOutput и т. Д., Но не получил ожидаемых результатов

 library(shiny)
 library(protr)
 ui <- fluidPage(
 titlePanel("SCL"),
 sidebarLayout(
 sidebarPanel(
 fileInput("file", "Choose FASTA File",
 accept = c("text/fasta",".fasta"), multiple = TRUE, buttonLabel = 
"Browse..."),
#selectInput("file_choice", "choose feature to calculate", choices = 
c("AAC" = "PredA.r", "DC" = "PredD.r", "PseAAC" = "PredP.r")),
h5("use case - button based navigation"),
#actionButton("bell", "run selected file", class = "btn action-button", 
onclick = "window.open$('file_choice').val())")),
actionButton("AAC", "runAAC"), verbatimTextOutput("Finished_AAC"),
br(),
actionButton("DC", "runDC"),
br(),
actionButton("PseAAC", "runPseAAC")

),
mainPanel(
h2("Results")) #verbatimTextOutput("Location"))
#textOutput("DC")
#textOutput("PseAAC"))

)
)

  server <- function(input, output, session)


 #FormulaText <- reactive({paste("Subcellular Location", input$filefasta
 #output$location <- renderText({FormulaText

 #output$file_choice <- renderText(paste("You have selected
 #output$location <- renderText(paste("subcellular location is"

{
#source(file = "C:/Users/BioInto/Desktop/PredA.r", args[1], local = TRUE)
aac = reactiveValues(aac = FALSE)
dc = reactiveValues(dc = FALSE)
pseaac = reactiveValues(pseaac = FALSE)


observeEvent({input$AAC(output$aa <- isolate(system(paste("\"C:/Program 
Files/R/R-3.4.4/bin/RScript.exe\"", "C:/Users/BioInto/Desktop/PredA.r", 
"C:/Users/BioInto/Desktop/4W/Pred/seq.fasta"))))})
output$AAC <- renderText({paste("Running finished")
})
output$AAC <- renderPrint({output$aa()})

#Text <- reactive({quote(input$AAC, pa, quote = TRUE)})
output$file <- renderText({paste("you have uploaded file")})
#output$Location <- renderPrint({Location})
#output$Location <- renderPrint({abc()
#})
#print(as.factor(Location))


}



shinyApp (ui, server)

Ниже приведен файл PredA.r

library("protr")
library("e1071")
library("caret")
args = commandArgs(trailingOnly = TRUE)
seq = readFASTA(args[1]) [[1]]
#seq = readFASTA("C:/Users/Biointo/Desktop/4W/pred/seq.fasta") [[1]]
length(seq)
seq = seq[(sapply(seq, protcheck))]
length(seq)
aac = extractAAC(seq)
write.table(aac , file = "C:/Users/Biointo/Desktop/4W/pred/20", append = 
TRUE, eol = "\n",  col.names = FALSE)
#write.table(aac , args[2], append = TRUE, eol = "\n",  col.names = 
FALSE)
bf <- read.table("C:/Users/Biointo/Desktop/4W/pred/20")
nbf <- data.frame(t(bf))
rownames(nbf) <- NULL
colnames(nbf) <- NULL
write.table(nbf, file = "C:/Users/Biointo/Desktop/4W/pred/mn20" , 
col.names = F)
#write.table(args[3], col.names = F)
mn <- read.table("C:/Users/Biointo/Desktop/4W/pred/mn20" , header = T)
load("C:/Users/Biointo/Desktop/4W/pred/AACT.rda")
aactune$best.model
#aacb <- predict(aactune , mn)
pa <- (predict(aactune$best.model, mn))
pa
write.table(pa, file = "C:/Users/Biointo/Desktop/4W/pred/loc.txt", sep = 
"") 
read.table(file = "C:/Users/Biointo/Desktop/4W/pred/loc.txt", sep = "") 
#library(shiny)
#output$Location <- renderText({as.factor(pa)})

Я хочу, чтобы прогнозируемое местоположение (вывод текста) было вставлено на блестящий экран приложения

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...