Commit bfc81966 authored by Kunst, Jonathan's avatar Kunst, Jonathan
Browse files

Selecting models and chromosomes for plotting now functional

parent 374ac009
......@@ -61,7 +61,7 @@ mod_qtl_plotly_panel_ui <- function(id){
),
),
withSpinner(plotlyOutput(outputId = ns('plotly'))),
withSpinner(plotlyOutput(outputId = ns('qtl_plotly'))),
verbatimTextOutput(ns('click'))
)
......@@ -91,11 +91,25 @@ mod_qtl_plotly_panel_server <- function(id, rv){
observeEvent(input$update_plot, {
req(rv$polyqtl_scan)
rv$qtl_df <- bind_rows(rv$model_list, .id = 'model')
# if check_model is unchecked and models are specified
if(!input$check_model){
rv$qtl_df <- rv$qtl_df %>%
filter(model %in% input$choice_model)
}
# if check_chrom is unchecked and chromosomes are specified
if(!input$check_chrom){
rv$qtl_df <- rv$qtl_df %>%
filter(chromosome %in% input$choice_chrom)
}
try(
rv$lod_ggplot <- ggplot(bind_rows(rv$model_list, .id = 'model'), aes(x = position,
y = LOD,
color = model,
linetype = model)) +
rv$qtl_ggplot <- ggplot(rv$qtl_df, aes(x = position,
y = LOD,
color = model,
linetype = model)) +
geom_point(aes(
text = paste(paste('LOD:', round(LOD, 2)),
paste('Marker:', marker),
......@@ -114,9 +128,9 @@ mod_qtl_plotly_panel_server <- function(id, rv){
})
# render of ggplot object as plotly object
output$plotly <- renderPlotly({
req(rv$lod_ggplot)
ggplotly(rv$lod_ggplot, tooltip = 'text') %>%
output$qtl_plotly <- renderPlotly({
req(rv$qtl_ggplot)
ggplotly(rv$qtl_ggplot, tooltip = 'text') %>%
highlight('plotly_selected') %>%
layout(title = list(text = 'Chromosome', xanchor = 'center'))
})
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment