Metrics
Mixins for computing and updating metadata from .obs, .var, or relational data.
MetricsMixin
Computes descriptive and RS-derived metrics for proteomic data.
This mixin provides utility functions for calculating summary statistics on protein and peptide abundance data, as well as inspecting the structure of the RS (protein × peptide) relational matrix.
Features:
- Computes per-sample quantification and abundance metrics for both proteins and peptides
- Calculates RS-derived properties such as the number of peptides per protein and the number of unique peptides
- Updates
.obs,.var, and.summarywith relevant metrics - Provides visualization and tabular summaries of RS matrix connectivity
Methods:
| Name | Description |
|---|---|
_update_metrics |
Computes per-sample and RS-derived metrics for |
_update_summary_metrics |
Adds per-sample high-confidence protein counts to |
describe_rs |
Returns a DataFrame summarizing peptide connectivity per protein. |
plot_rs |
Generates histograms of peptide–protein and protein–peptide mapping counts. |
Source code in src/scpviz/pAnnData/metrics.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
describe_rs
Summarize the protein–peptide RS (relational) matrix.
Returns a DataFrame with one row per protein, describing its peptide mapping coverage:
peptides_per_protein: Total number of peptides mapped to each protein.unique_peptides: Number of uniquely mapping peptides (peptides linked to only one protein).
Returns:
| Type | Description |
|---|---|
|
pd.DataFrame: Summary statistics for each protein in the RS matrix. |
Note
If .prot is available, index labels are taken from .prot.var_names.