QuantileNorm.normalize | R Documentation |
Normalize data, given the batch effects learned from control samples per
cell type/cluster (output from QuantileNorm.train
). New fcs
files are written to the given output directory.
QuantileNorm.normalize(
model,
files,
labels,
transformList,
transformList.reverse,
outputDir = ".",
prefix = "Norm_",
removeOriginal = FALSE,
verbose = FALSE,
...
)
model |
Model of the batch effercts, as computed by
|
files |
Full paths of to the fcs files of the samples to normalize |
labels |
A label for every file, indicating to which batch it belongs, e.g. the plate ID. |
transformList |
Transformation list to pass to the flowCore
|
transformList.reverse |
Transformation list with the reverse functions, so the normalized files can be saved in the untransformed space |
outputDir |
Directory to put the temporary files in. Default = "." |
prefix |
Prefix to put in front of the normalized file names. Default = "Norm_" |
removeOriginal |
Should the original fcs be removed? Default = FALSE. |
verbose |
If TRUE, progress updates are printed. Default = FALSE. |
... |
Additional arguments to pass to read.FCS |
Nothing is returned, but the new FCS files are written to the output directory
QuantileNorm.train
dir <- system.file("extdata", package = "CytoNorm")
files <- list.files(dir, pattern = "fcs$")
data <- data.frame(File = files,
Path = file.path(dir, files),
Type = stringr::str_match(files, "_([12]).fcs")[,2],
Batch = stringr::str_match(files, "PTLG[0-9]*")[,1],
stringsAsFactors = FALSE)
data$Type <- c("1" = "Train", "2" = "Validation")[data$Type]
train_data <- dplyr::filter(data, Type == "Train")
validation_data <- dplyr::filter(data, Type == "Validation")
ff <- flowCore::read.FCS(data$Path[1])
channels <- grep("Di$", flowCore::colnames(ff), value = TRUE)
transformList <- flowCore::transformList(channels,
cytofTransform)
transformList.reverse <- flowCore::transformList(channels,
cytofTransform.reverse)
model_nQ_99 <- QuantileNorm.train(
files = train_data$Path,
labels = train_data$Batch,
channels = channels,
transformList = transformList,
nQ = 99)
QuantileNorm.normalize(model_nQ_99,
validation_data$Path,
validation_data$Batch,
transformList = transformList,
transformList.reverse = transformList.reverse)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.