clusKNN {scDataviz} | R Documentation

## A wrapper function for `Seurat`'s `FindNeighbors` and `FindClusters`.

### Description

A wrapper function for `Seurat`'s `FindNeighbors` and `FindClusters`.

### Usage

    clusKNN(
      indata,
      reducedDim = "UMAP",
      dimColnames = c("UMAP1", "UMAP2"),
      clusterAssignName = "Cluster",
      distance.matrix = FALSE,
      k.param = 20,
      compute.SNN = TRUE,
      prune.SNN = 1/15,
      nn.method = "rann",
      annoy.metric = "euclidean",
      nn.eps = 0,
      verbose = TRUE,
      force.recalc = FALSE,
      modularity.fxn = 1,
      initial.membership = NULL,
      weights = NULL,
      node.sizes = NULL,
      resolution = 0.8,
      method = "matrix",
      algorithm = 1,
      n.start = 10,
      n.iter = 10,
      random.seed = 0,
      group.singletons = TRUE,
      temp.file.location = NULL,
      edge.file.name = NULL,
      overwrite = FALSE
    )

### Arguments

`indata` | A data-frame or matrix, or `SingleCellExperiment` object. If a `SingleCellExperiment` object, the cell-to-cluster assignments will be added as a new column, specified by `clusterAssignName`, to the input object's metadata; if a data-frame or matrix, only the cluster assignment vector is returned.
`reducedDim` | A reduced dimensional component stored within `indata`. e.g., PCA or UMAP.
`dimColnames` | The column names of the dimensions to use.
`clusterAssignName` | The new column name in the metadata that will contain the determined cell-to-cluster assignments.
`distance.matrix` | Refer to `?Seurat::FindNeighbors`.
`k.param` | Refer to `?Seurat::FindNeighbors`.
`compute.SNN` | Refer to `?Seurat::FindNeighbors`.
`prune.SNN` | Refer to `?Seurat::FindNeighbors`.
`nn.method` | Refer to `?Seurat::FindNeighbors`.
`annoy.metric` | Refer to `?Seurat::FindNeighbors`.
`nn.eps` | Refer to `?Seurat::FindNeighbors`.
`verbose` | Refer to `?Seurat::FindNeighbors`.
`force.recalc` | Refer to `?Seurat::FindNeighbors`.
`modularity.fxn` | Refer to `?Seurat::FindClusters`.
`initial.membership` | Refer to `?Seurat::FindClusters`.
`weights` | Refer to `?Seurat::FindClusters`.
`node.sizes` | Refer to `?Seurat::FindClusters`.
`resolution` | Refer to `?Seurat::FindClusters`.
`method` | Refer to `?Seurat::FindClusters`.
`algorithm` | Refer to `?Seurat::FindClusters`.
`n.start` | Refer to `?Seurat::FindClusters`.
`n.iter` | Refer to `?Seurat::FindClusters`.
`random.seed` | Refer to `?Seurat::FindClusters`.
`group.singletons` | Refer to `?Seurat::FindClusters`.
`temp.file.location` | Refer to `?Seurat::FindClusters`.
`edge.file.name` | Refer to `?Seurat::FindClusters`.
`overwrite` | When the input object is a SingleCellExperiment, enabling this will result in the overwriting, with the new cluster assignments, of any column in your metadata that has the same name as `clusterAssignName`.

### Details

A wrapper function for Seurat's FindNeighbors and FindClusters.

### Value

A `SingleCellExperiment` or `numeric` object.

### Author(s)

Kevin Blighe <kevin@clinicalbioinformatics.co.uk>

### Examples

    # create random data that follows a negative binomial
    mat <- jitter(matrix(
      MASS::rnegbin(rexp(1000, rate=.1), theta = 4.5),
      ncol = 20))
    colnames(mat) <- paste0('CD', 1:ncol(mat))
    rownames(mat) <- paste0('cell', 1:nrow(mat))

    clusKNN(mat)

[Package scDataviz version 1.0.0 Index]