Commit 3784cf26 authored by NAVRATIL VINCENT's avatar NAVRATIL VINCENT
Browse files

export + legend function

parent d09babd6
......@@ -5,3 +5,5 @@ library(ggplot2)
library(gridExtra)
library(ggimage)
library(readr)
library(cowplot)
......@@ -19,6 +19,32 @@ shinyServer(
df=read.csv2(dginn_file$datapath,sep="\t")
}
})
tree_data_reactive <- reactive({
selected <- input$dginn_data_rows_selected
file=dginn_df_reactive()[selected,"File"]
path="../data/"
gene=dginn_df_reactive()[selected,"Gene"]
file_url=paste(path,file,sep="/")
read_file(paste(file_url,".phylip_phyml_tree.txt",sep=""))
})
msa_data_reactive <- reactive({
selected <- input$dginn_data_rows_selected
file=dginn_df_reactive()[selected,"File"]
path="../data/"
gene=dginn_df_reactive()[selected,"Gene"]
file_url=paste(path,file,sep="/")
read_file(paste(file_url,".fas",sep=""))
})
# renderDataTable -- DGINN data table
output$dginn_data <- DT::renderDataTable({
......@@ -30,7 +56,7 @@ shinyServer(
},
selection = 'single')
#renderPlotOutput -- Taxonomy z-score
#renderPlotOutput -- ggTree + msa + summary
output$ggtree_plot <- renderPlot({
selected <- input$dginn_data_rows_selected
......@@ -81,12 +107,50 @@ shinyServer(
p_msa <- dginn_msaplot(p, paste(file_url,".fas",sep=""),dginn_position=as.numeric(names(dginn_data_model_summary$summary)), offset=1, width=5)
p_msa_summary <- dginn_msaplot_summary(p, paste(file_url,".fas",sep=""),dginn_summary=dginn_data_model_summary, offset=1, width=5)
grid.arrange(p_msa_summary+ theme(legend.position = "none") ,p_msa+ theme(legend.position = "none"),nrow=2,ncol=1,heights=c(4,2*dginn_df_reactive()[selected,"NbSpecies"]))
grid.arrange(cowplot::get_legend(p_msa_summary
),p_msa_summary+ theme(legend.position = "none") ,p_msa+ theme(legend.position = "none"),nrow=3,ncol=1,heights=c(10,5,2*dginn_df_reactive()[selected,"NbSpecies"]))
removeUI(
selector="#tree"
)
insertUI(
selector = "#ggtree_plot",
where = "afterEnd",
ui = downloadLink("tree",".tree")
)
removeUI(
selector="#msa"
)
insertUI(
selector = "#ggtree_plot",
where = "afterEnd",
ui = downloadLink("msa",".fasta")
)
}
}
)
output$tree <- downloadHandler(
filename = function() {
paste0(input$tree, ".tree")
},
content = function(file) {
write(tree_data_reactive(), file)
}
)
output$msa <- downloadHandler(
filename = function() {
paste0(input$msa, ".msa")
},
content = function(file) {
write(msa_data_reactive(), file)
}
)
})
......@@ -24,6 +24,7 @@ shinyUI(fluidPage(
tabPanel("DGINN dataset",
DT::dataTableOutput("dginn_data"),
plotOutput("ggtree_plot",height = "800px")
#, radioButtons("model_parameter_rb", label = "Select model:",choices = list("BppM1M2","BppM7M8","BppDFP07_0DFP07","codemlM1M2","codemlM7M8"), selected = "BppM1M2")
)
)
......
Markdown is supported
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