diff --git a/app.R b/app.R index 9f6cbcd..2a9b433 100644 --- a/app.R +++ b/app.R @@ -11,7 +11,7 @@ ui <- fluidPage( navbarPage("Apps", tabPanel("Translation", sidebarPanel( - fileInput("file1", "Sube fichero mfasta", multiple = FALSE), + fileInput("file1", "Sube fichero (fasta, csv o xlsx)", multiple = FALSE), selectInput("spec", label = h3("Specie"), choices = list("Human" = 1, "E. Coli" = 2), selected = 1), @@ -43,7 +43,17 @@ server <- function(input, output) { observe({ if (!is.null(input$file1)){ # This ensures that the reading is only tried when File selected - obj$fasta<-read.fasta(input$file1$datapath) + if (grepl(".xlsx", input$file1$datapath)){ + file<-openxlsx::read.xlsx(input$file1$datapath) + obj$fasta<-dataframe2fas(file) + }else{ + if (grepl(".csv", input$file1$datapath)){ + file<-read.csv(input$file1$datapath) + obj$fasta<-dataframe2fas(file) + }else{ + obj$fasta<-read.fasta(input$file1$datapath) + } + } } })