grassp.pp.calculate_qc_metrics

grassp.pp.calculate_qc_metrics#

calculate_qc_metrics(data, qc_vars=(), percent_top=(50, 100, 200, 500), layer=None, use_raw=False, inplace=True, log1p=True, var_type='proteins', expr_type='intensity', parallel=None)[source]#

Calculate quality control metrics.

This function is a wrapper around scanpy.pp.calculate_qc_metrics() scanpy.pp.calculate_qc_metrics. It calculates quality control metrics for proteins and samples and adds them to data.obs and data.var.

Parameters:
data AnnData

The annotated data matrix.

qc_vars Union[Collection[str], str] (default: ())

Column names in .obs to add to the QC metrics.

percent_top Optional[Collection[int]] (default: (50, 100, 200, 500))

Which proportions of top genes to cover.

layer str | None (default: None)

Layer to use for QC metric calculation.

use_raw bool (default: False)

Whether to use .raw for calculation.

inplace bool (default: True)

Whether to add the QC metrics to the AnnData object.

log1p bool (default: True)

Whether to log1p the expression values before calculating QC metrics.

var_type str (default: 'proteins')

The type of variables in the data.

expr_type str (default: 'intensity')

The type of expression values in the data.

parallel bool | None (default: None)

Whether to run the calculation in parallel.

Return type:

tuple[DataFrame, DataFrame] | None

Returns:

if inplace=True.

None and modifies the data .obs and .var with the QC metrics.

if inplace=False, a tuple with protein-wise and sample-wise QC metrics:
  • protein_qc_metrics: pd.DataFrame with protein-wise QC metrics

  • sample_qc_metrics: pd.DataFrame with sample-wise QC metrics