dandelion.base.tools.vdj_sample

dandelion.base.tools.vdj_sample(vdj_data, size=None, adata=None, p=None, force_replace=False, random_state=None)[source]

Resample vdj data and corresponding AnnData to a specified size.

Parameters:
  • vdj_data (Dandelion) – Dandelion object containing VDJ data.

  • size (int) – Desired size for resampling.

  • adata (AnnData | MuData | None, optional) – AnnData or MuData object corresponding to the gene expression data.

  • p (list[float] | np.ndarray[float] | None, optional) – Drawing probabilities for each cell, must sum to 1. If None, uniform probabilities are used.

  • force_replace (bool, optional) – Whether to force sampling with replacement, by default False.

  • random_state (int | np.random.RandomState | None, optional) – Random state for reproducibility, by default None.

Returns:

Resampled Dandelion and AnnData objects if adata is provided, otherwise only Dandelion.

Return type:

tuple[Dandelion, AnnData] | Dandelion