top of page

Diversity Index for Lymphotrack output

Shannon’s equitability (E) quantifies the evenness of an immune repertoire, ranging from 0 to 1, where a value of 1 indicates perfect evenness and 0 indicates complete unevenness. This metric and tool are investigational and has not been validated for clinical use.

Instructions:

Put the script in the same directory.

Run command line python3 shannon.py

File       Total Reads     S                 H          E

A.tsv     100000           50000         8           0.77

B.tsv     50000             25000         7.8        0.76

C.tsv     10000             5000           7.4        0.75

S = unique clonotypes

H = Shannon's H

E = Shannon's E

Explanation of S, H, and E

S Richness (Unique Clonotypes) - The number of distinct clonotypes (unique DNA sequences) detected in a sample. It reflects how many different clonotypes are present, regardless of their abundance.

H Shannon Diversity Index - A measure of both richness and evenness. It is calculated as:
H = −Σ (pᵢ × ln pᵢ) where pᵢ is the proportional abundance of clonotype i (countᵢ / total). Higher H indicates greater diversity—many clonotypes with balanced frequencies rather than domination by a few.

E Shannon’s Equitability (Evenness) - A normalized measure of how evenly the clonotypes are distributed. It is computed as:
E = H / ln(S)
Values range from 0 to 1:
– 1 = perfectly even distribution (all clonotypes have equal abundance)
– 0 = highly uneven distribution (dominated by few clonotypes).

Interpreting Shannon’s Diversity

  • Shannon Diversity (H) captures both the number of clonotypes and their relative abundance.

    • In immune repertoire analysis, a high H means the repertoire is diverse — the immune system is responding to many distinct antigens or maintaining broad coverage.

    • A low H indicates clonal expansion — a few clonotypes dominate, typical in antigen-driven responses or restricted repertoires.

  • Shannon’s Equitability (E) isolates the evenness component of diversity.

    • If E ≈ 1: all clonotypes are represented similarly → balanced or polyclonal repertoire.

    • If E ≈ 0: few clonotypes dominate → skewed or clonal repertoire.

bottom of page