dotools_py.get.pcts_cells#
- dotools_py.get.pcts_cells(adata, group_by, features=None, min_expr=0.0)[source]#
Calculate the percentage of cells that express a feature.
- Parameters:
- adata
Annotated data matrix.
- group_by
str|list Column in
obsto group by. Several columns can be provided.- features
str|list(default:None) Features to use for the calculation. If set to
None, all features will be used.- min_expr
float(default:0.0) Minimum value to use for the estimation of percentages.
- Return type:
- Returns:
Returns a DataFrame with the percentage of cells expressing a feature in each group.
Example
>>> import dotools_py as do >>> adata = do.dt.example_10x_processed() >>> df = do.get.pcts_cells(adata, group_by=["condition", "annotation"]) >>> df.head(5) genes disease_B_cells ... healthy_T_cells healthy_pDC 0 ATP2A1-AS1 0.00 ... 0.01 0.00 1 STK17A 0.57 ... 0.49 0.17 2 C19orf18 0.00 ... 0.00 0.00 3 TPP2 0.03 ... 0.18 0.17 4 MFSD1 0.03 ... 0.06 0.50 [5 rows x 11 columns]