From e705417d75a8fd2951364ceee9bc5bcddad585f0 Mon Sep 17 00:00:00 2001 From: marcelcosta Date: Wed, 13 Jul 2022 13:01:27 +0200 Subject: [PATCH] =?UTF-8?q?Soporte=20para=20input=20file=20de=20csv=20i=20?= =?UTF-8?q?xlsx,=20adem=C3=A1s=20de=20fasta.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.R | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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) + } + } } })