subsample data

Subsample to a fraction of the number of observations.

Parameters

n_obs: int Subsample to this number of observations.


fraction: float Subsample to this fraction of the number of observations.


Web view

subsample_data_screenshot

Python equivalent

import scanpy as sc

# subsample data to 90% of original size (n_obs has no effect here)
sc.pp.subsample(adata, n_obs=None, fraction=0.9, random_state=42)
# subsample data to 1000 observations (fraction has no effect here)
sc.pp.subsample(adata, n_obs=1000, fraction=None, random_state=42)