Browse Source

Soporte para input file de csv i xlsx, además de fasta.

main
marcelcosta 2 years ago
parent
commit
e705417d75
1 changed files with 12 additions and 2 deletions
  1. +12
    -2
      app.R

+ 12
- 2
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)
}
}
}
})

Loading…
Cancel
Save