flowDensity {flowDensity} | R Documentation

## Methods for Function `flowDensity` in Package flowDensity

### Description

flowDensity is an automated clustering algorithm which aims to emulate the current practice of manual sequential gating. It is designed to identify the predefined cell subsets based on the density distribution of the parent cell population by analyzing the peaks of the density curve.

When the density distribution has only one peak:

- the first argument that would be used is the percentile, the default value is 95th.

- If set to 'NA' then upper will be used when set to 'FALSE/TRUE'.

- If both upper and percentiles are set to 'NA' sd.threshold is used when set to 'TRUE'.

- If either all these arguments are 'NA', or one of them fails, the algorithm find the best cutoff based on the inflection points and by comparing the position of the peak and the mean of the population.

### Usage

    	flowDensity(obj, channels, position,node, ...)

### Arguments

`obj` | a 'CellPopulation', 'flowFrame' or 'GatingHierarchy' object.
`channels` | a vector of two channel names or their corresponding indices.
`position` | a vector of two logical values specifying the position of the cell subset of interest on the 2D plot.
`node` | A character defining the parent population when extracting data from GatingHierarchy.
`...` | This can be used to pass one of the following arguments: 'use.percentile' if TRUE, returns the 'percentile'th threshold. 'percentile' a value in [0,1] that is used as the percentile if 'use.percentile' is TRUE. 'upper' if 'TRUE', it finds the change in the slope after the peak with index 'peak.ind'. 'use.upper' if 'TRUE', forces to return the inflection point based on the first (last) peak if upper=F (upper=T) 'twin.factor' a value in [0,1] that is used to exclude twinpeaks. 'bimodal' If TRUE, it returns a cutoff that splits population closer to 50-50, when there are more than two peaks. 'after.peak' If TRUE, it returns a cutoff that is after the maximum peaks, when there are more than two peaks. 'sd.threshold' if TRUE, it uses 'n.sd' times standard deviation for gating. 'n.sd' an integer that is multiplied to the standard deviation to determine the place of threshold if 'sd.threshold' is 'TRUE'. 'tinypeak.removal' a vector of length 2, for sensitivity of peak finding for each channel. See deGate() for more information. 'filter' If provided it uses the given filter to gate the population. 'use.control' if TRUE, it finds the threshold using a matched control population and uses it for gating. 'control' a 'flowFrame' or 'CellPopulation' object used for calculating the gating threshold when 'use.control' is set to TRUE. If a control population is used, the other arguments ('upper', 'percentile', etc.) are applied to the control data when finding the threshold (i.e. not to 'obj'). 'alpha' a value in [0,1) specifying the significance of change in the slope which would be detected. This is by default 0.1, and typically need not be changed. 'ellip.gate' if TRUE, it fits an ellipse on the data as a gate, otherwise the rectangle gating results are returned 'scale' a value in [0,1) that scales the size of ellipse to fit if 'ellip.gate' is TRUE

### Value

A CellPopulation object

### Author(s)

Mehrnoush Malek <mmalekes@bccrc.ca> Jafar Taghiyar <jtaghiyar@bccrc.ca>

### See Also

`deGate` `getflowFrame` `notSubFrame`

### Examples

    data_dir <- system.file("extdata", package = "flowDensity")
    load(list.files(pattern = 'sampleFCS_1', data_dir, full = TRUE))
    lymph <- flowDensity(obj=f, channels=c('FSC-A', 'SSC-A'),
                         position=c(TRUE, FALSE), upper= c(NA, TRUE), debris.gate=c(TRUE, FALSE))
    slotNames(lymph)

[Package flowDensity version 1.16.1 Index]