tacco.tools.distribute_molecules¶
- distribute_molecules(adata, width, position_key=('x', 'y'), obs_index_key=None, var_index_key=None, verbose=1, seed=42)[source]¶
Distributes the counts of observations randomly in space.
- Parameters:
adata – An
AnnData
with counts in .X.width – The width of the Gaussian to use for randomly placing molecules around the central position.
position_key – The .obsm key or a tuple of .obs keys with the position space coordinates.
obs_index_key – A string specifying the name of the column to write the old .obs.index (i.e. the cell names) to. If None, tries to guess a reasonable name.
var_index_key – A string specifying the name of the column to write the old .var.index (i.e. the gene names) to. If None, tries to guess a reasonable name.
verbose – Level of verbosity, with 0 (no output), 1 (some output), …
seed – The seed for the randomness.
- Returns:
A
DataFrame
with a single molecule per row and with scattered position space coordinates.