mantispy.tl.similarity#
- mantispy.tl.similarity(adata, metric='cosine', use_rep=None, key_added='similarity', copy=False)#
Store pairwise profile similarity in
obsp[key_added].- Parameters:
adata (
AnnData) – Profiles to compare.metric (
str(default:'cosine')) – Similarity between profiles, one ofMETRICS.use_rep (
str|None(default:None)) – Compareobsm[use_rep]instead ofX.key_added (
str(default:'similarity')) –obspkey written.copy (
bool(default:False)) – Return a modified copy instead of mutating in place.
- Return type:
- Returns:
None, or the modified copy. Writes the dense float32 similarity matrix ofsimilarity_matrixtoobsp[key_added].
Notes
The result is dense and quadratic in the number of profiles, so this expects well- or perturbation-level profiles rather than single cells.