Bbknn leiden

Run bbknn followed by leiden clustering and run umap on the result.

Info

ID: bbknn_leiden
Namespace: multiomics/integration

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.6 -latest \
  -main-script ./workflows/multiomics/integration/bbknn_leiden/main.nf \
  --help

Run command

Example of params.yaml
# Inputs
id: # please fill in - example: "foo"
input: # please fill in - example: "dataset.h5mu"
layer: "log_normalized"
modality: "rna"

# Outputs
# output: "$id.$key.output.h5mu"

# Bbknn
obsm_input: "X_pca"
obs_batch: "sample_id"
uns_output: "bbknn_integration_neighbors"
obsp_distances: "bbknn_integration_distances"
obsp_connectivities: "bbknn_integration_connectivities"
n_neighbors_within_batch: 3
n_pcs: 50
# n_trim: 123

# Clustering options
obs_cluster: "bbknn_integration_leiden"
leiden_resolution: [1]

# UMAP options
obsm_umap: "X_leiden_bbknn_umap"

# Nextflow input-output arguments
publish_dir: # please fill in - example: "output/"
# param_list: "my_params.yaml"
nextflow run openpipelines-bio/openpipeline \
  -r 0.12.6 -latest \
  -profile docker \
  -main-script ./workflows/multiomics/integration/bbknn_leiden/main.nf \
  -params-file params.yaml
Note

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

Argument groups

Inputs

Name Description Attributes
--id ID of the sample. string, required, example: "foo"
--input Path to the sample. file, required, example: "dataset.h5mu"
--layer use specified layer for expression values instead of the .X object from the modality. string, default: "log_normalized"
--modality Which modality to process. string, default: "rna"

Outputs

Name Description Attributes
--output Destination path to the output. file, required, example: "output.h5mu"

Bbknn

Name Description Attributes
--obsm_input The dimensionality reduction in .obsm to use for neighbour detection. Defaults to X_pca. string, default: "X_pca"
--obs_batch .obs column name discriminating between your batches. string, default: "sample_id"
--uns_output Mandatory .uns slot to store various neighbor output objects. string, default: "bbknn_integration_neighbors"
--obsp_distances In which .obsp slot to store the distance matrix between the resulting neighbors. string, default: "bbknn_integration_distances"
--obsp_connectivities In which .obsp slot to store the connectivities matrix between the resulting neighbors. string, default: "bbknn_integration_connectivities"
--n_neighbors_within_batch How many top neighbours to report for each batch; total number of neighbours in the initial k-nearest-neighbours computation will be this number times the number of batches. integer, default: 3
--n_pcs How many dimensions (in case of PCA, principal components) to use in the analysis. integer, default: 50
--n_trim Trim the neighbours of each cell to these many top connectivities. May help with population independence and improve the tidiness of clustering. The lower the value the more independent the individual populations, at the cost of more conserved batch effect. If None (default), sets the parameter value automatically to 10 times neighbors_within_batch times the number of batches. Set to 0 to skip. integer

Clustering options

Name Description Attributes
--obs_cluster Prefix for the .obs keys under which to add the cluster labels. Newly created columns in .obs will be created from the specified value for ‘–obs_cluster’ suffixed with an underscore and one of the resolutions resolutions specified in ‘–leiden_resolution’. string, default: "bbknn_integration_leiden"
--leiden_resolution Control the coarseness of the clustering. Higher values lead to more clusters. List of double, default: 1, multiple_sep: ":"

UMAP options

Name Description Attributes
--obsm_umap In which .obsm slot to store the resulting UMAP embedding. string, default: "X_leiden_bbknn_umap"

Authors

  • Mauro Saporita (author)

  • Povilas Gibas (author)

Visualisation

flowchart LR
    v0(Input)
    v2(toSortedList)
    v4(flatMap)
    v10(bbknn)
    v12(join)
    v15(filter)
    v21(leiden)
    v23(join)
    v31(move_obsm_to_obs)
    v33(join)
    v37(mix)
    v36(filter)
    v43(umap)
    v45(join)
    v51(Output)
    v36-->v37
    v0-->v2
    v2-->v4
    v4-->v12
    v4-->v10
    v10-->v12
    v12-->v15
    v12-->v36
    v15-->v23
    v15-->v21
    v21-->v23
    v23-->v33
    v23-->v31
    v31-->v33
    v33-->v37
    v37-->v45
    v37-->v43
    v43-->v45
    v45-->v51