cyto_compensate: Apply fluorescence compensation to samples

Description Usage Arguments Value Author(s) Examples

View source: R/cyto-helpers.R

Description

cyto_compensate will apply a saved spillover matrix csv file to all samples. The csv file must contain the fluorescent channels as both the colnames (i.e. first row) and rownames (i.e. first column). If no spillover csv file is supplied, the spillover matrix will be extracted directly from the first element of x. To select a different sample for spillover matrix extraction supply the index or name of the sample to the select argument. Compensation applied to samples can be easily removed by setting the remove argument to TRUE.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
cyto_compensate(x, ...)

## S3 method for class 'GatingSet'
cyto_compensate(x, spillover = NULL, select = 1, remove = FALSE, ...)

## S3 method for class 'flowSet'
cyto_compensate(x, spillover = NULL, select = 1, remove = FALSE, ...)

## S3 method for class 'flowFrame'
cyto_compensate(x, spillover = NULL, select = 1, remove = FALSE, ...)

Arguments

x

object of class flowFrame, flowSet or GatingSet.

...

not in use.

spillover

name of the spillover matrix csv file (e.g. "Spillover-Matrix.csv") saved in the current working directory or spillover matrix object of class matrix or data.frame with channel names assigned to each column. If supplied, spillover will be applied to all samples.

select

index or name of the sample from which the spillover matrix should be extracted when no spillover matrix file is supplied to spillover. To compensate each sample individually using their stored spillover matrix file, set select to NULL.

remove

logical indicating whether applied compensation should be removed from the supplied samples, set to FALSE by default.

Value

a compensated flowFrame, flowSet or GatingSet object.

Author(s)

Dillon Hammill, Dillon.Hammill@anu.edu.au

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Load in CytoExploreRData to access data
library(CytoExploreRData)

# Apply stored spillover matrix to flowSet
cyto_compensate(Activation)

# Save spillover matrix in correct format
spill <- cyto_spillover_extract(Activation)[[1]]
rownames(spill) <- colnames(spill)
write.csv(
  spill,
  "Spillover-Matrix.csv"
)

# Apply saved spillover matrix csv file to flowSet
cyto_compensate(Activation, "Spillover-Matrix.csv")

# Apply stored spillover matrix to GatingSet
gs <- GatingSet(Activation)
cyto_compensate(gs)

# Remove applied compensation
cyto_compensate(gs, remove = TRUE)

# Apply saved spillover matrix csv file to GatingSet
cyto_compensate(gs, "Spillover-Matrix.csv")

DillonHammill/CytoExploreR documentation built on July 9, 2020, 1:53 a.m.