Skip to content

Commit

Permalink
fixed problem with pooled data dir
Browse files Browse the repository at this point in the history
  • Loading branch information
pfgherardini committed Jul 23, 2018
1 parent f333552 commit a82ea15
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
9 changes: 6 additions & 3 deletions R/plot_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,15 @@ load_clusters_data <- function(clusters, samples, dir.prefix, skip.missing = FAL
#'
plot_clusters <- function(G, clusters, col.names, working.dir, plot.type, pool.clusters = FALSE,
pool.samples = FALSE, samples.to.plot = NULL, facet.by = "Sample") {

if(!dir.exists(file.path(working.dir, "clusters_data")))
stop("clusters_data directory is missing, data cannot be plotted")

cl.labels <- V(G)$Label[clusters]
clusters.data <- NULL

if(is.null(V(G)$sample) && is.null(samples.to.plot)) { # Load the pooled data
clusters.data <- load_rds_data(cl.labels, file.path(working.dir, "clusters_data", "pooled"))
if(is.null(V(G)$sample) && is.null(samples.to.plot)) { # Load the pooled data
pooled.data.dir <- tools::file_path_sans_ext(igraph::get.graph.attribute(G, "fname"))
clusters.data <- load_rds_data(cl.labels, file.path(working.dir, "clusters_data", "pooled", pooled.data.dir))
clusters.data$sample <- NULL
}
else {
Expand Down
15 changes: 7 additions & 8 deletions inst/shinyGUI/server/tab_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ fluidPage(
selectInput("graphui_node_size", "Nodes size", choices = c("Proportional", "Default"), width = "100%")
),
column(6,
numericInput("graphui_min_node_size", "Minimum node size", 2, min = 0, max = 1000)
numericInput("graphui_min_node_size", "Minimum node size", 5, min = 0, max = 1000)
)
),
fluidRow(
column(6,
numericInput("graphui_max_node_size", "Maximum node size", 80, min = 0, max = 1000)
numericInput("graphui_max_node_size", "Maximum node size", 60, min = 0, max = 1000)
),
column(6,
numericInput("graphui_landmark_node_size", "Landmark node size", 40, min = 0, max = 1000)
numericInput("graphui_landmark_node_size", "Landmark node size", 20, min = 0, max = 1000)
)
),
fluidRow(
Expand Down Expand Up @@ -202,8 +202,7 @@ observe({
updateSelectInput(session, "graphui_x_axis", choices = markers.for.plotting)
updateSelectInput(session, "graphui_y_axis", choices = markers.for.plotting)
sample.names <- panorama:::get_sample_names(G)
updateSelectInput(session, "graphui_active_sample", choices = c("All", sample.names),
selected = input$graphui_active_sample)
updateSelectInput(session, "graphui_active_sample", choices = c("All", sample.names))
updateSelectizeInput(session, "graphui_samples_to_plot", choices = sample.names)
updateSelectInput(session, "graphui_stats_relative_to", choices = sample.names,
selected = input$graphui_stats_relative_to)
Expand Down Expand Up @@ -366,10 +365,10 @@ output$graphui_plot = renderPlot(width = 1200, height = 800, expr = {
))
return(p)
}
else if(input$graphui_pool_samples_data) {
else if(input$graphui_pool_samples_data && !input$graphui_pool_clusters_data) {
showModal(modalDialog(
"This graph was derived from multiple independent clustering runs.",
"Data from different samples cannot be pooled",
"Data from different samples cannot be pooled, unless you also pool the clusters data",
easyClose = TRUE
))
return(p)
Expand All @@ -386,7 +385,7 @@ output$graphui_plot = renderPlot(width = 1200, height = 800, expr = {
}
else if(length(input$graphui_selected_nodes) > 0) {
session$sendCustomMessage(type = "plot_loading", "none")
p <- panorama:::plot_clusters(G,
p <- panorama:::plot_clusters(G,
clusters = get_selected_nodes(),
col.names = markers.to.plot,
working.dir = working.directory,
Expand Down
2 changes: 1 addition & 1 deletion inst/shinyGUI/www/pixigraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class PixiGraph {

if(d.type && d.type == "landmark") {
label.visible = true
fontSize = 24
fontSize = 16
}

label.style = {fontFamily: 'Arial', fontSize: fontSize, fill: 0x210E0F, align: 'left', strokeThickness: 1}
Expand Down

0 comments on commit a82ea15

Please sign in to comment.