runLeiden: Run Leiden clustering algorithm This code is modified from...

runLeidenR Documentation

Run Leiden clustering algorithm This code is modified from Tom Kelly (https://github.com/TomKellyGenetics/leiden), where we added more parameters (seed.use and n.iter) to run the Python version. In addition, we also take care of the singleton issue after running leiden algorithm.

Description

Implements the Leiden clustering algorithm in R using reticulate to run the Python version. Requires the python "leidenalg" and "igraph" modules to be installed. Returns a vector of partition indices.

Usage

runLeiden(
  SNN = matrix(),
  resolution = 1,
  partition_type = c("RBConfigurationVertexPartition", "ModularityVertexPartition",
    "RBERVertexPartition", "CPMVertexPartition", "MutableVertexPartition",
    "SignificanceVertexPartition", "SurpriseVertexPartition"),
  seed.use = 42L,
  n.iter = 10L,
  initial.membership = NULL,
  weights = NULL,
  node.sizes = NULL
)

Arguments

SNN

An adjacency matrix compatible with igraph object.

resolution

A parameter controlling the coarseness of the clusters

partition_type

Type of partition to use. Defaults to RBConfigurationVertexPartition. Options include: ModularityVertexPartition, RBERVertexPartition, CPMVertexPartition, MutableVertexPartition, SignificanceVertexPartition, SurpriseVertexPartition (see the Leiden python module documentation for more details)

seed.use

set seed

n.iter

number of iteration

initial.membership

arameters to pass to the Python leidenalg function defaults initial_membership=None

weights

defaults weights=None

node.sizes

Parameters to pass to the Python leidenalg function

Value

A parition of clusters as a vector of integers


KChen-lab/bindSC documentation built on Sept. 29, 2022, 4:24 a.m.