.summarize_overlapping_peptides

proteopy.pp.summarize_overlapping_peptides(adata, peptide_col='peptide_id', group_by='peptide_group', layer=None, func='sum', inplace=True)[source]

Aggregate intensities across peptides sharing the same group_col.

  • Sums intensities in adata.X within each group (NaN-aware).

  • Uses the longest peptide_id in each group as the new var_name.

  • Keeps both the representative peptide_id as a column and index.

  • Retains the grouping key as 'peptide_group'.

  • Concatenates differing .var annotations using ';'.

Parameters:
  • adata (AnnData) – Input AnnData with quantitative data and annotations.

  • peptide_col (str) – Column in adata.var containing peptide identifiers (or will be created from var_names).

  • group_by (str) – Column in adata.var specifying grouping (e.g. 'peptide_group' or 'proteoform_id').

  • layer (str, optional) – Key in adata.layers specifying which matrix to aggregate; defaults to .X.

  • func ({'sum', 'mean', 'median', 'max'} or Callable) – Aggregation applied across peptides in each group.

  • inplace (bool) – If True, modifies adata in place. Otherwise returns a new AnnData.

Returns:

Aggregated AnnData if inplace=False, else modifies in place.

Return type:

AnnData | None