| Title: | Automated gating pipeline for flow cytometry analysis to characterize the lineage, differentiation, and functional states of T-cells |
|---|---|
| Description: | An R-based automated gating pipeline for flow cytometry data designed to mimic the manual gating strategy of defining flow biomarker positive populations relative to a unimodal background population to include cells with varying intensities of marker expression. The pipeline’s main feature is a flexible density-based gating strategy capable of capturing varying scenarios based on marker expression patterns to analyze a 29-marker flow panel that characterizes T-cell lineage, differentiation, and functional states. |
| Authors: | Jasme Lee [aut, cre] (ORCID: <https://orcid.org/0009-0006-4492-4872>), Matthew Adamow [aut], Colleen Maher [aut], Xiyu Peng [aut], Phillip Wong [aut], Fiona Ehrich [aut], Michael A Postow [aut], Margaret K Callahan [aut], Ronglai Shen [aut], Katherine S Panageas [aut], V foundation [fnd], MSK-MIND [fnd], NIH R01CA276286 [fnd], NIH P30CA008748 [fnd] |
| Maintainer: | Jasme Lee <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.1.0 |
| Built: | 2026-05-30 09:45:10 UTC |
| Source: | https://github.com/bioc/staRgate |
path_biexp_params
The csv file at path_biexp_params should specify the channels to apply
the transformation to and the parameters
(negative decades, width basis and positive decades).
The default is negative decades=0.5, width basis=-30 and
positive decades=4.5.
The Transformation can be applied to only a subset of the channels
included in the GatingSet.
getBiexpTransformGS(gs, path_biexp_params)getBiexpTransformGS(gs, path_biexp_params)
gs |
GatingSet to apply Biexponential Transformation to |
path_biexp_params |
file path for .csv file that specifies the Biexponential Transformation |
An example table is provided in the extdata/biexp_transf_parameters_x50.csv
GatingSet with Biexponentially Transformed data
# This example does not contain all the pre-processing steps required in # getting the GatingSet (gs) ready for Biexp transformation. # To see the steps that are required to creating the (gs), # please see the vignette for a full tutorial # To make this a runnable example, read in the FCS file to create gs and # directly apply # File path to the FCS file path_fcs <- system.file("extdata", "example_fcs.fcs", package="staRgate", mustWork=TRUE) path_biexp_params <- system.file("extdata", "biexp_transf_parameters_x50.csv", package="staRgate", mustWork=TRUE) # Create a cytoset then convert to gs cs <- flowWorkspace::load_cytoset_from_fcs(path_fcs) gs <- flowWorkspace::GatingSet(cs) # gs must be a GatingSet object gs <- getBiexpTransformGS(gs, path_biexp_params=path_biexp_params) # To check the transformation parameters applied flowWorkspace::gh_get_transformations(gs)# This example does not contain all the pre-processing steps required in # getting the GatingSet (gs) ready for Biexp transformation. # To see the steps that are required to creating the (gs), # please see the vignette for a full tutorial # To make this a runnable example, read in the FCS file to create gs and # directly apply # File path to the FCS file path_fcs <- system.file("extdata", "example_fcs.fcs", package="staRgate", mustWork=TRUE) path_biexp_params <- system.file("extdata", "biexp_transf_parameters_x50.csv", package="staRgate", mustWork=TRUE) # Create a cytoset then convert to gs cs <- flowWorkspace::load_cytoset_from_fcs(path_fcs) gs <- flowWorkspace::GatingSet(cs) # gs must be a GatingSet object gs <- getBiexpTransformGS(gs, path_biexp_params=path_biexp_params) # To check the transformation parameters applied flowWorkspace::gh_get_transformations(gs)
path_comp_mat
The csv file at path_comp_mat should specify the channels to apply
the compensation to. The format is a matrix where the col and row names
correspond to the channel names
getCompGS(gs, path_comp_mat)getCompGS(gs, path_comp_mat)
gs |
GatingSet to apply Biexponential Transformation to |
path_comp_mat |
file path for .csv file that specifies the Compensation Matrix |
An example matrix is provided in the extdata/comp_mat_example_fcs.csv
GatingSet with compensated data
# This example does not contain all the pre-processing steps required in # getting the GatingSet (gs) ready for compensation step # To see the steps that are required to creating the (gs), # please see the vignette for a full tutorial # To make this a runnable example, read in the FCS file to create gs and # directly apply # File path to the FCS file path_fcs <- system.file("extdata", "example_fcs.fcs", package="staRgate", mustWork=TRUE) path_biexp_params <- system.file("extdata", "biexp_transf_parameters_x50.csv", package="staRgate", mustWork=TRUE) # Create a cytoset then convert to gs cs <- flowWorkspace::load_cytoset_from_fcs(path_fcs) gs <- flowWorkspace::GatingSet(cs) path_comp_mat <- system.file("extdata", "comp_mat_example_fcs.csv", package="staRgate", mustWork=TRUE) # gs is a GatingSet object gs <- getCompGS(gs, path_comp_mat=path_comp_mat) # Checks the comp mat was successfully applied flowWorkspace::gh_get_compensations(gs)# This example does not contain all the pre-processing steps required in # getting the GatingSet (gs) ready for compensation step # To see the steps that are required to creating the (gs), # please see the vignette for a full tutorial # To make this a runnable example, read in the FCS file to create gs and # directly apply # File path to the FCS file path_fcs <- system.file("extdata", "example_fcs.fcs", package="staRgate", mustWork=TRUE) path_biexp_params <- system.file("extdata", "biexp_transf_parameters_x50.csv", package="staRgate", mustWork=TRUE) # Create a cytoset then convert to gs cs <- flowWorkspace::load_cytoset_from_fcs(path_fcs) gs <- flowWorkspace::GatingSet(cs) path_comp_mat <- system.file("extdata", "comp_mat_example_fcs.csv", package="staRgate", mustWork=TRUE) # gs is a GatingSet object gs <- getCompGS(gs, path_comp_mat=path_comp_mat) # Checks the comp mat was successfully applied flowWorkspace::gh_get_compensations(gs)
marker for each unique subset of
subset_col
For each unique value in subset_col, gate using density and estimated
derivatives to identify cutoff at shoulder (i.e., point of tapering off)
relative to the peak for marker (intensity values).
The strategy of cutting at the shoulder mimics the strategy to gate
relative to a unimodal background negative subpopulation, which is capable
of capturing dim subpopulations.
getDensityGates( intens_dat, marker, subset_col, bin_n = 512, peak_detect_ratio = 10, pos_peak_threshold = 1800, neg_intensity_threshold = -1000 )getDensityGates( intens_dat, marker, subset_col, bin_n = 512, peak_detect_ratio = 10, pos_peak_threshold = 1800, neg_intensity_threshold = -1000 )
intens_dat |
dataframe of pre-gated (compensated, biexp. transf, openCyto steps) intensity values where cols=intensity value per marker, rows=each sample |
marker |
string for the marker(s) to gate on the names need to match
exactly the column name in |
subset_col |
string for the column name to indicate the subsets to apply density gating on will perform operation on subsets corresponding to each unique value in column |
bin_n |
numeric to be passed to |
peak_detect_ratio |
numeric threshold for eliminating small peaks where
a peak that is < than the highest peak by |
pos_peak_threshold |
either:
Default is 1800 (note this is on the biexponential scale) for all |
neg_intensity_threshold |
numeric for threshold to filter out any
"very negatively" expressed cells in the density estimation to
avoid over-compression and difficulty in distinguishing peaks
and the gates |
tibble of gates/cutoffs for marker for each unique subset found
in subset_col where
rows correspond to unique values in subset_col
, columns correspond tomarker
# Create a fake dataset set.seed(100) intens_dat<-tibble::tibble( CD3_pos=rep(c(0, 1), each=50), CD4=rnorm(100, 100, 10), CD8=rnorm(100, 100, 10) ) # Run density gating, leaving other params at suggested defaults # number of bins suggested is 40 but default is at `bin_n=512`, # which is the default for the R base density() function getDensityGates(intens_dat, marker="CD4", subset_col="CD3_pos", bin_n=40)# Create a fake dataset set.seed(100) intens_dat<-tibble::tibble( CD3_pos=rep(c(0, 1), each=50), CD4=rnorm(100, 100, 10), CD8=rnorm(100, 100, 10) ) # Run density gating, leaving other params at suggested defaults # number of bins suggested is 40 but default is at `bin_n=512`, # which is the default for the R base density() function getDensityGates(intens_dat, marker="CD4", subset_col="CD3_pos", bin_n=40)
intens_dat based on gates provided in cutoffs
Adds an indicator column (0/1) to intens_dat for each marker in cutoffs
as indicated by the columns in cutoffs
getGatedDat(intens_dat, cutoffs, subset_col)getGatedDat(intens_dat, cutoffs, subset_col)
intens_dat |
dataframe of pre-gated (compensated, biexp. transf, openCyto steps) intensity values where rows=each cell and cols are the intensity values for each marker |
cutoffs |
tibble of gates/cutoffs for all markers to gate |
subset_col |
string for the column name to indicate the subsets to apply density gating on will perform operation on subsets corresponding to each unique value in column |
The naming convention for the tagged on indicator columns will be
tolower(<marker_name>_pos) where
0 indicates negativity or intensity < gate provided
1 indicates positivity or intensity > gate provided
intens_dat with additional columns attached for each marker
in cutoffs
# Create a fake dataset set.seed(100) intens_dat <- tibble::tibble( CD3_pos=rep(c(0, 1), each=50), CD4=rnorm(100, 100, 10), CD8=rnorm(100, 100, 10) ) # Run getDensityGates to obtain the gates gates <- getDensityGates(intens_dat, marker="CD4", subset_col="CD3_pos", bin_n=40) # Tag on the 0/1 on intens_dat intens_dat_2 <- getGatedDat(intens_dat, cutoffs=gates, subset_col="CD3_pos") # intens_dat_2 now has the cd4_pos tagged on head(intens_dat_2)# Create a fake dataset set.seed(100) intens_dat <- tibble::tibble( CD3_pos=rep(c(0, 1), each=50), CD4=rnorm(100, 100, 10), CD8=rnorm(100, 100, 10) ) # Run getDensityGates to obtain the gates gates <- getDensityGates(intens_dat, marker="CD4", subset_col="CD3_pos", bin_n=40) # Tag on the 0/1 on intens_dat intens_dat_2 <- getGatedDat(intens_dat, cutoffs=gates, subset_col="CD3_pos") # intens_dat_2 now has the cd4_pos tagged on head(intens_dat_2)
Expects data input same as the output from get_gated_dat with indicator
columns of specific naming convention (see below).
getPerc( intens_dat, num_marker, denom_marker, expand_num = FALSE, expand_denom = FALSE, keep_indicators = TRUE )getPerc( intens_dat, num_marker, denom_marker, expand_num = FALSE, expand_denom = FALSE, keep_indicators = TRUE )
intens_dat |
dataframe of gated data with indicator columns per
marker of interest
(specify in |
num_marker |
string for the marker(s) to specify the numerator for
subpopulations of interest |
denom_marker |
string for the marker(s) to specify the denominator for
subpopulations of interest |
expand_num |
logical, only accepts |
expand_denom |
logical, only accepts |
keep_indicators |
logical, only accepts |
The subpopulations are defined as (num marker(s)) out of (denom marker(s)) where num denotes numerator, and denom denotes denominator (these shorthands are used in the function arguments)
tibble containing the percentage of cells where
rows correspond to each subpopulation specified in the subpopulation,
n_num indicates the number of cells that satisifies the numerator conditions,
n_denom indicates the number of cells that satisifies the denominator conditions,
perc=n_num divided by n_denom unless n_denom=0, then perc=NA_real_
library(dplyr) # Create a fake dataset set.seed(100) intens_dat <- tibble::tibble( CD3_pos=rep(c(0, 1), each=50), CD4=rnorm(100, 100, 10), CD8=rnorm(100, 100, 10) ) # Run getDensityGates to obtain the gates gates <- getDensityGates(intens_dat, marker="CD4", subset_col="CD3_pos", bin_n=40) # Tag on the 0/1 on intens_dat intens_dat_2 <- getGatedDat(intens_dat, cutoffs=gates, subset_col="CD3_pos") # Get percentage for CD4 based on gating getPerc(intens_dat_2, num_marker=c("CD4"), denom_marker="CD3")library(dplyr) # Create a fake dataset set.seed(100) intens_dat <- tibble::tibble( CD3_pos=rep(c(0, 1), each=50), CD4=rnorm(100, 100, 10), CD8=rnorm(100, 100, 10) ) # Run getDensityGates to obtain the gates gates <- getDensityGates(intens_dat, marker="CD4", subset_col="CD3_pos", bin_n=40) # Tag on the 0/1 on intens_dat intens_dat_2 <- getGatedDat(intens_dat, cutoffs=gates, subset_col="CD3_pos") # Get percentage for CD4 based on gating getPerc(intens_dat_2, num_marker=c("CD4"), denom_marker="CD3")