scale_gate: Simplified geometric scaling of gates

View source: R/transform_gate-methods.R

scale_gateR Documentation

Simplified geometric scaling of gates

Description

Scale a Gate-type filter object in one or more dimensions

Usage

## Default S3 method:
scale_gate(obj, scale = NULL, ...)

Arguments

obj

A Gate-type filter object (quadGate, rectangleGate, ellipsoidGate, or polygonGate)

scale

Either a numeric scalar (for uniform scaling in all dimensions) or numeric vector specifying the factor by which each dimension of the gate should be expanded (absolute value > 1) or contracted (absolute value < 1). Negative values will result in a reflection in that dimension.

...

Additional arguments not used

Details

This method allows uniform or non-uniform geometric scaling of filter types defined by simple geometric gates (quadGate, rectangleGate, ellipsoidGate, and polygonGate) Note that these methods are for manually altering the geometric definition of a gate. To easily transform the definition of a gate with an accompanyging scale transformation applied to its underlying data, see rescale_gate.

The scale argument passed to scale_gate should be either a scalar or a vector of the same length as the number of dimensions of the gate. If it is scalar, all dimensions will be multiplicatively scaled uniformly by the scalar factor provided. If it is a vector, each dimension will be scaled by its corresponding entry in the vector.

The scaling behavior of scale_gate depends on the type of gate passed to it. For rectangleGate and quadGate objects, this amounts to simply scaling the values of the 1-dimensional boundaries. For polygonGate objects, the values of scale will be used to determine scale factors in the direction of each of the 2 dimensions of the gate (scale_gate is not yet defined for higher-dimensional polytopeGate objects). Important: For ellipsoidGate objects, scale determines scale factors for the major and minor axes of the ellipse, in that order. Scaling by a negative factor will result in a reflection in the corresponding dimension.

Value

A Gate-type filter object of the same type as gate, with the scaling applied

Examples

## Not run: 
# Scales both dimensions by a factor of 5
scaled_gate <- scale_gate(original_gate, 5)

# Shrinks the gate in the first dimension by factor of 1/2
# and expands it in the other dimension by factor of 3
scaled_gate <- scale_gate(original_gate, c(0.5,3))

## End(Not run)


RGLab/flowCore documentation built on Aug. 26, 2024, 8:52 a.m.