testCV | R Documentation |
Function to inspect whether all control samples contain a similar percentage of cells in all FlowSOM clusters
testCV(fsom, cluster_values = 3:50, plot = TRUE, verbose = FALSE, seed = 1)
fsom |
FlowSOM list, as generated by prepareFlowSOM |
cluster_values |
Vector with all amounts of clusters to test, can not be smaller than 3. |
plot |
If TRUE, a plot of the CV values is generated |
verbose |
If TRUE, extra progress updates are printed |
seed |
Seed for reproducible results. Default = 1. |
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")
ff <- flowCore::read.FCS(data$Path[1])
channels <- grep("Di$", flowCore::colnames(ff), value = TRUE)
transformList <- flowCore::transformList(channels,
cytofTransform)
fsom <- prepareFlowSOM(train_data$Path,
channels,
nCells = 10000, #1000000
FlowSOM.params = list(xdim = 15,
ydim = 15,
nClus = 25,
scale = FALSE),
transformList = transformList,
seed = 1)
cvs <- testCV(fsom,
cluster_values = c(5,15,25,35,45)) # 3:50
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.