omicverse.micro.rarefy#
- omicverse.micro.rarefy(adata, depth=None, seed=0, drop_shallow=True, save_original=True, copy=False)[source]#
Rarefy counts to a common depth.
The rarefied matrix overwrites
adata.X; the original counts are retained inadata.layers['counts_raw']whensave_original=True.- Parameters:
adata (
AnnData) – Samples × features AnnData with int counts.depth (
Optional[int] (default:None)) – Target depth. IfNone, uses the minimum sample library size.seed (
int(default:0)) – Random seed for reproducibility.drop_shallow (
bool(default:True)) – If True, samples with library size < depth are DROPPED. If False, their original counts are kept (no subsampling possible below depth).save_original (
bool(default:True)) – If True, a copy of the pre-rarefactionXis saved toadata.layers['counts_raw'].copy (
bool(default:False)) – Return a copy instead of modifying in place.
- Return type: