The goal of UtilsCytoRSV
is to facilitate common data processing and
visualisation tasks regarding cytometry data (with CyTOF and flow in
mind).
You can install UtilsCytoRSV
from GitHub with:
if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")
remotes::install_github("SATVILab/UtilsCytoRSV")
library(UtilsCytoRSV)
Subtract background.
.data_test <- data.frame(
pid = rep(c("a", "b"), each = 3),
stim = c("mtb", "ebv", "uns") |>
c("uns", "ebv", "mtb"),
resp1 = 1:6,
resp2 = 17:12 * 2
)
data_out <- subtract_background(
.data = .data_test,
grp = "pid",
stim = "stim",
uns = "uns",
resp = c("resp1", "resp2"),
remove_uns = FALSE
)
#> [1] "resp1"
#> [1] "resp2"
Sum over marker(s).
data("data_count")
data_test <- data_count |>
calc_prop(den = "count_pop_den",
num = "count_pop_num") |>
dplyr::select(-c(count_pop_den, count_pop_num)) |>
dplyr::arrange(SubjectID, VisitType, stim, cyt_combn)
data_out <- sum_over_markers(
.data = data_test,
grp = c("SubjectID", "VisitType", "stim"),
cmbn = "cyt_combn",
markers_to_sum = c("IFNg", "IL2", "IL17"),
levels = c("-", "+"),
resp = "prop"
)
It provides a 2D hex plot with useful defaults.
if (!requireNamespace("flowCore", quietly = TRUE)) {
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
BiocManager::install("flowCore")
}
library(UtilsCytoRSV)
suppressWarnings(data("GvHD", package = "flowCore"))
ex_tbl <- flowCore::exprs(GvHD[[1]]) |>
tibble::as_tibble()
marker <- c("FL2-H", "FL3-H")
plot_cyto(
data = ex_tbl,
marker = marker
)
The ranges can be made equal between the x- and y-axes.
plot_cyto(
data = ex_tbl,
marker = marker,
limits_equal = TRUE
)
Each axis can be forced to include particular values (especially useful if viewing gated data, which may have only positive-expressing cells and you then want to show that there are no negative-expressing cells).
plot_cyto(
data = ex_tbl,
marker = marker,
limits_expand = list(y = -5e3)
)
You can get a vector to label channels based on the FCS file using
chnl_lab
, and then supply this to plot_cyto
to have better axis
labels. Note that the inverse function, marker_lab
, is also available
to convert from markers to channels.
chnl_lab <- chnl_lab(GvHD)
plot_cyto(
data = ex_tbl,
marker = marker,
lab = chnl_lab,
limits_equal = TRUE
)