Skip to content

Commit

Permalink
Support instrument ranges in cyto_plot_calibarte().
Browse files Browse the repository at this point in the history
  • Loading branch information
djhammill committed May 13, 2024
1 parent ab679d5 commit d06b32b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: CytoExploreR
Type: Package
Title: Interactive Analysis of Cytometry Data
Version: 2.0.5
Version: 2.0.6
Date: 2024-04-10
Authors@R: c(
person("Dillon", "Hammill", role = c("aut", "cre"), email = "[email protected]"),
Expand Down
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# CytoExploreR 2.0.6 (pre-release)
# CytoExploreR 2.0.7 (pre-release)

* The behavior of `cyto_merge_by()` when `merge_by = NA` has changed from collapsing all samples to instead split samples individually. This is because splitting by `name` may not always work in cases where multiple samples share the same file names. This change requires updates to openCyto which should be re-installed when updating to the new version of CytoExploreR.

# CytoExploreR 2.0.6

* `cyto_plot_calibrate()` can now use the full instrument ranges for calibration through `type = "instrument"`.

# CytoExploreR 2.0.5

* `cyto_import()` has gained a logical `nodes` argument that allows for bypassing of the unique nodes test and renaming (it can be temperamental for complex node names).
Expand Down
36 changes: 28 additions & 8 deletions R/cyto_plot-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -2035,12 +2035,14 @@ cyto_plot_layout <- function(...){
#' extract samples that should be used to calibrate the channels, set to NULL
#' by default to calibrate channels using data from all samples.
#' @param type indicates the type of calibration to perform, options include
#' \code{"range"} or \code{"quantile"}, set to \code{"quantile"} by default.
#' Range calibration simply uses the full range of values across samples for
#' the calibration. Quantile calibration computes an lower and upper quantile
#' for each channel, values falling outside the calibration range are assigned
#' the bottom or top colour. Alternatively, users can also supply their own
#' custom calibration function to \code{type} that accepts a matrix.
#' \code{"instrument"}, \code{"range"} or \code{"quantile"}, set to
#' \code{"quantile"} by default. Instrument calibartion uses the full
#' instrument range in each channel for calibration. Range calibration simply
#' uses the full range of values across samples for the calibration. Quantile
#' calibration computes an lower and upper quantile for each channel, values
#' falling outside the calibration range are assigned the bottom or top
#' colour. Alternatively, users can also supply their own custom calibration
#' function to \code{type} that accepts a matrix.
#' @param probs vector of lower and upper probabilities passed to
#' \code{stats:quantile} to compute quantiles, set to \code{c(0.01, 0.99)} by
#' default.
Expand Down Expand Up @@ -2183,8 +2185,26 @@ cyto_plot_calibrate <- function(x,
}
# ONLY COMPUTE LIMITS IF NOT SUPPLIED
if(any(is.na(z))) {
# RANGE
if(grepl("^r", type, ignore.case = TRUE)) {
# INSTRUMENT|MACHINE
if(grepl("^i|^m", type, ignore.case = TRUE)) {
res <- cyto_apply(
x,
function(w) {
range(
w,
"instrument"
)
},
select = 1,
parent = parent,
channels = channels[cnt],
input = "cytoframe",
inverse = FALSE,
copy = FALSE,
...
)
# RANGE|DATA
} else if(grepl("^r|^d", type, ignore.case = TRUE)) {
res <- cyto_apply(
x,
"cyto_stat_range",
Expand Down
14 changes: 8 additions & 6 deletions man/cyto_plot_calibrate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d06b32b

Please sign in to comment.