require(cytofkit)
## Loading required package: cytofkit
## Loading required package: ggplot2
## Loading required package: plyr
Merge expresssion data
## down sample 10000 cells from each file using method ceil
files <- list.files(path="./CD4posTcell_dataset/",
pattern = ".fcs$", full.names = TRUE)
markers <- as.character(read.table("./CD4posTcell_dataset/parameter.txt",
header = TRUE)[,1])
xdata <- cytof_exprsMerge(fcsFiles = files, markers = markers,
transformMethod = "autoLgcl",
mergeMethod = "ceil", fixedNum = 10000)
Run t-SNE
ydata <- cytof_dimReduction(data = xdata, method = "tsne")
Clustering Analysis
ClusterX
cx_cluster <- cytof_cluster(ydata = ydata, xdata = xdata, method = "ClusterX")
DensVM
dv_cluster <- cytof_cluster(ydata = ydata, xdata = xdata, method = "DensVM")
PhenoGraph
pg_cluster <- cytof_cluster(ydata = ydata, xdata = xdata, method = "Rphenograph")
Clustering Plot
aData <- cbind(xdata, ydata)
aData$DensVM <- factor(dv_cluster)
aData$ClusterX <- factor(cx_cluster)
aData$PhenoGraph <- factor(pg_cluster)
ClusterX
cytof_clusterPlot(data = aData, xlab = "tsne_1", ylab = "tsne_2",
cluster = "ClusterX", sampleLabel = FALSE)

DensVM
cytof_clusterPlot(data = aData, xlab = "tsne_1", ylab = "tsne_2",
cluster = "DensVM", sampleLabel = FALSE)

PhenoGraph
cytof_clusterPlot(data = aData, xlab = "tsne_1", ylab = "tsne_2",
cluster = "PhenoGraph", sampleLabel = FALSE)
