, *, key_coarse, key_fine, key_added='is_convergent', inplace=True)

Finds evidence for Convergent evolution of clonotypes.

Compares different definitions of clonotypes or clonotype clusters (e.g. clonotypes defined by nucleotide sequence identity and clonotype clusters defined by amino acid sequence identity). Annotates cells as convergent, if a “coarse” clonotype definition (amino acid sequence identity in the example) contains multiple “fine” clonotypes (nucleotide sequence identity in the example).

Clonotype definitions may be derived using or

adata : AnnData

Annotated data matrix

key_coarse : str

Key in adata.obs holding the “coarse” clonotype cluster defintion. E.g. ct_cluster_aa_identity.

key_fine : str

Key in adata.obs holding the “fine” clonotype/clonotype cluster definition. E.g. clone_id

key_added : str (default: 'is_convergent')

Key under which the result is stored in adata.obs.


If True, a column with the result will be stored in adata.obs. Otherwise the result is returned.

Return type

Categorical | NoneOptional[Categorical]


Depending on the value of inplace, either returns or adds to adata a categorical vector indicating for each cell whether it belongs to a “convergent clonotype”.