I am getting the error: Warning: Error in readLines: 'con' is not a connection
[No stack trace available]. Here's my R shiny code:
library(shiny)
library(seqinr)
#>
#> Attaching package: 'seqinr'
#> The following object is masked from 'package:shiny':
#>
#> a
ui <- fluidPage(
titlePanel("Uploading Files"),
sidebarLayout(
sidebarPanel(
fileInput("fasta_file", "Choose a Fasta File",
accept = c(".fasta",
".fa",
".fna"),
multiple = FALSE)
),
mainPanel(
textOutput("length")
)
)
)
server <- function(input, output) {
file_name <- reactive({
inFile <- input$fasta_file
return(inFile$datapath)
})
output$length <- renderPrint({
example_file.fasta <- file_name()
df <- read.fasta(example_file.fasta, as.string = TRUE)
len <- getLength(df)
len
})
}
shinyApp (ui, server)
here's an example fasta file to test this code;
>a1
actcgtggt
>a2
ccttgg
>a3
cgcgcttttttttt