ApplyGate: ApplyGate

View source: R/ApplyGate.R

ApplyGateR Documentation

ApplyGate

Description

A specific Gate defined by xy coordinates that result in a closed polygon is applied to the flowcytometry data.

Usage

ApplyGate(Data, GateVar1, GateVar2, Polygon, PlotIt = FALSE, PlotSampleSize = 1000)

Arguments

Data

numerical matrix n x d

GateVar1

either column index in Data of X coordinate of gate or its variable name as string

GateVar2

either column index in Data of X coordinate of gate or its variable name as string

Polygon

numerical marix of two columns defining the coordiantes of the polygon. polygon assumed to be closed, i.e.,last coordinate connects to first coordinate.

PlotIt

if TRUE: plots a sample of data in the two selected variables and marks point inside the gate as yellow and outside as magenta

PlotSampleSize

size pof the plottet sample

Details

Gates are alwaxs two dimensional, i.e., require two filters, although all dimensions of data are filted by the gates. Only high-dimensional points inside the polygon (gate) are given back

Value

list of

DataInGate

m x d numerical matrix with m<=n of data points inside the gate

InGateInd

index of length m for the datapoints in original matrix

Note

if GateVar1 or GateVar2 is not found a text is given back which will state this issue

Author(s)

Michael Thrun

See Also

PointsInPolygon

Examples

Data <- matrix(runif(1000), ncol = 10)
colnames(Data)=paste0("GateVar",1:ncol(Data))
poly <- cbind(x = c(0.2,0.5,0.8), y = c(0.2,0.8,0.2))
#set plotit TRUE for understanding the example

#Select indect
V=ApplyGate(Data,5,8,poly,PlotIt=FALSE,100)

#select var name
V=ApplyGate(Data,"GateVar5","GateVar8",poly,PlotIt=FALSE,100)


Mthrun/dbt.FlowCytometry documentation built on June 5, 2023, 10:30 a.m.