Skip to main content

master codecov Open in Colab

Hi there! I have put together a python package for analyzing single cell BCR/TCR data from multiple platforms, including 10x Genomics 5' VDJ, BD Rhapsody, Parse Biosciences, SeekGene, and other AIRR-compatible sequencing sources. It streamlines the pre-processing, leveraging some tools from the immcantation suite, and integrates with scanpy/anndata for single-cell BCR/TCR analysis. It also includes a couple of functions for visualization.

Citation

dandelion is now published at Nature Biotechnology!

Please cite the following if you use version 0.3.0 onwards:

Suo, C., Polanski, K., Dann, E. et al. Dandelion uses the single-cell adaptive immune receptor repertoire to explore lymphocyte developmental origins. Nat Biotechnol (2023). https://doi.org/10.1038/s41587-023-01734-7

The data used in the Nature Biotechnology paper is available at a separate repository.

This repository also includes a Git submodule for the dandelion_manuscript folder, which is stored in the dandelion-demo-files repository (click link above that says dandelion_manuscript)

dandelion was originally published at Nature Medicine:

Emily Stephenson, Gary Reynolds, Rachel A Botting, Fernando J Calero-Nieto, Michael Morgan, Zewen Kelvin Tuong, Karsten Bach, Waradon Sungnak, Kaylee B Worlock, Masahiro Yoshida, Natsuhiko Kumasaka, Katarzyna Kania, Justin Engelbert, Bayanne Olabi, Jarmila Stremenova Spegarova, Nicola K Wilson, Nicole Mende, Laura Jardine, Louis CS Gardner, Issac Goh, Dave Horsfall, Jim McGrath, Simone Webb, Michael W Mather, Rik GH Lindeboom, Emma Dann, Ni Huang, Krzysztof Polanski, Elena Prigmore, Florian Gothe, Jonathan Scott, Rebecca P Payne, Kenneth F Baker, Aidan T Hanrath, Ina CD Schim van der Loeff, Andrew S Barr, Amada Sanchez-Gonzalez, Laura Bergamaschi, Federica Mescia, Josephine L Barnes, Eliz Kilich, Angus de Wilton, Anita Saigal, Aarash Saleh, Sam M Janes, Claire M Smith, Nusayhah Gopee, Caroline Wilson, Paul Coupland, Jonathan M Coxhead, Vladimir Y Kiselev, Stijn van Dongen, Jaume Bacardit, Hamish W King, Anthony J Rostron, A John Simpson, Sophie Hambleton, Elisa Laurenti, Paul A Lyons, Kerstin B Meyer, Marko Z Nikolic, Christopher JA Duncan, Ken Smith, Sarah A Teichmann, Menna R Clatworthy, John C Marioni, Berthold Gottgens, Muzlifah Haniffa. Single-cell multi-omics analysis of the immune response in COVID-19. Nature Medicine 2021.04.20; doi: https://dx.doi.org/10.1038/s41591-021-01329-2

Overview

Illustration of the Dandelion class slots

Please refer to the documentation.

The raw files used in the example notebooks can be downloaded from 10X's Single Cell Immune Profiling datasets website.

Installation

Singularity container

dandelion now comes ready in the form of a singularity container:

singularity pull library://kt16/default/sc-dandelion:latest
singularity shell --writable-tmpfs -B $PWD sc-dandelion_latest.sif

This will load up a container that has all the required dependencies installed.

This can be used for the preprocessing steps by navigating to the data folder and use:

singularity run -B $PWD sc-dandelion_latest.sif dandelion-preprocess

If you have multiple samples to process, it is reccomended to specify the --meta option with a .csv file detailing the samples:

singularity run -B $PWD sc-dandelion_latest.sif dandelion-preprocess --meta meta.csv

Python package

Start off by creating a conda environment containing scanpy, following official scanpy instructions. Once done, run the following:

Base install:

pip install sc-dandelion

With Polars backend (recommended for improved performance):

pip install sc-dandelion[polars]

The polars extra enables a faster backend for data operations. The base install uses pandas as the backend.

Between this and the pipelines within the singularity container, you should be covered for most of your needs.

Manual Full Installation

I understand that the singularity container may not be for everyone, so here is a more detailed installation guide for those who want to install the package manually. The instructions may vary depending on your system, so please adjust accordingly. The easiest way is to still to just use the singularity container for the preprocessing steps.

# install igblast and blast
conda install -c bioconda igblast blast # if this doesn't work, download them manually
# https://ftp.ncbi.nih.gov/blast/executables/igblast/release/LATEST/
# https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/
# Set the paths to them appropriately
echo 'export PATH=path/to/igblast/bin:$PATH' >> ~/.bash_profile
echo 'export PATH=path/to/blast+/bin:$PATH' >> ~/.bash_profile

You will need to download the database folder in this repository and place them somewhere accessible. There are scripts in the container folder that will help you download the imgt/ogrdb and other databases and you can use them like this:

