getProp,GatingHierarchy,character-method {flowWorkspace} | R Documentation

## Return a table of population statistics for all populations in a GatingHierarchy/GatingSet or the population proportions or the total number of events of a node (population) in a GatingHierarchy

### Description

getProp calculates the population proportion (events in the gate / events in the parent population) associated with a node in the `GatingHierarchy`. getPopStats is more useful than getPop. Returns a table of population statistics for all populations in a `GatingHierarchy`/`GatingSet`. Includes the xml counts, openCyto counts and frequencies. getTotal returns the total number of events in the gate defined in the GatingHierarchy object

### Usage

    ## S4 method for signature 'GatingHierarchy,character'
    getProp(x, y, xml = FALSE)

    ## S4 method for signature 'GatingHierarchy,character'
    getTotal(x, y, xml = FALSE)

    ## S4 method for signature 'GatingHierarchy'
    getPopStats(x, path = "auto", ...)

    ## S4 method for signature 'GatingSet'
    getPopStats(x, statistic = c("freq", "count"),
      xml = FALSE, subpopulations = NULL, format = c("long", "wide"),
      path = "full", ...)

    ## S4 method for signature 'GatingSetList'
    getPopStats(x, format = c("long", "wide"), ...)

### Arguments

`x` | A `GatingHierarchy` or `GatingSet`
`y` | `character` node name or path
`xml` | `logical` indicating whether the statistics come from xml (if parsed from xml workspace) or from openCyto.
`path` | `character` see getNodes
`...` | Additional arguments passed to getNodes
`statistic` | `character` specifies the type of population statistics to extract.(only valid when format is "wide"). Either "freq" or "count" is currently supported.
`subpopulations` | `character` vector to specify a subset of populations to return. (only valid when format is "long")
`format` | `character` value of c("wide", "long") specifing whether to origanize the output in long or wide format

### Details

getPopStats returns a table population statistics for all populations in the gating hierarchy. The output is useful for verifying that the import was successful, if the xml and openCyto derived counts don't differ much (i.e. if they have a small coefficient of variation.) for a GatingSet, returns a matrix of proportions for all populations and all samples getProp returns the proportion of cells in the gate, relative to its parent. getTotal returns the total number of events included in this gate. The contents of "thisTot" variable in the "metadata" environment of the `nodeData` element associated with the gating tree and gate / population.

### Value

getPopStats returns a `data.frame` with columns for the population name, xml derived counts, openCyto derived counts, and the population proportions (relative to their parent pouplation). getProp returns a population frequency `numeric`. getTotal returns a `numeric` value of the total number of elements in the population.

### See Also

`getNodes`

### Examples

            ## Not run:
            #gh is a GatingHierarchy
            getPopStats(gh);
            #proportion for the fifth population
            getProp(gh,getNodes(gh)[5])
            getTotal(gh,getNodes(gh,tsort=T)[5])

            #gs is a GatingSet
            getPopStats(gs)
            #optionally output in long format as a data.table
            getPopStats(gs, format = "long", path = "auto")
            #only get stats for a subset of populations
            getPopStats(gs, format = "long", subpopulations = getNodes(gs)[4:6])

    ## End(Not run)

[Package flowWorkspace version 3.32.0 Index]