Calculate and export flow cytometry statistics for a GatingSet.

# S4 method for GatingSet
cyto_stats_compute(x, alias = NULL,
  parent = NULL, channels = NULL, trans = NULL, stat = "median",
  density_smooth = 1.5, save = TRUE)

Arguments

x

object of class GatingSet.

alias

name(s) of the population(s) for which the statistic should be calculated.

parent

name(s) of the parent population(s) used calculate population frequencies. The frequency of alias in each parent will be returned as a percentage.

channels

names of of channels for which statistic should be calculated, set to all channels by default.

trans

object of class transformList or transformerList generated by estimateLogicle used to transform the fluorescent channels of x. The transformation list is required to apply the inverse transformation such that the required statistics are returned on the original linear scale.

stat

name of the statistic to calculate, options include "count", "freq", "median", "mode", "mean", "geo mean", "CV", or "freq".

density_smooth

smoothing parameter passed to density when calculating mode, set to 1.5 by default.

save

logical indicating whether statistical results should be saved to a csv file.

See also

Examples

library(CytoRSuiteData) # Load in samples fs <- Activation gs <- GatingSet(fs)
#> .
#> .
#> .
#> .
#> done!
# Apply compensation gs <- compensate(gs, fs[[1]]@description$SPILL) # Transform fluorescent channels trans <- estimateLogicle(gs[[4]], cyto_fluor_channels(gs)) gs <- transform(gs, trans) # Gate using gate_draw gt <- Activation_gatingTemplate gating(gt, gs)
#> Preprocessing for 'Cells'
#> Gating for 'Cells'
#> done.
#> Preprocessing for 'Single Cells'
#> Gating for 'Single Cells'
#> done.
#> Preprocessing for 'Live Cells'
#> Gating for 'Live Cells'
#> done.
#> Preprocessing for 'Dendritic Cells'
#> Gating for 'Dendritic Cells'
#> done.
#> Preprocessing for 'T Cells'
#> Gating for 'T Cells'
#> done.
#> Preprocessing for 'CD8 T Cells'
#> Gating for 'CD8 T Cells'
#> done.
#> Preprocessing for 'CD69+ CD8 T Cells'
#> Gating for 'CD69+ CD8 T Cells'
#> done.
#> Preprocessing for 'CD4 T Cells'
#> Gating for 'CD4 T Cells'
#> done.
#> Preprocessing for 'CD69+ CD4 T Cells'
#> Gating for 'CD69+ CD4 T Cells'
#> done.
#> finished.
# Compute statistics cyto_stats_compute(gs, alias = "T Cells", channels = c("Alexa Fluor 488-A", "PE-A"), stat = "median", save = FALSE )
#> $`T Cells` #> Alexa Fluor 488-A PE-A #> Activation1.fcs 4180.007 18403.25 #> Activation2.fcs 5425.652 18804.82 #> Activation3.fcs 6591.920 19982.24 #> Activation4.fcs 6640.713 20150.04 #>
cyto_stats_compute(gs, alias = "T Cells", stat = "geo mean", save = FALSE )
#> $`T Cells` #> FSC-A FSC-H FSC-W SSC-A SSC-H SSC-W #> Activation1.fcs 63148.35 56239.63 73586.73 16843.02 15607.64 70723.31 #> Activation2.fcs 64327.43 57226.32 73668.25 17327.90 15965.97 71126.35 #> Activation3.fcs 63909.59 56645.13 73940.67 17530.46 16083.35 71432.66 #> Activation4.fcs 68037.33 59457.69 74992.73 19594.85 17684.49 72615.49 #> Alexa Fluor 488-A PE-A PE-Texas Red-A 7-AAD-A PE-Cy7-A #> Activation1.fcs 1217.322 17341.62 137.51647 317.9252 42.42112 #> Activation2.fcs 1385.521 17718.57 94.35408 363.7834 48.84971 #> Activation3.fcs 1656.352 18853.10 78.29665 423.6506 41.93059 #> Activation4.fcs 1790.204 18974.67 71.80785 640.7608 47.10880 #> Alexa Fluor 405-A Alexa Fluor 430-A Qdot 605-A #> Activation1.fcs 57.90289 64.22004 513.5104 #> Activation2.fcs 64.14434 67.69243 543.4810 #> Activation3.fcs 69.36829 74.87729 608.3986 #> Activation4.fcs 77.96001 81.71592 613.3975 #> Alexa Fluor 647-A Alexa Fluor 700-A APC-Cy7-A Time #> Activation1.fcs 604.3573 391.3962 4.251436 2123.737 #> Activation2.fcs 615.4023 384.3474 4.379078 2005.908 #> Activation3.fcs 704.4741 347.3969 1.626191 1976.461 #> Activation4.fcs 949.2146 361.1098 6.565321 2086.956 #>
cyto_stats_compute(gs, alias = c("CD4 T Cells", "CD8 T Cells"), stat = "count", save = FALSE )
#> $`CD4 T Cells` #> count #> Activation1.fcs 1955 #> Activation2.fcs 2212 #> Activation3.fcs 2134 #> Activation4.fcs 2133 #> #> $`CD8 T Cells` #> count #> Activation1.fcs 2636 #> Activation2.fcs 3191 #> Activation3.fcs 3585 #> Activation4.fcs 3562 #>
cyto_stats_compute(gs, alias = c("CD4 T Cells", "CD8 T Cells"), parent = c("Live Cells", "T Cells"), stat = "freq", save = FALSE )
#> $`CD4 T Cells` #> count Live Cells T Cells #> Activation1.fcs 1955 13.08392 38.85135 #> Activation2.fcs 2212 13.44926 37.67672 #> Activation3.fcs 2134 12.58255 34.16040 #> Activation4.fcs 2133 12.83239 33.71799 #> #> $`CD8 T Cells` #> count Live Cells T Cells #> Activation1.fcs 2636 17.64155 52.38474 #> Activation2.fcs 3191 19.40171 54.35190 #> Activation3.fcs 3585 21.13797 57.38755 #> Activation4.fcs 3562 21.42943 56.30730 #>