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()
orscirpy.tl.define_clonotype_clusters()
.- Parameters
- adata :
AnnData
|MuData
|DataHandler
Union
[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
, ifinplace
isTrue
. When the function is running onMuData
, the result will be written to bothmdata.obs["{airr_mod}:{key_added}"]
andmdata.mod[airr_mod].obs[key_added]
.- inplace
If
True
, a column with the result will be stored inobs
. Otherwise the result will be returned.
- adata :
- Return type
- Returns
Depending on the value of
inplace
, either returns or adds toadata
a categorical vector indicating for each cell whether it belongs to a “convergent clonotype”.