Soporte para input file de csv i xlsx, además de fasta.
This commit is contained in:
@@ -11,7 +11,7 @@ ui <- fluidPage(
|
|||||||
navbarPage("Apps",
|
navbarPage("Apps",
|
||||||
tabPanel("Translation",
|
tabPanel("Translation",
|
||||||
sidebarPanel(
|
sidebarPanel(
|
||||||
fileInput("file1", "Sube fichero mfasta", multiple = FALSE),
|
fileInput("file1", "Sube fichero (fasta, csv o xlsx)", multiple = FALSE),
|
||||||
selectInput("spec", label = h3("Specie"),
|
selectInput("spec", label = h3("Specie"),
|
||||||
choices = list("Human" = 1, "E. Coli" = 2),
|
choices = list("Human" = 1, "E. Coli" = 2),
|
||||||
selected = 1),
|
selected = 1),
|
||||||
@@ -43,7 +43,17 @@ server <- function(input, output) {
|
|||||||
|
|
||||||
observe({
|
observe({
|
||||||
if (!is.null(input$file1)){ # This ensures that the reading is only tried when File selected
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user