Reading fasta files

Hi everyone,

I am very new to RShiny. I want to develop an app where I would like to read in two files, file1 (.fasta) and file 2 (.fasta), calculate certain features of the two files , then merge them (.txt) and put the merged file as input to a training model.

When I tried to read in the fasta files, it is showing the error as " Error in file(con, "r") : cannot open the connection"

I am pasting the codes here.

UI
library(shiny)

shinyUI(fluidPage(
titlePanel("XXXX"),
sidebarLayout(
sidebarPanel(

             fileInput("file1", "Select sequence",
                       accept = c("text/fasta",".fasta"), multiple = FALSE, buttonLabel = 
                         "Browse..."),
             
             
             fileInput("file2", "Select sequence",
                       accept = c("text/fasta",".fasta"), multiple = FALSE, buttonLabel = 
                         "Browse..."),
             
             
             checkboxGroupInput("file_choice", "Check the protein features to be includied in prediction", choices = 
                           c("Amino Acid Composition" = "AAC.R", "Dipeptide Composition" = "DC.r", "Normalized Moreau-Broto Autocorrelation" = "AC.R", "C/T/D" = "CTD.R", "Conjoint Triad" = "CT.R", 
                             "Sequence-Order-Coupling Number" = "SOCN.R", "Quasi-Sequence-Order Descriptors" = "QSPD.R", "Amphiphilic Pseudo-Amino Acid Composition " = "APAAC.R", "Pseudo-Amino Acid Composition " = "PAAC.r" )),
             actionButton("feat", "Calculate Selected Features"),

             radioButtons("algo", "Select the training method", list("RF", "SVM", "Ensemble"), ""),
             submitButton("submit"),
),

mainPanel(("You have entered"),
          
          textOutput("seq1"),
          textOutput("seq2"),

)
)
)

Server
library(shiny)
library(protr)
library(seqinr)
shinyServer(
function(input, output)
{
seq1 <- readFASTA("input$file1")[[1]]
seq2 <- readFASTA("input$file2")[[1]]
aac <- extractAAC(seq1)

}
)

Please excuse my ignorance and kindly help me how to proceed with this.

you need to remove the quotes around input$file1 and input$file2 in readFASTA

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.