biotapy.pp.relative#
- biotapy.pp.relative(adata)#
Add per-sample relative abundance as
layers['relative'].- Parameters:
adata (
AnnData) – Samples x features;Xholds counts or another non-negative abundance.- Return type:
- Returns:
AnnData A copy of
adata(a TreeData stays a TreeData) withlayers['relative'];Xis unchanged.
Notes
R equivalent:
phyloseq::transform_sample_counts,mia::transformAssayGuide: TransformsAll-zero samples stay all-zero, where phyloseq returns
NaN.Examples
>>> import biotapy as bt >>> out = bt.pp.relative(bt.datasets.toy()) >>> round(float(out.layers["relative"][0].sum()), 6) 1.0