Skip to contents

# harmonize_PCA

Source: `R/batch_correction.R`
`harmonize_PCA.Rd`

Harmonize the Principal Components previously calculated by `runPCA` for a defined batch variable (`batch_var`).

## Usage

    harmonize_PCA(fcd, data_slot = "orig", batch_var, seed = 91, prefix = NULL)

## Arguments

fcd

  flow cytometry dataset.

data_slot

  name of the PCA data slot to use for harmonization. If no prefix was added the, `orig`.

batch_var

  vector of column names from `fcd$anno$cell_anno` to use for correcting the data.

seed

  A seed is set for reproducibility.

prefix

  Prefix for the output.

## Value

The function returns a fcd with a harmonized Principal Components based on `HarmonyMatrix`. If no prefix is added, the harmonized PCs are saved in `fcd$pca$norm`.

## Details

harmonize_PCA

See [Korunsky et al., 2019](https://doi.org/10.1038/s41592-019-0619-0) for more details on the Harmony algorithm.