shift_gate {flowWorkspace} | R Documentation

## Simplified geometric translation of gates associated with nodes

### Description

Shift the location of a gate associated with a node of a `GatingHierarchy` or `GatingSet`. This method is a wrapper for `shift_gate` that enables updating of the gate associated with a node of a `GatingHierarchy` or `GatingSet`.

`shift_gate` calls `gs_pop_set_gate` to modify the provided `GatingHierarchy` or `GatingSet` directly so there is no need to re-assign its output. The arguments will be essentially identical to the `flowCore` method, except for the specification of the target gate. Rather than being called on an object of type `flowCore::filter`, here it is called on a `GatingHierarchy` or `GatingSet` object with an additional character argument for specifying the node whose gate should be transformed. The rest of the details below are taken from the `flowCore` documentation.

### Usage

    ## S3 method for class 'GatingHierarchy'
    shift_gate(obj, y, dx = NULL, dy = NULL, center = NULL, ...)

### Arguments

`obj` | A `GatingHierarchy` or `GatingSet` object
`y` | A character specifying the node whose gate should be modified
`dx` | Either a numeric scalar or numeric vector. If it is scalar, this is just the desired shift of the gate in its first dimension. If it is a vector, it specifies both `dx` and `dy` as `(dx,dy)`. This provides an alternate syntax for shifting gates, as well as allowing shifts of `ellipsoidGate` objects in more than 2 dimensions.
`dy` | A numeric scalar specifying the desired shift of the gate in its second dimension.
`center` | A numeric vector specifying where the center or centroid should be moved (rather than specifiying `dx` and/or `dy`)
`...` | not used

### Details

This method allows for geometric translation of filter types defined by simple geometric gates (`rectangleGate`, `quadGate`, `ellipsoidGate`, or `polygonGate`). The method provides two approaches to specify a translation. For `rectangleGate` objects, this will shift the `min` and `max` bounds by the same amount in each specified dimension. For `quadGate` objects, this will simply shift the divinding boundary in each dimension. For `ellipsoidGate` objects, this will shift the center (and therefore all points of the ellipse). For `polgonGate` objects, this will simply shift all of the points defining the polygon.

The method allows two different approaches to shifting a gate. Through the `dx` and/or `dy` arguments, a direct shift in each dimension can be provided. Alternatively, through the `center` argument, the gate can be directly moved to a new location in relation to the old center of the gate. For `quadGate` objects, this center is the intersection of the two dividing boundaries (so the value of the `boundary` slot). For `rectangleGate` objects, this is the center of the rectangle defined by the intersections of the centers of each interval. For `ellipsoidGate` objects, it is the center of the ellipsoid, given by the `mean` slot. For `polygonGate` objects, the centroid of the old polygon will be calculated and shifted to the new location provided by `center` and all other points on the polygon will be shifted by relation to the centroid.

### See Also

transform_gate `flowCore::shift_gate`

### Examples

    ## Not run:
    # Moves the entire gate +500 in its first dimension and 0 in its second dimension
    shift_gate(gs, node, dx = 500)

    #Moves the entire gate +250 in its first dimension and +700 in its second dimension
    shift_gate(gs, node, dx = 500, dy = 700)

    # Same as previous
    shift_gate(gs, node, c(500,700))

    # Move the gate based on shifting its center to (700, 1000)
    shift_gate(gs, node, center = c(700, 1000))

    ## End(Not run)

[Package flowWorkspace version 4.2.0 Index]