init: Initialize parameters

View source: R/init_clust.R

initR Documentation

Initialize parameters

Description

Initialize the parameters of the mixture model using k-means or hierarchical clustering on the PCs.

Usage

init(x, k_init = 20, use = "kmeans", droplets.use = NULL,
  n_sample = NULL, nstart_init = 30, min_size_init = 10,
  fixed = NULL, model = "mltn", psc = 1e-10, seedn = 1,
  threads = threads, verbose = TRUE, ...)

Arguments

x

An SCE object.

k_init

The number of clusters to initialize, not including fixed background clusters.

use

The method to use for clustering, one of either "kmeans" or "hclust."

droplets.use

Specify droplet IDs to use for initializing parameters.

n_sample

The number of droplets to sample from for initializing parameters.

nstart_init

The number of starts to use in k-means for for the initialization.

min_size_init

The minimum number of droplets that must belong to an initialized cluster.

fixed

A named integer vector that specifies which droplets to fix to which clusters. If NULL, then sets background droplets to 1.

model

The mixture model to assume. Can be either "DM" for a Dirichlet-multinomial or "mltn" for a multinomial.

psc

Pseudocount to add to estimation of gene probabilities.

seedn

Random seed.

threads

Number of threads.

verbose

Verbosity.

...

Additional parameters to pass to hclust or kmeans.

Value

An SCE object

Examples



# Initialize parameters with default values and multiple threads
sce <- init(sce, threads = 8)

# Specify initial k of 10 cell type clusters
sce <- init(sce, k_init = 10, threads = 8)

# Initialize parameters for Dirichlet-multinomial
sce <- init(sce, k_init = 10, model = "DM", threads = 8)

# Set seedn to NULL for random starts
sce <- init(sce, k_init = 10, seedn = NULL, threads = 8)
sce <- init(sce, k_init = 10, seedn = NULL, threads = 8)
sce <- init(sce, k_init = 10, seedn = NULL, threads = 8)

# Specify initial k of 30 cell type clusters and 
# Only allow clusters with at least 30 droplets
sce <- init(sce, k_init = 30, min_size_init = 30, threads = 8)



marcalva/diem documentation built on Jan. 1, 2023, 2:33 a.m.