警告:cat 中的错误:R shiny webtool 中的 'cat' [没有可用的堆栈跟踪] 无法处理参数 1(类型 'list')
Warning: Error in cat: argument 1 (type 'list') cannot be handled by 'cat' [No stack trace available] in R shiny webtool
我正在为 R 函数开发 shiny webtool 以在 webtool 上生成索引结果。
我有 6 个 R 函数,我在 selectinput 小部件中创建了 6 个组合,其中每个组合都与一个 R 函数相关联。
6个R函数如下:
RSCU(文件){脚本},
cgr_res(文件){脚本},
zscore_cal(文件){脚本},
GC_Content7(文件){}和
extractmod(file){script} 所有这 5 个函数都有一个相同的参数,即输入文件作为所有五个 R 函数的相同输入参数
最后一个 6th R 函数的 R 函数具有 AMIP(file,n1,n2) 3 个输入参数,此处输入文件与其余 5 个相同,但 n1 和 n2 是不同的参数,
对于 n1 和 n2 参数,我创建了 numericalInput() 小部件。对于 GC_content7、RSCU、cgr_res 和 zscore_cal,webtool 工作正常,但对于其他两个函数,没有显示结果。
library("shinythemes")
library("shiny")
library("htmltools")
library("bsplus")
library("DT")
library("shinyalert")
library("shinyjs")
library("shinycssloaders")
library("dplyr")
library("data.table")
library("reshape2")
library("ggplot2")
library("plotly")
library("tools")
library("readxl")
library("writexl")
library("seqinr")
library("Biostrings")
library("BiocManager")
library("entropy")
library("protr")
source("GS_Source.R")
ui = fluidPage(
headerPanel(
h1(tags$strong("Welcome to Web based Tool for Computation of Genomic"),
style = "font-size: 20pt; line-height: 30pt; width = 100; color: #Red",
align = "center"),
windowTitle = "Home"),
sidebarLayout(
sidebarPanel(
style = "background-color: #E52B50;",
tags$style(type='text/css',
"label { font-size: 12px; }",
".selectize-input { font-size: 12pt; line-height: 12pt;},
.selectize-dropdown { font-size: 12pt; line-height: 12pt; }"),
fileInput('file', HTML('<p style="color:#4A2768; font-size: 12pt"> Choose file to upload the expression data </p>'),accept = c('text/csv','text/comma-separated-values',
'text/tab-separated-values','text/plain','.csv', '.tsv','.fasta')),
selectInput("Signatures", HTML('<p style="color:#4A27C5; font-size: 12pt"> Genome signature </p>'),
c("GC-content","RSCU","CGR","DI-nuculeotide odd Ratio","AAC","AMIP")),
numericInput("num1",label = "FROM",value = 2),
numericInput("num2", label = "TO", value = 3),
useShinyalert(),
actionButton("action", tags$b("Submit")), width = 3, style="color: #fff; background-color: #337ab7; border-color: #2e6da4"),
mainPanel(
verbatimTextOutput("res1"),
verbatimTextOutput("res2"),
plotOutput("res3"),
verbatimTextOutput("res4"),
verbatimTextOutput("res5"),
verbatimTextOutput("res6"),
)
)
)
server <- function(input, output, session) {
df <- eventReactive(input$action, {
my_func <- switch(input$Signatures,
"RSCU" = RSCU,
"CGR"=cgr_res,
"DI-nuculeotide odd Ratio"=zscore_cal,
"GC-content" = GC_content7,
"AAC"=extractAAC_mod,
)
my_func(input$file$datapath)
})
df1 <- eventReactive(input$actions, {
my_func1 <- switch(input$signatures,
"AMIP"=AMIP,
)
my_func1(input$file$datapath,input$num1,input$num2)
})
output$res1 <- renderPrint({
req(input$Signatures)
if (input$Signatures=="GC-content") {
df()
}
})
output$res2 <- renderPrint({
req(input$Signatures)
if (input$Signatures=="RSCU") {
df()
}
})
output$res3 <- renderPlot({
req(input$Signatures)
if (input$Signatures=="CGR") {
df()
}
})
output$res4 <- renderPrint({
req(input$Signatures)
if (input$Signatures=="DI-nuculeotide odd Ratio") {
df()
}
})
output$res5 <- renderPrint({
req(input$Signatures)
if (input$Signatures=="AAC") {
df()
}
})
output$res6 <- renderPrint({
req(input$signatures)
if(input$signatures=="AMIP"){
df1()
}
})
observeEvent(input$action, {
shinyalert(title = "Please wait for the results...", type = "success")
})
}
shinyApp(ui, server)
return renderText
中的列表。您可以使用 renderPrint
代替 renderText
,使用 verbatimTextOutput
代替 textOutput
。
我正在为 R 函数开发 shiny webtool 以在 webtool 上生成索引结果。
我有 6 个 R 函数,我在 selectinput 小部件中创建了 6 个组合,其中每个组合都与一个 R 函数相关联。
6个R函数如下:
RSCU(文件){脚本},
cgr_res(文件){脚本},
zscore_cal(文件){脚本},
GC_Content7(文件){}和
extractmod(file){script} 所有这 5 个函数都有一个相同的参数,即输入文件作为所有五个 R 函数的相同输入参数 最后一个 6th R 函数的 R 函数具有 AMIP(file,n1,n2) 3 个输入参数,此处输入文件与其余 5 个相同,但 n1 和 n2 是不同的参数, 对于 n1 和 n2 参数,我创建了 numericalInput() 小部件。对于 GC_content7、RSCU、cgr_res 和 zscore_cal,webtool 工作正常,但对于其他两个函数,没有显示结果。
library("shinythemes")
library("shiny")
library("htmltools")
library("bsplus")
library("DT")
library("shinyalert")
library("shinyjs")
library("shinycssloaders")
library("dplyr")
library("data.table")
library("reshape2")
library("ggplot2")
library("plotly")
library("tools")
library("readxl")
library("writexl")
library("seqinr")
library("Biostrings")
library("BiocManager")
library("entropy")
library("protr")
source("GS_Source.R")
ui = fluidPage(
headerPanel(
h1(tags$strong("Welcome to Web based Tool for Computation of Genomic"),
style = "font-size: 20pt; line-height: 30pt; width = 100; color: #Red",
align = "center"),
windowTitle = "Home"),
sidebarLayout(
sidebarPanel(
style = "background-color: #E52B50;",
tags$style(type='text/css',
"label { font-size: 12px; }",
".selectize-input { font-size: 12pt; line-height: 12pt;},
.selectize-dropdown { font-size: 12pt; line-height: 12pt; }"),
fileInput('file', HTML('<p style="color:#4A2768; font-size: 12pt"> Choose file to upload the expression data </p>'),accept = c('text/csv','text/comma-separated-values',
'text/tab-separated-values','text/plain','.csv', '.tsv','.fasta')),
selectInput("Signatures", HTML('<p style="color:#4A27C5; font-size: 12pt"> Genome signature </p>'),
c("GC-content","RSCU","CGR","DI-nuculeotide odd Ratio","AAC","AMIP")),
numericInput("num1",label = "FROM",value = 2),
numericInput("num2", label = "TO", value = 3),
useShinyalert(),
actionButton("action", tags$b("Submit")), width = 3, style="color: #fff; background-color: #337ab7; border-color: #2e6da4"),
mainPanel(
verbatimTextOutput("res1"),
verbatimTextOutput("res2"),
plotOutput("res3"),
verbatimTextOutput("res4"),
verbatimTextOutput("res5"),
verbatimTextOutput("res6"),
)
)
)
server <- function(input, output, session) {
df <- eventReactive(input$action, {
my_func <- switch(input$Signatures,
"RSCU" = RSCU,
"CGR"=cgr_res,
"DI-nuculeotide odd Ratio"=zscore_cal,
"GC-content" = GC_content7,
"AAC"=extractAAC_mod,
)
my_func(input$file$datapath)
})
df1 <- eventReactive(input$actions, {
my_func1 <- switch(input$signatures,
"AMIP"=AMIP,
)
my_func1(input$file$datapath,input$num1,input$num2)
})
output$res1 <- renderPrint({
req(input$Signatures)
if (input$Signatures=="GC-content") {
df()
}
})
output$res2 <- renderPrint({
req(input$Signatures)
if (input$Signatures=="RSCU") {
df()
}
})
output$res3 <- renderPlot({
req(input$Signatures)
if (input$Signatures=="CGR") {
df()
}
})
output$res4 <- renderPrint({
req(input$Signatures)
if (input$Signatures=="DI-nuculeotide odd Ratio") {
df()
}
})
output$res5 <- renderPrint({
req(input$Signatures)
if (input$Signatures=="AAC") {
df()
}
})
output$res6 <- renderPrint({
req(input$signatures)
if(input$signatures=="AMIP"){
df1()
}
})
observeEvent(input$action, {
shinyalert(title = "Please wait for the results...", type = "success")
})
}
shinyApp(ui, server)
return renderText
中的列表。您可以使用 renderPrint
代替 renderText
,使用 verbatimTextOutput
代替 textOutput
。