Afegit funció de visor.
This commit is contained in:
+64
-17
@@ -10,23 +10,35 @@ ui <- fluidPage(
|
|||||||
titlePanel("ChromatoR"),
|
titlePanel("ChromatoR"),
|
||||||
|
|
||||||
# Sidebar with a slider input for number of bins
|
# Sidebar with a slider input for number of bins
|
||||||
sidebarLayout(
|
navbarPage("ChromatoR",
|
||||||
sidebarPanel(
|
tabPanel("Detección de Bases",
|
||||||
fileInput("file1", "Sube fichero ab1", multiple = FALSE),
|
sidebarPanel(
|
||||||
numericInput("thr", label = "Peak Threshold", value = 450),
|
fileInput("file1", "Sube fichero ab1", multiple = FALSE),
|
||||||
numericInput("dist1", label = "1st Distance Reduction", value = 4),
|
numericInput("thr", label = "Peak Threshold", value = 450),
|
||||||
numericInput("dist2", label = "2nd Distance Reduction", value = 7),
|
numericInput("dist1", label = "1st Distance Reduction", value = 4),
|
||||||
numericInput("ratio", label = "Ratio 2ary seq", value = 0.33),
|
numericInput("dist2", label = "2nd Distance Reduction", value = 7),
|
||||||
textInput("old", label="Referencia"),
|
numericInput("ratio", label = "Ratio 2ary seq", value = 0.33),
|
||||||
actionButton("calab", "Analizar")
|
textInput("old", label="Referencia"),
|
||||||
),
|
actionButton("calab", "Analizar")
|
||||||
|
),
|
||||||
|
|
||||||
# Show a plot of the generated distribution
|
# Show a plot of the generated distribution
|
||||||
mainPanel(
|
mainPanel(
|
||||||
tags$head(tags$style(HTML("pre,.wrap { white-space: pre-wrap; word-break: break-all; }"))),
|
tags$head(tags$style(HTML("pre,.wrap { white-space: pre-wrap; word-break: break-all; }"))),
|
||||||
verbatimTextOutput("Primseq") %>% tagAppendAttributes(class="wrap"),
|
verbatimTextOutput("Primseq") %>% tagAppendAttributes(class="wrap"),
|
||||||
verbatimTextOutput("align")
|
verbatimTextOutput("align")
|
||||||
)
|
)
|
||||||
|
),
|
||||||
|
tabPanel("Visor de Cromatograma",
|
||||||
|
sidebarPanel(
|
||||||
|
numericInput("visStart", label="Inicio", value=0),
|
||||||
|
numericInput("visWidth", label="Bases a mostrar", value=50),
|
||||||
|
actionButton("butvis", "Mostrar")
|
||||||
|
),
|
||||||
|
mainPanel(
|
||||||
|
plotOutput("visor",width=1000)
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -177,7 +189,7 @@ server <- function(input, output) {
|
|||||||
output$Primseq <- renderText({
|
output$Primseq <- renderText({
|
||||||
observeEvent(obj$seq, {})
|
observeEvent(obj$seq, {})
|
||||||
|
|
||||||
if (!is.null(obj$seq) & input$old != ""){
|
if (!is.null(obj$seq)){
|
||||||
print(1)
|
print(1)
|
||||||
as.character(obj_ab@primarySeq)
|
as.character(obj_ab@primarySeq)
|
||||||
}
|
}
|
||||||
@@ -193,6 +205,41 @@ server <- function(input, output) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
plotvis<-eventReactive( input$butvis, {
|
||||||
|
if (!is.null(obj$seq)){
|
||||||
|
print("Inicio imagen")
|
||||||
|
width<-input$visWidth
|
||||||
|
min<-input$visStart
|
||||||
|
max<-min+width
|
||||||
|
|
||||||
|
let<-obj_ab@primarySeq %>% as.character %>% strsplit("")
|
||||||
|
picks_x<-apply(obj_ab@peakPosMatrix, 1, max, na.rm=T)
|
||||||
|
|
||||||
|
picks<-data.frame(rows=apply(obj_ab@peakPosMatrix, 1, max, na.rm=T), Base=let[[1]], num=1:length(let[[1]])) %>%
|
||||||
|
filter(num >= min & num <= max) #%>% mutate(rows=rows-min)
|
||||||
|
|
||||||
|
ranPeaks<-range(picks$rows)
|
||||||
|
|
||||||
|
obj$plot<-obj_ab@traceMatrix %>% as.data.frame() %>% rename(A=V1,C=V2,G=V3,T=V4) %>% add_column(rows=1:nrow(.)) %>%
|
||||||
|
filter(rows >= ranPeaks[1] & rows <= ranPeaks[2]) %>% gather(Base, Value, -rows) %>%
|
||||||
|
mutate(Base=factor(Base, levels=c("G","A","T","C"))) %>%
|
||||||
|
ggplot(aes(rows, Value))+
|
||||||
|
geom_line(aes(color=Base))+
|
||||||
|
geom_vline(xintercept = picks_x[picks_x >= ranPeaks[1] & picks_x <= ranPeaks[2]], alpha=0.2)+
|
||||||
|
geom_text(data=picks, aes(label=Base, y=3800, color=factor(Base,levels=c("G","A","T","C"))))+
|
||||||
|
geom_text(data=picks, aes(label=num, y=4250), size=3, angle=90, hjust=0.5, vjust=0.5)+
|
||||||
|
scale_color_manual(values=c("G"="black", "A"="#66CC00", "T"="red","C"="blue"))+
|
||||||
|
geom_hline(yintercept = peakthr)+
|
||||||
|
theme_classic()
|
||||||
|
print("Final Imagen")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
output$visor <- renderPlot({
|
||||||
|
observeEvent(input$butvis, {plotvis()})
|
||||||
|
obj$plot
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run the application
|
# Run the application
|
||||||
|
|||||||
Reference in New Issue
Block a user