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.

cyto_compensate(x, ...)

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

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

# S3 method for 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

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

Examples

# Load in CytoExploreRData to access data library(CytoExploreRData) # Apply stored spillover matrix to flowSet cyto_compensate(Activation)
#> A flowSet with 33 experiments. #> #> column names(18): FSC-A FSC-H ... APC-Cy7-A Time #>
# 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")
#> A flowSet with 33 experiments. #> #> column names(18): FSC-A FSC-H ... APC-Cy7-A Time #>
# Apply stored spillover matrix to GatingSet gs <- GatingSet(Activation) cyto_compensate(gs)
#> A GatingSet with 33 samples
# Remove applied compensation cyto_compensate(gs, remove = TRUE)
#> A GatingSet with 33 samples
# Apply saved spillover matrix csv file to GatingSet cyto_compensate(gs, "Spillover-Matrix.csv")
#> A GatingSet with 33 samples