rapids_singlecell.pp.scrublet_simulate_doublets#

rapids_singlecell.pp.scrublet_simulate_doublets(adata, *, use=None, layer=None, sim_doublet_ratio=2.0, synthetic_doublet_umi_subsampling=1.0, rng=None)[source]#

Simulate doublets by adding the counts of random observed transcriptome pairs.

Parameters:
adata AnnData

The annotated data matrix of shape n_obs × n_vars. Rows correspond to cells and columns to genes. Genes should have been filtered for expression and variability, and the object should contain raw expression of the same dimensions.

use LayerAcc | str | None (default: None)

Which matrix holds the raw counts, e.g. A.X or A.layers['counts']. Strings are resolved by anndata.acc.AdAcc.resolve(), e.g. 'layers.counts'.

layer str | None (default: None)

Deprecated since version 0.19.0: Use use instead.

Deprecated, layer='k' is use=A.layers['k'].

sim_doublet_ratio float (default: 2.0)

Number of doublets to simulate relative to the number of observed transcriptomes. If None, self.sim_doublet_ratio is used.

synthetic_doublet_umi_subsampling float (default: 1.0)

Rate for sampling UMIs when creating synthetic doublets. If 1.0, each doublet is created by simply adding the UMIs from two randomly sampled observed transcriptomes. For values less than 1, the UMI counts are added and then randomly sampled at the specified rate.

rng int | integer | Sequence[int] | SeedSequence | Generator | BitGenerator | None (default: None)

Random seed or Generator for doublet simulation. The superseded random_state argument is still accepted.

Return type:

AnnData

Returns:

adata : anndata.AnnData with simulated doublets in .X Adds fields to adata:

.obsm['scrublet']['doublet_parents']

Pairs of .obs_names used to generate each simulated doublet transcriptome

.uns['scrublet']['parameters']

Dictionary of Scrublet parameters

See also

scrublet()

Main way of running Scrublet, runs preprocessing, doublet simulation (this function) and calling.

scrublet_score_distribution()

Plot histogram of doublet scores for observed transcriptomes and simulated doublets.