plotSplines | R Documentation |
Plot splines used by the CytoNorm model
plotSplines(
model,
batches = names(model$clusterRes[[1]]$splines),
channels = model$clusterRes[[1]]$channels[1:3],
clusters = names(model$clusterRes),
groupClusters = FALSE
)
model |
Model as generated by CytoNorm.train |
batches |
Batches to include. One plot per batch is generated. Default = all batches used in the model. |
channels |
Channels to include. Default = first three channels used. |
clusters |
Clusters to include. Default = all clusters. |
groupClusters |
Logical, if TRUE al clusters are shown on one subplot, if FALSE, there will be a separate row per cluster. |
List with one plot per batch. The figure shows a grid with the specified clusters in rows and the specified markers in columns. In every subfigure, black dots indicate the quantiles used by the model and a red line shows the spline.
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 = 10,
ydim = 10,
nClus = 5,
scale = FALSE),
normParams = list(nQ = 99,
limit = c(0,7)),
seed = 1)
plotlist <- plotSplines(model)
plotlist <- plotSplines(model, groupClusters = TRUE)
plotlist[[1]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.