downsample data

If counts_per_cell is specified, each cell will downsampled. If total_counts is specified, expression matrix will be downsampled to contain at most total_counts.

Parameters

counts_per_cell: float Target total counts per cell. If a cell has more than ‘counts_per_cell', it will be downsampled to this number. Resulting counts can be specified on a per cell basis by passing an array.Should be an integer or integer ndarray with same length as number of obs.


total_counts: float Target total counts. If the count matrix has more than total_counts it will be downsampled to have this number.


Web view

downsample_data_screenshot

Python equivalent

import scanpy as sc

sc.pp.downsample_counts(adata, counts_per_cell=1, total_counts=None, random_state=42)
# counts now equal the total number of observations(cell)