grassp.tl.resolve_diffusion

grassp.tl.resolve_diffusion#

resolve_diffusion(data, gene_sets, key_added='ann_diffusion', mode='likelihood', min_term_size=0, term_threshold=0.5, eta=1.0, tau=0.4, maxk=3, cap=12, gene_key='gene_symbol', species='hsap', out_key=None, inplace=True)[source]#

(Re)resolve stored diffusion probabilities into a per-protein label, in place.

Reads obsm[{key_added}_probabilities] (written by independent_diffusion()) and writes obs[out_key], which defaults to key_added for likelihood/argmax – overwriting the primary call, since that is what re-resolving means – and to f"{key_added}_specific" for specific, so an alternative resolution sits beside the default rather than replacing it. mode and min_term_size are as in independent_diffusion(). Lets you obtain several resolutions (e.g. likelihood and specific) or sweep min_term_size without re-diffusing. With inplace=False the labels are written to a copy, which is returned.

Return type:

AnnData | None

Parameters:
data AnnData

key_added str

mode Literal['likelihood', 'specific', 'argmax']

min_term_size int

term_threshold float

eta float

tau float

maxk int

cap int

gene_key str

species str

out_key str | None

inplace bool