Skip to content

Commit

Permalink
Merge pull request #95 from drieslab/main
Browse files Browse the repository at this point in the history
chore: catch up to main 0.2.9
  • Loading branch information
jiajic authored Nov 18, 2024
2 parents 7dfbfa6 + 0cb61db commit 96e5de4
Show file tree
Hide file tree
Showing 44 changed files with 2,822 additions and 2,512 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: GiottoVisuals
Title: Visuals for the Giotto spatial biology analysis ecosystem
Version: 0.2.8
Version: 0.2.9
Authors@R: c(
person("Ruben", "Dries", email = "[email protected]",
role = c("aut", "cre"), comment = c(ORCID = "0000-0001-7650-7754")),
Expand Down
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@

# GiottoVisuals 0.2.9 (2024/11/18)

## bug fixes
- `spatInSituPlotPoints()` `xlim` and `ylim` params now also affect image resampling

## enhancements
- `group_by` and `group_by_subset` for `dimFeatPlot2D()` [#1069](https://github.com/drieslab/Giotto/issues/1069) by xhNorthwestern
- image plotting will now scale values to the 99th percentile when a specific max intensity is not set.

# GiottoVisuals 0.2.8 (2024/11/14)

## enhancements
Expand Down
137 changes: 69 additions & 68 deletions R/aux_defaults.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
#' set_default_cow_n_col(nr_plots = 4)
#'
#' @export
set_default_cow_n_col <- function(cow_n_col = NULL,
nr_plots) {
set_default_cow_n_col <- function(
cow_n_col = NULL,
nr_plots) {
if (is.null(cow_n_col)) {
cow_n_col <- ceiling(sqrt(nr_plots))
} else {
Expand Down Expand Up @@ -76,8 +77,10 @@ set_default_cow_n_col <- function(cow_n_col = NULL,
#' @param \dots additional params to pass
#' @returns a palette function
#' @examples
#' set_default_color_discrete(colors = "#eb4034",
#' instr_rev = NULL, instr_strategy = NULL)
#' set_default_color_discrete(
#' colors = "#eb4034",
#' instr_rev = NULL, instr_strategy = NULL
#' )
NULL


Expand All @@ -91,11 +94,12 @@ NULL
#' pass specific `giottoInstructions` params
#'
#' @export
set_default_color_discrete <- function(colors = NULL,
...,
instr_pal,
instr_rev,
instr_strategy) {
set_default_color_discrete <- function(
colors = NULL,
...,
instr_pal,
instr_rev,
instr_strategy) {
# global giotto options
opt_pal <- getOption("giotto.color_d_pal", "distinct")
opt_rev <- getOption("giotto.color_d_rev", FALSE)
Expand Down Expand Up @@ -138,9 +142,10 @@ set_default_color_discrete <- function(colors = NULL,
#' @rdname set_default_color_discrete
#' @returns vector of color ids
#' @export
set_default_color_discrete_cell <- function(colors = NULL,
instrs,
...) {
set_default_color_discrete_cell <- function(
colors = NULL,
instrs,
...) {
# read instructions
instr_pal <- readGiottoInstructions(instrs, "cell_color_d_pal", NULL)
instr_rev <- readGiottoInstructions(instrs, "cell_color_d_rev", NULL)
Expand All @@ -160,9 +165,10 @@ set_default_color_discrete_cell <- function(colors = NULL,

#' @rdname set_default_color_discrete
#' @export
set_default_color_discrete_poly <- function(colors = NULL,
instrs,
...) {
set_default_color_discrete_poly <- function(
colors = NULL,
instrs,
...) {
# read instructions
instr_pal <- readGiottoInstructions(instrs, "poly_color_d_pal", NULL)
instr_rev <- readGiottoInstructions(instrs, "poly_color_d_rev", NULL)
Expand All @@ -182,9 +188,10 @@ set_default_color_discrete_poly <- function(colors = NULL,

#' @rdname set_default_color_discrete
#' @export
set_default_color_discrete_feat <- function(colors = NULL,
instrs,
...) {
set_default_color_discrete_feat <- function(
colors = NULL,
instrs,
...) {
# read instructions
instr_pal <- readGiottoInstructions(instrs, "feat_color_pal", NULL)
instr_rev <- readGiottoInstructions(instrs, "feat_color_rev", NULL)
Expand All @@ -204,9 +211,10 @@ set_default_color_discrete_feat <- function(colors = NULL,

#' @rdname set_default_color_discrete
#' @export
set_default_color_discrete_heatmap_clus <- function(colors = NULL,
instrs,
...) {
set_default_color_discrete_heatmap_clus <- function(
colors = NULL,
instrs,
...) {
# read instructions
instr_pal <- readGiottoInstructions(
instrs, "heatmap_clus_color_pal",
Expand Down Expand Up @@ -340,14 +348,14 @@ NULL
#' `giottoInstructions` params
#' @export
set_default_color_continuous <- function(
colors = NULL, # used for function inputs
midpoint = NULL,
style = c("divergent", "sequential"),
...,
instr_pal,
instr_rev,
data_default = NULL,
type = c("fill", "color")) {
colors = NULL, # used for function inputs
midpoint = NULL,
style = c("divergent", "sequential"),
...,
instr_pal,
instr_rev,
data_default = NULL,
type = c("fill", "color")) {
if (!is.null(midpoint)) checkmate::assert_numeric(midpoint)
if (!is.null(instr_pal)) checkmate::assert_character(instr_pal)
if (!is.null(instr_rev)) checkmate::assert_logical(instr_rev)
Expand Down Expand Up @@ -418,8 +426,7 @@ set_default_color_continuous <- function(
}


.evaluate_color_gradient_divergent <- function(
colors, reverse, midpoint, ..., grad2, grad, gradn) {
.evaluate_color_gradient_divergent <- function(colors, reverse, midpoint, ..., grad2, grad, gradn) {
if (is.null(midpoint)) midpoint <- 0

if (inherits(colors, "character")) {
Expand Down Expand Up @@ -465,8 +472,7 @@ set_default_color_continuous <- function(
gradient
}

.evaluate_color_gradient_sequential <- function(
colors, reverse, ..., gradn, grad) {
.evaluate_color_gradient_sequential <- function(colors, reverse, ..., gradn, grad) {
if (inherits(colors, "character")) {
if (length(colors) == 3L) {
# assume simple palette if 3 entries in vector
Expand Down Expand Up @@ -501,13 +507,12 @@ set_default_color_continuous <- function(

#' @rdname set_default_color_continuous
#' @export
set_default_color_continuous_cell <- function(
colors = NULL,
instrs,
midpoint = NULL,
style = "divergent",
...,
data_default = NULL) {
set_default_color_continuous_cell <- function(colors = NULL,
instrs,
midpoint = NULL,
style = "divergent",
...,
data_default = NULL) {
# read instructions
instr_pal <- readGiottoInstructions(instrs, "cell_color_c_pal", NULL)
instr_rev <- readGiottoInstructions(instrs, "cell_color_c_rev", NULL)
Expand All @@ -525,12 +530,11 @@ set_default_color_continuous_cell <- function(

#' @rdname set_default_color_continuous
#' @export
set_default_color_continuous_poly <- function(
colors = NULL,
instrs,
midpoint = NULL,
style = "divergent",
...) {
set_default_color_continuous_poly <- function(colors = NULL,
instrs,
midpoint = NULL,
style = "divergent",
...) {
# read instructions
instr_pal <- readGiottoInstructions(instrs, "poly_color_c_pal", NULL)
instr_rev <- readGiottoInstructions(instrs, "poly_color_c_rev", NULL)
Expand All @@ -548,12 +552,11 @@ set_default_color_continuous_poly <- function(

#' @rdname set_default_color_continuous
#' @export
set_default_color_continuous_heatmap <- function(
colors = NULL,
instrs,
midpoint = NULL,
style = "divergent",
...) {
set_default_color_continuous_heatmap <- function(colors = NULL,
instrs,
midpoint = NULL,
style = "divergent",
...) {
# read instructions
instr_pal <- readGiottoInstructions(instrs, "heatmap_color_pal", NULL)
instr_rev <- readGiottoInstructions(instrs, "heatmap_color_rev", NULL)
Expand All @@ -570,12 +573,11 @@ set_default_color_continuous_heatmap <- function(

#' @rdname set_default_color_continuous
#' @export
set_default_color_continuous_CCcom_heatmap <- function(
colors = NULL,
instrs,
midpoint = NULL,
style = "divergent",
...) {
set_default_color_continuous_CCcom_heatmap <- function(colors = NULL,
instrs,
midpoint = NULL,
style = "divergent",
...) {
# read instructions
instr_pal <- readGiottoInstructions(instrs, "CCcom_heatmap_color_pal", NULL)
instr_rev <- readGiottoInstructions(instrs, "CCcom_heatmap_color_rev", NULL)
Expand All @@ -595,16 +597,15 @@ set_default_color_continuous_CCcom_heatmap <- function(

#' @rdname set_default_color_continuous
#' @export
set_default_color_continuous_CCcom_dotplot <- function(
colors = NULL,
instrs,
midpoint = NULL,
style = "divergent",
...,
type = c("fill", "color"),
data_default = list(
pal = c("darkblue", "blue", "white", "red", "darkred")
)) {
set_default_color_continuous_CCcom_dotplot <- function(colors = NULL,
instrs,
midpoint = NULL,
style = "divergent",
...,
type = c("fill", "color"),
data_default = list(
pal = c("darkblue", "blue", "white", "red", "darkred")
)) {
# read instructions
instr_pal <- readGiottoInstructions(instrs, "CCcom_dotplot_color_pal", NULL)
instr_rev <- readGiottoInstructions(instrs, "CCcom_dotplot_color_rev", NULL)
Expand Down
17 changes: 8 additions & 9 deletions R/aux_output.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@
#' plot_output_handler(g, plot_object = g_spatplot, save_plot = FALSE)
#'
#' @export
plot_output_handler <- function(
gobject,
plot_object,
save_plot = NULL,
return_plot = NULL,
show_plot = NULL,
default_save_name = NULL,
save_param = list(),
else_return = NULL) {
plot_output_handler <- function(gobject,
plot_object,
save_plot = NULL,
return_plot = NULL,
show_plot = NULL,
default_save_name = NULL,
save_param = list(),
else_return = NULL) {
checkmate::assert_class(gobject, "giotto")

## output settings detection ##
Expand Down
Loading

0 comments on commit 96e5de4

Please sign in to comment.