ml dash
This commit is contained in:
parent
74df62bb85
commit
d627e88aeb
3 changed files with 99 additions and 77 deletions
32
ml/global.R
32
ml/global.R
|
@ -56,6 +56,8 @@ split_map = data.frame(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
colour_range=c("#605ca8", "#bebddb", "#221e70")
|
||||||
|
|
||||||
metadata_cols = c("n_training_size", "n_test_size", "n_trainingY_ratio", "n_testY_ratio", "resampling", "n_features")
|
metadata_cols = c("n_training_size", "n_test_size", "n_trainingY_ratio", "n_testY_ratio", "resampling", "n_features")
|
||||||
|
|
||||||
# hardcoded list of drugs
|
# hardcoded list of drugs
|
||||||
|
@ -159,9 +161,6 @@ makeplot = function(x, # the DataFrame to plot
|
||||||
, position=position_dodge2(padding=0.1, preserve='total', reverse=TRUE)
|
, position=position_dodge2(padding=0.1, preserve='total', reverse=TRUE)
|
||||||
) +
|
) +
|
||||||
coord_cartesian(ylim = c(y_coord_min, 1)) +
|
coord_cartesian(ylim = c(y_coord_min, 1)) +
|
||||||
#scale_fill_manual(values = c("BT" = "#605ca8",
|
|
||||||
# "CV" = "#bebddb") ) +
|
|
||||||
#guides=guide_legend(reverse=TRUE) +
|
|
||||||
annotation_custom(grob) +
|
annotation_custom(grob) +
|
||||||
# doesn't work with plotly but looks nice :-(
|
# doesn't work with plotly but looks nice :-(
|
||||||
geom_label(aes_string(label=selection),
|
geom_label(aes_string(label=selection),
|
||||||
|
@ -172,15 +171,10 @@ makeplot = function(x, # the DataFrame to plot
|
||||||
fill="white"
|
fill="white"
|
||||||
|
|
||||||
) +
|
) +
|
||||||
|
scale_color_manual(values = colour_range) +
|
||||||
|
scale_fill_manual(values = colour_range) +
|
||||||
|
|
||||||
# works with plotly but i can't figure out the background yet
|
|
||||||
# geom_text(aes_string(label=selection, group=selection),
|
|
||||||
# position=position_dodge(width = -0.75),
|
|
||||||
# vjust = 1.5,
|
|
||||||
# alpha=0.75,
|
|
||||||
#
|
|
||||||
# ) +
|
|
||||||
|
|
||||||
# add little numbers for the BT bars only
|
# add little numbers for the BT bars only
|
||||||
labs(x="",y=paste(selection,"Score")) +
|
labs(x="",y=paste(selection,"Score")) +
|
||||||
theme(
|
theme(
|
||||||
|
@ -210,7 +204,21 @@ if (interactive()){
|
||||||
combined_training_genes = input$combined_training_genes
|
combined_training_genes = input$combined_training_genes
|
||||||
|
|
||||||
selected_gene = combo[combo$drug == selected_drug,'gene']
|
selected_gene = combo[combo$drug == selected_drug,'gene']
|
||||||
|
if (combined_data == "FS"){
|
||||||
|
updateRadioButtons(
|
||||||
|
inputId="combined_training_genes",
|
||||||
|
choiceNames = c("One", "Two"),
|
||||||
|
choiceValues = c("1", "2"),
|
||||||
|
selected = "2"
|
||||||
|
)
|
||||||
|
} else{
|
||||||
|
updateRadioButtons(
|
||||||
|
inputId="combined_training_genes",
|
||||||
|
choiceNames = c("Five", "Six"),
|
||||||
|
choiceValues = c("5","6"),
|
||||||
|
selected = "5"
|
||||||
|
)
|
||||||
|
}
|
||||||
# hide stuff if selected
|
# hide stuff if selected
|
||||||
if(combined_model == "combined") {
|
if(combined_model == "combined") {
|
||||||
#if(combined_model == TRUE) {
|
#if(combined_model == TRUE) {
|
||||||
|
|
28
ml/server.R
28
ml/server.R
|
@ -18,12 +18,26 @@ shinyServer(function(input, output) {
|
||||||
selected_split = input$split_dropdown
|
selected_split = input$split_dropdown
|
||||||
combined_data = input$combined_data
|
combined_data = input$combined_data
|
||||||
combined_training_genes = input$combined_training_genes
|
combined_training_genes = input$combined_training_genes
|
||||||
|
|
||||||
selected_gene = combo[combo$drug == selected_drug,'gene']
|
|
||||||
|
|
||||||
|
selected_gene = combo[combo$drug == selected_drug,'gene']
|
||||||
|
if (combined_data == "FS"){
|
||||||
|
updateRadioButtons(
|
||||||
|
inputId="combined_training_genes",
|
||||||
|
choiceNames = c("One", "Two"),
|
||||||
|
choiceValues = c("1", "2"),
|
||||||
|
selected = "2"
|
||||||
|
)
|
||||||
|
} else{
|
||||||
|
updateRadioButtons(
|
||||||
|
inputId="combined_training_genes",
|
||||||
|
choiceNames = c("Five", "Six"),
|
||||||
|
choiceValues = c("5","6"),
|
||||||
|
selected = "5"
|
||||||
|
)
|
||||||
|
}
|
||||||
# hide stuff if selected
|
# hide stuff if selected
|
||||||
if(combined_model == "combined") {
|
if(combined_model == "combined") {
|
||||||
#if(combined_model == TRUE) {
|
#if(combined_model == TRUE) {
|
||||||
|
|
||||||
hide("split_dropdown")
|
hide("split_dropdown")
|
||||||
#show("resample_dropdown")
|
#show("resample_dropdown")
|
||||||
|
@ -66,13 +80,13 @@ shinyServer(function(input, output) {
|
||||||
display_combined = FALSE,
|
display_combined = FALSE,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
# 6genes_logo_skf_BT_gid_complete
|
# 6genes_logo_skf_BT_gid_complete
|
||||||
|
|
||||||
# filedata example for combined: 6genes_logo_skf_BT_embb_actual
|
# filedata example for combined: 6genes_logo_skf_BT_embb_actual
|
||||||
# 6genes_logo_skf_BT_embb_combined
|
# 6genes_logo_skf_BT_embb_combined
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
116
ml/ui.R
116
ml/ui.R
|
@ -9,61 +9,61 @@ library(plotly)
|
||||||
library(shinycssloaders)
|
library(shinycssloaders)
|
||||||
|
|
||||||
dashboardPage(skin="purple",
|
dashboardPage(skin="purple",
|
||||||
dashboardHeader(title="Score Selector"),
|
dashboardHeader(title="Score Selector"),
|
||||||
dashboardSidebar(
|
dashboardSidebar(
|
||||||
radioButtons("combined_model",
|
radioButtons("combined_model",
|
||||||
label="Graph Model",
|
label="Graph Model",
|
||||||
choiceNames = c("Combined", "Gene"),
|
choiceNames = c("Combined", "Gene"),
|
||||||
choiceValues = c("combined", "gene"),
|
choiceValues = c("combined", "gene"),
|
||||||
selected="gene"
|
selected="gene"
|
||||||
),
|
),
|
||||||
|
|
||||||
# checkboxInput("combined_model",
|
# checkboxInput("combined_model",
|
||||||
# "Combined Model",
|
# "Combined Model",
|
||||||
# value=FALSE
|
# value=FALSE
|
||||||
# ),
|
# ),
|
||||||
#),
|
#),
|
||||||
|
|
||||||
radioButtons("combined_data",
|
radioButtons("combined_data",
|
||||||
label="Data Type",
|
label="Data Type",
|
||||||
choiceNames = c("Complete", "Actual", "Feature Selection"),
|
choiceNames = c("Complete", "Actual", "Feature Selection"),
|
||||||
choiceValues = c("complete", "actual", "FS"),
|
choiceValues = c("complete", "actual", "FS"),
|
||||||
selected="complete"
|
selected="complete"
|
||||||
),
|
),
|
||||||
radioButtons("combined_training_genes",
|
radioButtons("combined_training_genes",
|
||||||
label="Training Genes",
|
label="Training Genes",
|
||||||
choiceNames = c("One", "Two", "Five", "Six"),
|
choiceNames = c("One", "Two", "Five", "Six"),
|
||||||
choiceValues = c("1", "2", "5","6"),
|
choiceValues = c("1", "2", "5","6"),
|
||||||
selected = "5"
|
selected = "5"
|
||||||
),
|
),
|
||||||
radioButtons("drug_dropdown",
|
radioButtons("drug_dropdown",
|
||||||
label="Drug",
|
label="Drug",
|
||||||
choices = drug,
|
choices = drug,
|
||||||
selected="pyrazinamide"
|
selected="pyrazinamide"
|
||||||
),
|
),
|
||||||
radioButtons("split_dropdown",
|
radioButtons("split_dropdown",
|
||||||
label="Split",
|
label="Split",
|
||||||
choices = split_type,
|
choices = split_type,
|
||||||
selected="cd_7030"
|
selected="cd_7030"
|
||||||
),
|
),
|
||||||
radioButtons("score_dropdown",
|
radioButtons("score_dropdown",
|
||||||
label="Score",
|
label="Score",
|
||||||
choices = scores,
|
choices = scores,
|
||||||
selected="MCC"
|
selected="MCC"
|
||||||
),
|
),
|
||||||
radioButtons("resample_dropdown",
|
radioButtons("resample_dropdown",
|
||||||
label="Resampling",
|
label="Resampling",
|
||||||
choices = resample_types,
|
choices = resample_types,
|
||||||
selected="none" # "none" is a value
|
selected="none" # "none" is a value
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
dashboardBody(
|
dashboardBody(
|
||||||
useShinyjs(),
|
useShinyjs(),
|
||||||
#plotlyOutput("plot", height = 800),
|
#plotlyOutput("plot", height = 800),
|
||||||
plotOutput("plot", height = 800),
|
plotOutput("plot", height = 800),
|
||||||
# %>% withSpinner(color="#0dc5c1"), # uncomment if you want the spinner
|
# %>% withSpinner(color="#0dc5c1"), # uncomment if you want the spinner
|
||||||
#downloadButton("save", "Download Plot"),
|
#downloadButton("save", "Download Plot"),
|
||||||
#DT::dataTableOut("plotdata"),
|
#DT::dataTableOut("plotdata"),
|
||||||
verbatimTextOutput("debug")
|
verbatimTextOutput("debug")
|
||||||
)
|
)
|
||||||
)
|
)
|
Loading…
Add table
Add a link
Reference in a new issue