Last data update: 2014.03.03

R: compute the statistics of the cell population defined by...
compute_statsR Documentation

compute the statistics of the cell population defined by gates

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

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

Arguments

fs

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

gates

a list of filters

type

can be "percent", "count" or "MFI".

value

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

data_range

the data range for each channels

...

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

data(GvHD)
fs <- GvHD[1:4]
rect.g <- rectangleGate(list("FSC-H" =  c(300,500), "SSC-H" = c(50,200)))
rect.gates <- sapply(sampleNames(fs), function(sn)rect.g)
compute_stats(fs, rect.gates)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ggcyto)
Loading required package: ggplot2
Loading required package: flowCore
Loading required package: ncdfFlow
Loading required package: flowViz
Loading required package: lattice
Loading required package: RcppArmadillo
Loading required package: BH
Loading required package: flowWorkspace
Loading required package: gridExtra
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/ggcyto/compute_stats.Rd_%03d_medium.png", width=480, height=480)
> ### Name: compute_stats
> ### Title: compute the statistics of the cell population defined by gates
> ### Aliases: compute_stats
> 
> ### ** Examples
> 
> data(GvHD)
> fs <- GvHD[1:4]
> rect.g <- rectangleGate(list("FSC-H" =  c(300,500), "SSC-H" = c(50,200)))
> rect.gates <- sapply(sampleNames(fs), function(sn)rect.g)
> compute_stats(fs, rect.gates)
   .rownames FSC-H SSC-H  FL1-H  FL2-H  FL3-H FL2-A  FL4-H  Time density
1:     s5a01   400   125 5000.5 5000.5 5000.5 511.5 5000.5 511.5   5e-05
2:     s5a02   400   125 5000.5 5000.5 5000.5 511.5 5000.5 511.5   5e-05
3:     s5a03   400   125 5000.5 5000.5 5000.5 511.5 5000.5 511.5   5e-05
4:     s5a04   400   125 5000.5 5000.5 5000.5 511.5 5000.5 511.5   5e-05
   percent Patient Visit Days Grade  name
1:   17.4%       5     1   -6     3 s5a01
2:   16.0%       5     2    0     3 s5a02
3:   33.0%       5     3    6     3 s5a03
4:   37.1%       5     4   12     3 s5a04
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>