gate_mindensity: Determines a cutpoint as the minimum point of a kernel...

Description Usage Arguments Details Value Examples

View source: R/gating-functions.R

Description

We fit a kernel density estimator to the cells in the flowFrame and identify the two largest peaks. We then select as the cutpoint the value at which the minimum density is attained between the two peaks of interest.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
gate_mindensity(
  fr,
  channel,
  filterId = "",
  positive = TRUE,
  pivot = FALSE,
  gate_range = NULL,
  min = NULL,
  max = NULL,
  peaks = NULL,
  ...
)

Arguments

fr

a flowFrame object

channel

TODO

filterId

TODO

positive

If TRUE, then the gate consists of the entire real line to the right of the cutpoint. Otherwise, the gate is the entire real line to the left of the cutpoint. (Default: TRUE)

pivot

logical value. If TRUE, we choose as the two peaks the largest peak and its neighboring peak. See details.

gate_range

numeric vector of length 2. If given, this sets the bounds on the gate applied. If no gate is found within this range, we set the gate to the minimum value within this range if positive is TRUE and the maximum value of the range otherwise.

min

a numeric value that sets the lower boundary for data filtering

max

a numeric value that sets the upper boundary for data filtering

peaks

numeric vector. If not given , then perform peak detection first by .find_peaks

...

Additional arguments for peak detection.

Details

In the default case, the two peaks of interest are the two largest peaks obtained from the link{density} function. However, if pivot is TRUE, we choose the largest peak and its neighboring peak as the two peaks of interest. In this case, the neighboring peak is the peak immediately to the left of the largest peak if positive is TRUE. Otherwise, the neighboring peak is selected as the peak to the right.

In the special case that there is only one peak, we are conservative and set the cutpoint as the min(x) if positive is TRUE, and the max(x) otherwise.

Value

a rectangleGate object based on the minimum density cutpoint

Examples

1
2
3
4
## Not run: 
 gate <- gate_mindensity(fr, channel = "APC-A") # fr is a flowFrame

## End(Not run)

openCyto documentation built on Nov. 8, 2020, 5:40 p.m.