Afegit funció de visor.
This commit is contained in:
+49
-2
@@ -10,7 +10,8 @@ ui <- fluidPage(
|
||||
titlePanel("ChromatoR"),
|
||||
|
||||
# Sidebar with a slider input for number of bins
|
||||
sidebarLayout(
|
||||
navbarPage("ChromatoR",
|
||||
tabPanel("Detección de Bases",
|
||||
sidebarPanel(
|
||||
fileInput("file1", "Sube fichero ab1", multiple = FALSE),
|
||||
numericInput("thr", label = "Peak Threshold", value = 450),
|
||||
@@ -27,6 +28,17 @@ ui <- fluidPage(
|
||||
verbatimTextOutput("Primseq") %>% tagAppendAttributes(class="wrap"),
|
||||
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({
|
||||
observeEvent(obj$seq, {})
|
||||
|
||||
if (!is.null(obj$seq) & input$old != ""){
|
||||
if (!is.null(obj$seq)){
|
||||
print(1)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user