Learn R Programming

ScatterDensity (version 0.1.1)

PolygonGate: PolygonGate

Description

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

Usage

PolygonGate(Data, Polygon, GateVars,  PlotIt = FALSE, PlotSampleSize = 1000)

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

Arguments

Data

numerical matrix n x d

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.

GateVars

vector, either column index in Data of X and Y coordinates of gate or its variable names as string

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

Author

Michael Thrun

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

See Also

PointsInPolygon

Examples

Run this code
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

# \donttest{
#Select index
V=PolygonGate(Data,poly,c(5,8),PlotIt=FALSE,100)

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

Run the code above in your browser using DataLab