Learn R Programming

cyanoFilter (version 0.1.3)

celldebris_emclustering: identifies Synechococcus cyanobacteria cells and Debris in a flowfile using an EM style algorithm.

Description

separates BS4, BS5 and Debris population in a flowfile using an EM style algorithm. Algorithm starts with ncluster number of clusters and automatically reduces this number if need be.

Usage

celldebris_emclustering(flowfile, channels, mu = NULL, sigma = NULL,
  ncluster = 5, min.itera = 20, classifier = 0.8)

Arguments

flowfile

flowframe to be clustered.

channels

channels to use for the clustering

mu

pre-specified mean matrix for the clusters. Number of rows should equal ncluster and number of columns should equal length(channels). Defaults to NULL and will be computed from the data internally if left as NULL.

sigma

pre-specified list of variance-covariace matrix for the clusters. Each element of the list should contain a square matrix of variance-covariance matrix with length equal ncluster. Defaults to NULL and will be computed from the data internally if left as NULL.

ncluster

number of cluster desired.

min.itera

minimum number of EM iterations.

classifier

cells will be assigned to a cluster if belongs to that cluster by at least this probability. Only for plotting purposes.

Value

list containing;

  • percentages - percentage of cells in each cluster

  • mus - matrix of mean vectors for each cluster

  • sigmas - list of variance-covariance matrix for each cluster

  • result - flowframe with probabilities of each cluster added as columns to the expression matrix of the flowfile

Details

The function using EM algorithm involving mixtures of multivariate normals to separate the entire cell-population provided into cluster. The mvnorm function is used to compute the densities and only the probabilites of each point belonging to a cluster are returned as additional columns to the expression matrix of result.

See Also

celldebris_nc

Examples

Run this code
# NOT RUN {
flowfile_path <- system.file("extdata", "B4_18_1.fcs", package = "cyanoFilter",
              mustWork = TRUE)
flowfile <- flowCore::read.FCS(flowfile_path, alter.names = TRUE,
                               transformation = FALSE, emptyValue = FALSE,
                               dataset = 1) #FCS file contains only one data object
flowfile_nona <- cyanoFilter::nona(x = flowfile)
flowfile_noneg <- cyanoFilter::noneg(x = flowfile_nona)
flowfile_logtrans <- lnTrans(x = flowfile_noneg, c('SSC.W', 'TIME'))
cells_nonmargin <- cellmargin(flow.frame = flowfile_logtrans, Channel = 'SSC.W',
           type = 'estimate', y_toplot = "FSC.HLin")

emapproach <- celldebris_emclustering(flowfile = cells_nonmargin$reducedflowframe,
                    channels = c("RED.B.HLin", "YEL.B.HLin",
                    "FSC.HLin", "RED.R.HLin"),
                    ncluster = 5, min.itera = 20)
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab