executes the classical compensation function on a flowSet or flowFrame, given a compensation matrix. The matrix can be either retrieved in the fcs files themselves or provided as a csv file.

compensateFromMatrix(
  x,
  matrixSource = c("fcs", "import", "pData"),
  matrixPath = NULL,
  pDataVar = NULL,
  pDataPathMapping = NULL,
  updateChannelNames = TRUE,
  ...
)

Arguments

x

a flowCore::flowFrame or flowCore::flowSet

matrixSource

if "fcs", the compensation matrix will be fetched from the fcs files (different compensation matrices can then be applied by fcs file) if "import", uses matrixPath to read the matrix (should be a csv file) if "pData", uses pDataVar and pDataPathMapping to link a specific phenotype data variable to map different matrix paths

matrixPath

if matrixSource == "import", will be used as the input csv file path

pDataVar

variable name (column of pheno data) used to map the compenstion matrix file

pDataPathMapping

a named list:

  • item names are possible values of pDataVar

  • item values are character() providing the matrixPath for the corresponding pDataVar value

updateChannelNames

if TRUE, updates the fluo channel names by prefixing them with "comp-"

...

additional arguments (not used)

Value

the compensated flowSet or flowFrame

Examples


rawDataDir <-
    system.file("extdata", package = "CytoPipeline")
sampleFiles <-
    file.path(rawDataDir, list.files(rawDataDir, pattern = "Donor"))

truncateMaxRange <- FALSE
minLimit <- NULL

# create flowCore::flowSet with all samples of a dataset
fsRaw <- readSampleFiles(
    sampleFiles = sampleFiles,
    whichSamples = "all",
    truncate_max_range = truncateMaxRange,
    min.limit = minLimit)

suppressWarnings(ff_m <- removeMarginsPeacoQC(x = fsRaw[[2]]))
#> Removing margins from file : Donor2.fcs
    
ff_c <-
    compensateFromMatrix(ff_m,
                         matrixSource = "fcs")        
#> Compensating file : Donor2.fcs