scirpy.tl.clonotype_convergence

scirpy.tl.clonotype_convergence(adata, *, key_coarse, key_fine, key_added='is_convergent', inplace=True, airr_mod='airr')

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 scirpy.tl.define_clonotypes() or scirpy.tl.define_clonotype_clusters().

Parameters
adata : AnnData | MuData | DataHandlerUnion[AnnData, MuData, DataHandler]

AnnData or MuData object that contains AIRR information.

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 will be stored in obs, if inplace is True. When the function is running on MuData, the result will be written to both mdata.obs["{airr_mod}:{key_added}"] and mdata.mod[airr_mod].obs[key_added].

inplace

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

Return type

Series | NoneOptional[Series]

Returns

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”.