Skip to main content

Cdiversity: Quantifying B-Cell Clonal Diversity In Repertoire Data

Advances in high-throughput sequencing technologies have enabled the high-throughput characterization of B-cell receptor sequencing data. Still, the accurate identification of clonally related BCR sequences remains a difficult challenge. Importantly, different methods may lead to different clonal definitions, which in turn can affect the quantification of clonal diversity in repertoire data [1]. This library provide different tools and metrics to (i) group B-cell repertoires into clonal groups and (ii) compute diversity indices and diversity profiles from the obtained groups.

 

Running the analysis

First, you need to install cdiversity, or alternatively you can use the cdiversity.py file provided in the repository:

- pip install cdiversity

Then, you can run a repertoire analysis simulation with the toy example below. For a more complete overview, you can check out Examples/Analyze_sample.py. Briefly, the analysis start by grouping Bcell into clones, and then use the obtained groups to compute various diversity metrics.

(I) Grouping repertoire into clones

Available methods for clonal identification are junction, which simply group clones together only if they have the same junction. Then, there is the commonly used VJ-junction methods, which group together BCR with the same V and J genes, as well as some user-specificed junction similarity (clone_threshold). Finally, the last method is alignfree, which compute tf-idf embedings of the BCRs to perform a fast clustering without relying on the V and J germline genes alignements.

import pandas as pd
import cdiversity

df = pd.read_csv('Data/sample.csv', sep='\t') 
clones_baseline, _ = cdiversity.identify_clonal_group(df, method='junction')
clone_VJJ, _ = cdiversity.identify_clonal_group(df, method='VJJ', clone_threshold = 0.1)

(II) Computing diversity indices

Once the clonal groups are obtained, you can compute any diversity indices or the Hill's diversity profile with a single command. Implemented indices are richness, richness_chao, Shannon_entropy, Shannon_entropy_chao, Simpson_index, dominance, eveness.

from collections import Counter

	clone_dict = Counter(clone_VJJ)
	diversity = cdiversity.Shannon_entropy_Chao(clone_dict)
	div_profile, alpha_axis = cdiversity.diversity_profile(clone_dict)

References

[1] Pelissier, A, Luo, S, et al. "Quantifying B Cell Clonal Diversity In Repertoire Data". Submitted to Frontier in immunology (2022) [Preprint]

Metadata

Release files for cdiversity 1.0.2

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

Source distribution (sdist)

Source distribution for cdiversity 1.0.2
File Size Uploaded Provenance Actions
cdiversity-1.0.2.tar.gz 13.5 kB Without provenance Details for cdiversity-1.0.2.tar.gz

Release files / cdiversity-1.0.2.tar.gz

Download URL cdiversity-1.0.2.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a99069107685415157d213bf7c0394d780295eefdafb4a618793dd1d657dccc3
BLAKE2b-256 checksum
How to use checksums
aeec03bb493b5564d1d4738d1630ae4ab800c4aee7aff529534765ca492fa42a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.7

Security for cdiversity 1.0.2

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.

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