# In order to download the databases, you will need to install the receptor-utils package first:
# pip install receptor-utils
python prepare_imgt_database.py
python prepare_ogrdb_database.py
python prepare_kiarva_database.py
python prepare_gkhlab_database.py

Also set the paths to the germline and igblast databases

echo 'export GERMLINE=path/to/database/germlines/' >> ~/.bash_profile
echo 'export IGDATA=path/to/database/igblast/' >> ~/.bash_profile
echo 'export BLASTDB=path/to/database/blast/' >> ~/.bash_profile
source ~/.bash_profile

For some of the pre-processing steps, you will need to install rpy2 and some R packages. The easiest way to do this is to install them all via conda:

# in bash/zsh terminal
conda install -c conda-forge -c bioconda rpy2 r-optparse r-alakazam r-tigger r-airr r-shazam r-scoper

Otherwise, you can also use pip to install rpy2 and then install the R packages manually:

pip install rpy2
# If it fails because it's compiling using clang, first, work out where the path is to your gcc compiler (use brew to install gcc if needed):
# then run
# env CC=/path/to/location/of/bin/gcc-9 pip install rpy2
# Use pip to install the following with --no-cache-dir --upgrade if necessary
# in R
install.packages(c("optparse", "alakazam", "tigger", "airr", "shazam", "scoper"))

and then lastly install dandelion:

# recommended: polars backend for improved performance
pip install "sc-dandelion[polars]"
# or the base (pandas) install
pip install sc-dandelion
# or from GitHub
pip install "sc-dandelion[polars] @ git+https://github.com/tuonglab/dandelion.git"
pip install git+https://github.com/tuonglab/dandelion.git
# or  installing from a specific branch
pip install git+https://github.com/tuonglab/dandelion@branch_name

Basic requirements

Python >=3.11

Base packages (auto-installed with pip install sc-dandelion)

numpy>=1.23
pandas>=1.4
changeo>=1.1
anndata>=0.9
scanpy>=1.9
scikit-learn>=1.0
scipy>=1.8
numba>=0.56
seaborn>=0.12
networkx>=3.0
polyleven>=0.4
h5py>=3.6
distance>=0.1.3
plotnine>=0.10
matplotlib>=3.5
rapidfuzz>3.12.1
zarr>=2.18.7
circlify>=0.15.0
airr
packcircles>=0.14
igraph>=1.0.0

Optional extras

pip install sc-dandelion[polars]    # polars>=2.0.0, pyarrow>=21.0.0
pip install sc-dandelion[scirpy]    # scirpy>=0.21, awkward>=2.1, mudata>=0.2
pip install sc-dandelion[scrublet]  # scrublet>=0.2, annoy<1.17.0
pip install sc-dandelion[palantir]  # palantir>=0.2.3, pertpy>=0.1.0, jax>=0.3
pip install sc-dandelion[dask]      # dask>=2025.11.0, distributed>=2025.11.0, psutil>=6.1.0

Other executables (required for preprocessing)

blast>=2.10.1   (bioconda)
igblast>=1.15.0 (bioconda)

Acknowledgements

I would like to acknowledge the contributions from Dr. Chenqu Suo, Dr. Krysztof Polanksi, Dr. Sarah Teichmann and Prof. Menna Clatworthy, who helped with the initial conception of the project and for all discussions.

I would also like to acknowledge Dr. Ondrej Suschanek, Dr. Benjamin Stewart, Dr. Rachel Bashford-Rogers, Dr. Jongeun Park, Dr. Cecilia-Dominguez Conde, Dr. Kirsten Stewart, Dr. Hamish King and Dr. Peng He with whom I have had very useful discussions. I would also like to thank my wife who helped name the package, because she thought the plots looked like a dandelion =D.

Support

Support is provided on a voluntary basis, as time permits.

If there are any ideas, comments, suggestions, thing you would like to know more etc., please feel free to email me at z.tuong@uq.edu.au or post in the issue tracker and I will get back to you.

Metadata

Release files for sc-dandelion 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sc-dandelion 1.0.0
File Size Uploaded Provenance
sc_dandelion-1.0.0.tar.gz 48.4 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sc-dandelion 1.0.0
File Interpreter ABI Platform
sc_dandelion-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 48.8 MB

Release files / sc_dandelion-1.0.0.tar.gz

Download URL sc_dandelion-1.0.0.tar.gz
Size 48.4 MB
Tags Source
SHA-256 checksum
How to use checksums
f9ee71d2eb256f39bba160cf6ca636d361c4ca514fb52f2e6a342bcd67092bcb
BLAKE2b-256 checksum
How to use checksums
0dab352466049a45e2ca2d130922bdbd924bb24fddf12ff25bf08917a1403c6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / sc_dandelion-1.0.0-py3-none-any.whl

Download URL sc_dandelion-1.0.0-py3-none-any.whl
Size 424.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0db9cfd66ecea2c446e6e46e18f1067f3033ea0b4c69bb890b5e2204be129037
BLAKE2b-256 checksum
How to use checksums
7a271343967fccaf21025212baa848e5d394dace1d39d59f7a8803afa115f5a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for sc-dandelion 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page