Skip to content

Commit

Permalink
Changes to size scaling method for dot and split dot plots.
Browse files Browse the repository at this point in the history
  • Loading branch information
travis-m-blimkie committed Apr 25, 2024
1 parent 5a0611e commit ea922f2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ABCindex
Title: A Shiny app to calculate ABCI for checkerboard assays
Version: 0.99.80
Version: 0.99.801
Authors@R:
person(given = "Travis",
family = "Blimkie",
Expand Down
2 changes: 1 addition & 1 deletion R/2_upload.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ abci_analysis_single <- function(
)

if (!normalize) {
if (max(data_clean[[col.data]]) >= 50) {
if (max(data_clean[[col.data]]) - min(data_clean[[col.data]]) > 10) {
data_clean[[col.data]] <- data_clean[[col.data]] / 100
}
}
Expand Down
34 changes: 18 additions & 16 deletions R/3_results.R
Original file line number Diff line number Diff line change
Expand Up @@ -544,12 +544,14 @@ plot_dot <- function(

# Fix up the variable being mapped to size. Define labels and breaks.
data <- data %>%
group_by(.data[[col.analysis]]) %>%
mutate(
across(all_of(c(x.drug, y.drug)), forcats::fct_inseq),
reference = ceiling(scales::rescale(.data[[col.size]], to = c(0, 100)))
reference = ifelse(
test = ceiling(.data[[col.size]] * 100) <= 100,
yes = ceiling(.data[[col.size]] * 100),
no = 100
)
) %>%
ungroup() %>%
left_join(size_mapping, by = "reference")

proper_labels <- seq(0, 100, 20)
Expand Down Expand Up @@ -830,12 +832,14 @@ plot_dot_split <- function(

# Fix up the variable being mapped to size. Define labels and breaks.
data <- data %>%
group_by(.data[[col.analysis]]) %>%
mutate(
across(all_of(c(x.drug, y.drug)), forcats::fct_inseq),
reference = ceiling(scales::rescale(.data[[col.size]], to = c(0, 100)))
reference = ifelse(
test = ceiling(.data[[col.size]] * 100) <= 100,
yes = ceiling(.data[[col.size]] * 100),
no = 100
)
) %>%
ungroup() %>%
left_join(size_mapping, by = "reference")

proper_labels <- seq(0, 100, 20)
Expand All @@ -849,13 +853,11 @@ plot_dot_split <- function(
if (!large.effect) {
data <- mutate(data, large_chr = rep(0))
} else {
data <- data %>%
mutate(
large_chr = ifelse(
(effect_avg > large.effect.val & data[[col.fill]] > abci.val),
yes = 1,
no = 0)
)
data <- mutate(data, large_chr = ifelse(
test = (effect_avg > large.effect.val & data[[col.fill]] > abci.val),
yes = 1,
no = 0
))
}

# MICs are calculated by `get_mic()` and converted to positions on the axes
Expand Down Expand Up @@ -976,9 +978,9 @@ plot_dot_split <- function(
x,
col_size = scales::rescale(N1S2, to = size.range),
col_size = ifelse(
!is.na(col_fill),
col_size,
0
test = !is.na(col_fill),
yes = col_size,
no = 0
)
)
})
Expand Down

0 comments on commit ea922f2

Please sign in to comment.