nearestSamples: impute the gate (flagged as failure by external algorithm)...

Description Usage Arguments Examples

View source: R/nearestSamples.R

Description

impute the gate (flagged as failure by external algorithm) with refGate from nearest neighbour sample

Usage

1
nearestSamples(gs, node, failed, passed = NULL, ...)

Arguments

gs

a GatingSet

node

a character or numeric specifing node index

failed

a character or numeric specifing samples that fails the gating QA

passed

a character or numeric specifing samples that passes QA to be served as references By default, all samples other than failed will be used. but sometime it is helpful to narrow it down to a few of really good samples.

...

other arguments passed to .nearestSample n an integer passed to density call. default is 512. bandwidth, gridsize passed to bkde2D call. default is c(5, 5) and c(100, 100). method density similarity calculation method. Either "ks.test" or "em". For 2d gate, "em" is the only choice. mc.cores passed to mclapply for parallel computing. Default is 1.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
library(flowWorkspace)
gs <- load_gs("gs-tcell/")

#Finding reference sample for: 1349_3_Tcell_A06.fcs
res <- nearestSamples(gs, node = "CD3", failed = "1349_3_Tcell_A06.fcs")
# res is a named vector stores the mapping between bad(failed) and good(reference) samples

#fix the gate for the bad samples
regateNearestSamples(gs, res, "CD3")

#run it on 2d gate and customize some parameters
#and enable parallel computing to speed it up
res <- nearestSamples(gs, node = "CD4", failed = "1349_3_Tcell_A06.fcs", gridsize = c(70, 70), mc.cores = 4)
#fix the 2d gate for the bad samples
regateNearestSamples(gs, res, "CD4")

## End(Not run)

RGLab/flowIncubator documentation built on Sept. 5, 2020, 11:10 p.m.