Compute, export and save statistics
# S3 method for GatingSet cyto_stats_compute( x, alias = NULL, parent = NULL, channels = NULL, trans = NA, stat = "median", format = "long", save_as = NULL, select = NULL, density_smooth = 0.6, ... ) # S3 method for GatingHierarchy cyto_stats_compute( x, alias = NULL, parent = NULL, channels = NULL, trans = NA, stat = "median", format = "long", save_as = NULL, density_smooth = 0.6, ... ) # S3 method for flowSet cyto_stats_compute( x, channels = NULL, trans = NA, stat = "median", gate = NA, format = "long", select = NULL, density_smooth = 0.6, ... ) # S3 method for flowFrame cyto_stats_compute( x, channels = NULL, trans = NA, stat = "median", gate = NA, format = "long", density_smooth = 0.6, ... )
x | object of class |
---|---|
alias | name(s) of the population(s) for which the statistic should be
calculated when a |
parent | name(s) of the parent population(s) used calculate population
frequencies when a |
channels | names of of channels for which statistic should be calculated, set to all channels by default. |
trans | object of class
|
stat | name of the statistic to calculate, options include
|
format | indicates whether the data should be returned in the
|
save_as | name of a csv file to which the statistical results should be saved. |
select | named list containing experimental variables to be used to
select samples using |
density_smooth | smoothing parameter passed to
|
... | not in use. |
gate | object of class |
a tibble containing the computed statistics in the wide or long format.
Dillon Hammill, Dillon.Hammill@anu.edu.au
library(CytoExploreRData) # Load in samples fs <- Activation gs <- GatingSet(fs) # Apply compensation gs <- compensate(gs, fs[[1]]@description$SPILL) # Transform fluorescent channels trans <- estimateLogicle(gs[[32]], cyto_fluor_channels(gs)) gs <- transform(gs, trans) # Gate using cyto_gate_draw gt <- Activation_gatingTemplate gt_gating(gt, gs)#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#># Compute statistics - median cyto_stats_compute(gs, alias = "T Cells", channels = c("Alexa Fluor 488-A", "PE-A"), stat = "median", save = FALSE )#> # A tibble: 66 x 6 #> name OVAConc Treatment Population Marker MedFI #> <fct> <chr> <chr> <chr> <chr> <dbl> #> 1 Activation_1.fcs 0 Stim-A T Cells CD8 1501. #> 2 Activation_1.fcs 0 Stim-A T Cells Va2 17651. #> 3 Activation_2.fcs 0 Stim-A T Cells CD8 2238. #> 4 Activation_2.fcs 0 Stim-A T Cells Va2 18608. #> 5 Activation_3.fcs 5 Stim-A T Cells CD8 1541. #> 6 Activation_3.fcs 5 Stim-A T Cells Va2 18946. #> 7 Activation_4.fcs 5 Stim-A T Cells CD8 567. #> 8 Activation_4.fcs 5 Stim-A T Cells Va2 19885. #> 9 Activation_5.fcs 50 Stim-A T Cells CD8 1074. #> 10 Activation_5.fcs 50 Stim-A T Cells Va2 20104. #> # ... with 56 more rows# Compute statistics for experimental group cyto_stats_compute(gs, alias = "T Cells", channels = c("Alexa Fluor 488-A", "PE-A"), stat = "median", save = FALSE, select = list(Treatment = "Stim-A") )#> # A tibble: 16 x 6 #> name OVAConc Treatment Population Marker MedFI #> <fct> <chr> <chr> <chr> <chr> <dbl> #> 1 Activation_1.fcs 0 Stim-A T Cells CD8 1501. #> 2 Activation_1.fcs 0 Stim-A T Cells Va2 17651. #> 3 Activation_2.fcs 0 Stim-A T Cells CD8 2238. #> 4 Activation_2.fcs 0 Stim-A T Cells Va2 18608. #> 5 Activation_3.fcs 5 Stim-A T Cells CD8 1541. #> 6 Activation_3.fcs 5 Stim-A T Cells Va2 18946. #> 7 Activation_4.fcs 5 Stim-A T Cells CD8 567. #> 8 Activation_4.fcs 5 Stim-A T Cells Va2 19885. #> 9 Activation_5.fcs 50 Stim-A T Cells CD8 1074. #> 10 Activation_5.fcs 50 Stim-A T Cells Va2 20104. #> 11 Activation_6.fcs 50 Stim-A T Cells CD8 2222. #> 12 Activation_6.fcs 50 Stim-A T Cells Va2 20075. #> 13 Activation_7.fcs 500 Stim-A T Cells CD8 4823. #> 14 Activation_7.fcs 500 Stim-A T Cells Va2 20493. #> 15 Activation_8.fcs 500 Stim-A T Cells CD8 4369. #> 16 Activation_8.fcs 500 Stim-A T Cells Va2 20926.# Compute population frequencies and save to csv file cyto_stats_compute(gs, alias = c("CD4 T Cells", "CD8 T Cells"), parent = c("Live Cells", "T Cells"), stat = "freq", save_as = "Population-Frequencies" )#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#> # A tibble: 132 x 6 #> name OVAConc Treatment Population Parent Frequency #> <fct> <chr> <chr> <chr> <chr> <dbl> #> 1 Activation_1.fcs 0 Stim-A CD4 T Cells Live Cells 13.3 #> 2 Activation_1.fcs 0 Stim-A CD8 T Cells Live Cells 16.1 #> 3 Activation_1.fcs 0 Stim-A CD4 T Cells T Cells 41.2 #> 4 Activation_1.fcs 0 Stim-A CD8 T Cells T Cells 49.8 #> 5 Activation_2.fcs 0 Stim-A CD4 T Cells Live Cells 15.0 #> 6 Activation_2.fcs 0 Stim-A CD8 T Cells Live Cells 18.3 #> 7 Activation_2.fcs 0 Stim-A CD4 T Cells T Cells 41.2 #> 8 Activation_2.fcs 0 Stim-A CD8 T Cells T Cells 50.2 #> 9 Activation_3.fcs 5 Stim-A CD4 T Cells Live Cells 14.9 #> 10 Activation_3.fcs 5 Stim-A CD8 T Cells Live Cells 18.1 #> # ... with 122 more rows