patpy.pp.calculate_cell_qc_metrics

patpy.pp.calculate_cell_qc_metrics#

patpy.pp.calculate_cell_qc_metrics(adata, sample_key, cell_qc_vars, agg_function=<function median>)#

Calculate agregated cell quality control metrics for the given AnnData object

Parameters:
  • adata (AnnData) – Annotated data object.

  • sample_key (str) – Key for the sample information in adata.obs

  • cell_qc_vars (list[str]) – List of column keys representing the cell QC variables. For example, number of genes per cell

  • agg_function (Callable = numpy.median) – Aggregation function to use for aggregating cell QC metrics. Default is numpy.median

Return type:

DataFrame

Returns:

-cells_qc_aggregated (DataFrame) DataFrame with samples in rows and aggregated QC metrics in columns

Examples

>>> calculate_cell_qc_metrics(adata, sample_key="scRNASeq_sample_ID", cell_qc_vars=["QC_ngenes", "QC_total_UMI"])
                    median_QC_ngenes  median_QC_total_UMI
scRNASeq_sample_ID
G05061-Ja005E-PBCa            1112.0               3150.0
G05064-Ja005E-PBCa             982.5               2955.0