Skip to content

Commit

Permalink
Multiple fixes:
Browse files Browse the repository at this point in the history
- Fix: loading of light_version bundles was broken.
- Fix: `projection_point_size` and `scatters_point_size` were not detected when added in `other_params`.
- Fix: import warned when there were metacells withour an edge when providing `default_graph` parameter.

* `About` tab is now the first in light-version bundles.
  • Loading branch information
aviezerl committed Jan 18, 2024
1 parent c1e268e commit 47a2eee
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: MCView
Title: A Shiny App for Metacell Analysis
Version: 0.2.25
Version: 0.2.26
Authors@R:
person(given = "Aviezer",
family = "Lifshitz",
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# MCView 0.2.6

* Multiple fixes:
- Fix: loading of light_version bundles was broken.
- Fix: `projection_point_size` and `scatters_point_size` were not detected when added in `other_params`.
- Fix: import warned when there were metacells withour an edge when providing `default_graph` parameter.

* `About` tab is now the first in light-version bundles.

# MCView 0.2.5

* Added an option to exclude lateral and noisy genes from marker heatmap.
Expand Down
7 changes: 7 additions & 0 deletions R/app_config.R
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ init_tab_defs <- function() {

cur_config$tabs <- order_tabs(cur_config$tabs)

if (!is.null(config$light_version) && config$light_version) {
# make the About tab first if exists
if ("About" %in% cur_config$tabs) {
cur_config$tabs <- c("About", cur_config$tabs[cur_config$tabs != "About"])
}
}

config <<- cur_config
}

Expand Down
4 changes: 4 additions & 0 deletions R/plot_gene_mc.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ connect_gene_plots <- function(input, output, session, ns, source) {
initial_scatters_point_size <- function(dataset, screen_width = NULL, screen_height = NULL, weight = 1, atlas = FALSE) {
if (!is.null(config$datasets[[dataset]]$scatters_point_size)) {
return(config$datasets[[dataset]]$scatters_point_size)
} else if (!is.null(config$scatters_point_size)) {
return(config$scatters_point_size)
}
n_metacells <- length(get_mc_data(dataset, "mc_sum", atlas = atlas))
screen_width <- screen_width %||% 1920
Expand All @@ -166,6 +168,8 @@ initial_scatters_point_size <- function(dataset, screen_width = NULL, screen_hei
initial_scatters_stroke <- function(dataset) {
if (!is.null(config$datasets[[dataset]]$scatters_stroke)) {
return(config$datasets[[dataset]]$scatters_stroke)
} else if (!is.null(config$scatters_stroke)) {
return(config$scatters_stroke)
}
return(0.2)
}
2 changes: 2 additions & 0 deletions R/plot_mc2d_proj.R
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ render_2d_plotly <- function(input, output, session, dataset, metacell_types, ce
initial_proj_point_size <- function(dataset, screen_width = NULL, screen_height = NULL, weight = 1, atlas = FALSE) {
if (!is.null(config$datasets[[dataset]]$projection_point_size)) {
return(config$datasets[[dataset]]$projection_point_size * weight)
} else if (!is.null(config$projection_point_size)) {
return(config$projection_point_size * weight)
}
n_metacells <- length(get_mc_data(dataset, "mc_sum", atlas = atlas))
screen_width <- screen_width %||% 1920
Expand Down
4 changes: 2 additions & 2 deletions R/umap.R
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ layout_and_graph_to_mc2d <- function(layout, graph, metacells, warn_function = c
return(NULL)
}

unknown_metacells <- c(setdiff(metacells, graph$from), setdiff(metacells, graph$to))
unknown_metacells <- c(setdiff(graph$from, metacells), setdiff(graph$to, metacells))
if (length(unknown_metacells) > 0) {
unknown_metacells <- paste(unknown_metacells, collapse = ", ")
warn_function(glue("Metacells {unknown_metacells} were not found in layout"))
warn_function(glue("Metacells {unknown_metacells} were in the graph but not in the dataset"))
}

graph <- graph %>% filter(from %in% metacells, to %in% metacells)
Expand Down
2 changes: 2 additions & 0 deletions R/utils_heatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ heatmap_sidebar <- function(id, ...) {
add_genes_ui <- NULL
update_genes_ui <- NULL
load_genes_ui <- NULL
include_lateral_ui <- NULL
include_noisy_ui <- NULL
} else {
max_gene_num_ui <- numericInput(ns("max_gene_num"), "Maximal number of genes", value = 100)
remove_genes_ui <- shinyWidgets::actionGroupButtons(ns("remove_genes"), labels = "Remove selected genes", size = "sm")
Expand Down
6 changes: 4 additions & 2 deletions R/utils_selectors.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ metadata_selector <- function(dataset, ns, id = "selected_md", label = "Metadata
metadata <- get_mc_data(dataset(), metadata_id)
req(metadata)
metadata_fields <- c(additional_fields, colnames(metadata)[-1])
shinyWidgets::pickerInput(ns(id), label,
shinyWidgets::virtualSelectInput(ns(id),
label = label,
choices = metadata_fields,
selected = selected,
multiple = multiple,
options = list(`actions-box` = TRUE, `dropup-auto` = FALSE)
showSelectedOptionsFirst = TRUE,
search = TRUE
)
})
}
Expand Down

0 comments on commit 47a2eee

Please sign in to comment.