Cluster cells using the Leiden algorithm [Traag18] implemented in the Scanpy framework [Wolf18].


ID: leiden
Namespace: cluster

Leiden is an improved version of the Louvain algorithm [Blondel08]. It has been proposed for single-cell analysis by [Levine15]. This requires having ran neighbors/find_neighbors or neighbors/bbknn first.

Blondel08: Blondel et al. (2008), Fast unfolding of communities in large networks, J. Stat. Mech.
Levine15: Levine et al. (2015), Data-Driven Phenotypic Dissection of AML Reveals Progenitor-like Cells that Correlate with Prognosis, Cell.
Traag18: Traag et al. (2018), From Louvain to Leiden: guaranteeing well-connected communities arXiv.
Wolf18: Wolf et al. (2018), Scanpy: large-scale single-cell gene expression data analysis, Genome Biology.

Example commands

You can run the pipeline using nextflow run.

View help

You can use --help as a parameter to get an overview of the possible parameters.

nextflow run openpipelines-bio/openpipeline \
  -r 0.12.0 -latest \
  -main-script target/nextflow/cluster/leiden/main.nf \

Run command

Example of params.yaml
# Arguments
input: # please fill in - example: "input.h5mu"
modality: "rna"
obsp_connectivities: "connectivities"
# output: "$id.$key.output.h5mu"
# output_compression: "gzip"
obsm_name: "leiden"
resolution: # please fill in - example: [1]

# Nextflow input-output arguments
publish_dir: # please fill in - example: "output/"
# param_list: "my_params.yaml"
nextflow run openpipelines-bio/openpipeline \
  -r 0.12.0 -latest \
  -profile docker \
  -main-script target/nextflow/cluster/leiden/main.nf \
  -params-file params.yaml

Replace -profile docker with -profile podman or -profile singularity depending on the desired backend.

Argument group


Name Description Attributes
--input Input file. file, required, example: "input.h5mu"
--modality string, default: "rna"
--obsp_connectivities In which .obsp slot the neighbor connectivities can be found. string, default: "connectivities"
--output Output file. file, required, example: "output.h5mu"
--output_compression string, example: "gzip"
--obsm_name Name of the .obsm key under which to add the cluster labels. The name of the columns in the matrix will correspond to the resolutions. string, default: "leiden"
--resolution A parameter value controlling the coarseness of the clustering. Higher values lead to more clusters. Multiple values will result in clustering being performed multiple times. List of double, required, default: 1, multiple_sep: ":"


  • Dries De Maeyer (maintainer)