CytoNorm.normalize | R Documentation |
Normalize data, given the batch effects learned from control samples per
cell type/cluster (output from CytoNorm.train
). New fcs files
are written to the given output directory.
CytoNorm.normalize(
model,
files,
labels,
transformList,
transformList.reverse,
outputDir = ".",
prefix = "Norm_",
clean = TRUE,
verbose = FALSE,
normMethod.normalize = QuantileNorm.normalize,
write = TRUE,
...
)
model |
Model of the batch effercts, as computed by
|
files |
Full paths of the fcs files or a flowSet of the samples. |
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_" |
clean |
If FALSE, temporary files describing the FlowSOM clusters seperately are not removed at the end. Default = TRUE. |
verbose |
If TRUE, progress updates are printed. Default = FALSE. |
normMethod.normalize |
Normalization method to use. |
write |
logical indicating whether the normalised samples should
be written to new FCS files in a |
... |
Additional arguments to pass to read.FCS |
a flowSet containing the normalised samples and optionally write FCS
files to Normalized
directory in outputDir
.
CytoNorm.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 <- CytoNorm.train(files = train_data$Path,
labels = train_data$Batch,
channels = channels,
transformList = transformList,
FlowSOM.params = list(nCells = 10000, #1000000
xdim = 15,
ydim = 15,
nClus = 10,
scale = FALSE),
normParams = list(nQ = 99),
seed = 1,
verbose = TRUE)
CytoNorm.normalize(model = model,
files = validation_data$Path,
labels = validation_data$Batch,
transformList = transformList,
transformList.reverse = transformList.reverse,
verbose = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.