commit 4efb48600fc7e35c83eb9a52f6da2ef76945ba73 Author: marcelcosta Date: Tue Jul 12 12:52:25 2022 +0200 Inicialización diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/app.R b/app.R new file mode 100644 index 0000000..6e12914 --- /dev/null +++ b/app.R @@ -0,0 +1,72 @@ +library(shiny) +library(seqRFLP) +library(reversetranslate) + +# Define UI +ui <- fluidPage( + + # Application title + titlePanel("Reverse tranlation"), + + navbarPage("Apps", + tabPanel("Translation", + sidebarPanel( + fileInput("file1", "Sube fichero mfasta", multiple = FALSE), + selectInput("spec", label = h3("Specie"), + choices = list("Human" = 1, "E. Coli" = 2), + selected = 1), + actionButton("calab", "Analizar") + ), + + mainPanel( + textAreaInput("seqText", label="Enter mFasta text", width = "100%", height = "500px", value=""), + # tags$head(tags$style(HTML("pre { white-space: pre-wrap; word-break: break-all; }"))), + htmlOutput("seqDNA") + ) + ), + tabPanel("Codon Frequency Table", + mainPanel( + tableOutput("tbl") + ) + ) + ) +) + +# Define server +server <- function(input, output) { + + output$seqDNA <- renderText({ + if (input$seqText == ""){ + print("Result") + }else{ + seqs<-strsplit(input$seqText,"\n")[[1]] + names_seqs<-seqs[grepl("^>",seqs)] + names_seqs<-gsub(">","", names_seqs) + seqs<-seqs[!grepl("^>", seqs)] + + if(input$spec == 1){spec<-hsapien_tbl} + if(input$spec == 2){spec<-ecoli_tbl} + + seqs_DNA<-c() + progress <- shiny::Progress$new(min=0, max=length(seqs)) + for (i in 1:length(seqs)){ + set.seed(123) + seqs_DNA<-c(seqsDNA<-reverse_translate(seqs[i],spec)) + progress$set(message = "Reverse Translating", value = i) + } + + paste(dataframe2fas(data.frame(names=names_seqs, + seqs=seqs_DNA)), collapse="
") + } + }) + { + output$tbl <- renderTable({ + if(input$spec == 1){spec<-hsapien_tbl} + if(input$spec == 2){spec<-ecoli_tbl} + spec %>% arrange(aa) + }) + } +} + +# Run the application +shinyApp(ui = ui, server = server)