Browse Source

Inicialización

main
marcelcosta 2 years ago
commit
4efb48600f
2 changed files with 72 additions and 0 deletions
  1. +0
    -0
      README.md
  2. +72
    -0
      app.R

+ 0
- 0
README.md


+ 72
- 0
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="<br>")
}
})
{
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)

Loading…
Cancel
Save