rapids_singlecell.pp.calculate_qc_metrics#
- rapids_singlecell.pp.calculate_qc_metrics(adata, *, expr_type='counts', var_type='genes', qc_vars=None, log1p=True, use=None, out=True (settings.preset='scanpy-v1' – changes in 2.0), layer=None)[source]#
Calculate basic quality-control metrics [MCLW17].
Calculates number of genes per cell (n_genes) and number of counts per cell (n_counts). Loosely based on calculate_qc_metrics from scanpy [WAT18]. Updates
obsandvarwith columns with qc data.- Parameters:
- adata
AnnData AnnData object
- expr_type
str(default:'counts') Name of kind of values in X.
- var_type
str(default:'genes') The kind of thing the variables are.
- qc_vars
str|list(default:None) Keys for boolean columns of
varwhich identify variables you could want to control for (e.g. Mito). Create these boolean columns before calculating QC metrics.- log1p
bool(default:True) Set to
Falseto skip computinglog1ptransformed annotations.- use
LayerAcc|str|None(default:None) Which matrix to use for expression values, e.g.
A.XorA.layers['counts']. Strings are resolved byanndata.acc.AdAcc.resolve(), e.g.'layers.counts'.- out
MultiAcc|str|QcMetricsOut|bool|Default(default:True (settings.preset='scanpy-v1' – changes in 2.0)) Where to write the metrics. If
False, they are written as columns of.obsand.var(see below). An accessor likeA.obsm['qc']writes the metrics tables as whole DataFrames to.obsm['qc']and.varm['qc']instead. A mapping (QcMetricsOut) writes only the tables it names, e.g.{'obs': A.obsm['qc']}. IfTrue, they are returned as aQcMetricsResult. Defaults toTrueifrapids_singlecell.settings.presetisScanpyV1, elseFalse.
- adata
- Return type:
- Returns:
A
QcMetricsResultifout=True, elseNone.- With
out=False, adds the following columns inobs: total_{var_type}_by_{expr_type}E.g. ‘total_genes_by_counts’. Number of genes with positive counts in a cell.
total_{expr_type}E.g. ‘total_counts’. Total number of counts for a cell.
- for
qc_varinqc_vars total_{expr_type}_{qc_var}number of counts per qc_var (e.g total counts mitochondrial genes)
pct_{expr_type}_{qc_var}Proportion of counts of qc_var (percent of counts mitochondrial genes)
- adds the following columns in
var: total_{expr_type}E.g. ‘total_counts’. Sum of counts for a gene.
n_genes_by_{expr_type}E.g. ‘n_cells_by_counts’. Number of cells this expression is measured in.
mean_{expr_type}E.g. “mean_counts”. Mean expression over all cells.
pct_dropout_by_{expr_type}E.g. ‘pct_dropout_by_counts’. Percentage of cells this feature does not appear in.
- With