compute_stats: compute the statistics of the cell population defined by...

Description Usage Arguments Details Value Examples

View source: R/compute_stats.R

Description

It calls the underlining stats routine and merge it with the label position calculated by stat_position as well as the pData of flowSet.

Usage

1
compute_stats(fs = NULL, gates, type = "percent", value = NULL, ...)

Arguments

fs

flowSet. can be NULL when precaculated 'value' is provided

gates

a list of filters

type

a vector of strings to specify the stats types. can be any or multiple values of "percent", "count", "gate_name", or "MFI" (MFI is currently not supported yet).

value

the pre-calculated stats value. when supplied, the stats computing is skipped.

...

other arguments passed to stat_position function

Details

This function is usually not called directly by user but used by ggcyto when geom_stat layer is added.

Value

a data.table that contains percent and centroid locations as well as pData that used as data for geom_btext layer.

Examples

1
2
3
4
5
6
data(GvHD)
fs <- GvHD[1:4]
rect.g <- rectangleGate(list("FSC-H" =  c(300,500), "SSC-H" = c(50,200)), filterId = "P1")
rect.gates <- sapply(sampleNames(fs), function(sn)rect.g)
compute_stats(fs, rect.gates)
compute_stats(fs, rect.gates, type = c("gate_name", "percent"))

Example output

Loading required package: ggplot2
Loading required package: flowCore
Loading required package: ncdfFlow
Loading required package: RcppArmadillo
Loading required package: BH
Loading required package: flowWorkspace
As part of improvements to flowWorkspace, some behavior of
GatingSet objects has changed. For details, please read the section
titled "The cytoframe and cytoset classes" in the package vignette:

  vignette("flowWorkspace-Introduction", "flowWorkspace")
   .rownames FSC-H SSC-H value Patient Visit Days Grade  name
1:     s5a01   400   125 17.5%       5     1   -6     3 s5a01
2:     s5a02   400   125 16.0%       5     2    0     3 s5a02
3:     s5a03   400   125 33.2%       5     3    6     3 s5a03
4:     s5a04   400   125 37.1%       5     4   12     3 s5a04
   .rownames FSC-H SSC-H     value Patient Visit Days Grade  name
1:     s5a01   400   125 P1\n17.5%       5     1   -6     3 s5a01
2:     s5a02   400   125 P1\n16.0%       5     2    0     3 s5a02
3:     s5a03   400   125 P1\n33.2%       5     3    6     3 s5a03
4:     s5a04   400   125 P1\n37.1%       5     4   12     3 s5a04

ggcyto documentation built on Nov. 8, 2020, 5:30 p.m.