alphapepttools.tl.diff_exp_alphaquant

alphapepttools.tl.diff_exp_alphaquant#

alphapepttools.tl.diff_exp_alphaquant(adata, report, between_column, comparison, min_valid_values=2, valid_values_filter_mode='either', plots='hide')#

Calculate differential expression using AlphaQuant.

Parameters:
  • adata (AnnData) – AnnData object containing the expression data and sample metadata.

  • report (DataFrame) – DataFrame with quantification report data for AlphaQuant analysis.

  • between_column (str) – Column name in adata.obs containing group labels for comparison.

  • comparison (tuple) – Tuple of exactly two group names to compare.

  • min_valid_values (int (default: 2)) – Minimum number of valid values required per group for statistical testing.

  • valid_values_filter_mode (str (default: 'either')) – How to apply the min_valid_values filter - ‘either’ or ‘both’.

  • plots (str (default: 'hide')) – Whether to ‘show’ or ‘hide’ AlphaQuant’s generated plots.

Return type:

DataFrame

Returns:

pd.DataFrame Standardized results for all three analysis levels stacked into a single frame. The modality column holds ‘protein’, ‘proteoform’ or ‘peptide’ and is used to select the level of interest; the feature_id column holds each row’s own identifier (protein accession, proteoform id or peptide sequence) and is never NaN. The comparison key (e.g. “Group1_VS_Group2”) is carried in the condition_pair column.

Notes

Columns that only exist at one level (sequence for peptides, proteoform_id, peptides and num_peptides for proteoforms) are NaN on the rows of the other levels. As a consequence of stacking, num_peptides is of dtype float64 rather than int64.

Raises:
  • ImportError – If alphaquant is not installed.

  • ValueError – If plots is not ‘hide’ or ‘show’, if between_column is not in adata.obs, or if comparison is not a tuple of exactly two elements.

Examples

Run differential expression analysis between treatment groups:

alphaquant_results = at.tl.diff_exp_alphaquant(
    adata=adata_precursor,
    report=full_report,
    between_column="treatment",
    comparison=("control", "treated"),
    valid_values_filter_mode="either",
    min_valid_values=3,
    plots="hide",
)

# Access results for different levels
protein_results = alphaquant_results[alphaquant_results["modality"] == "protein"]
peptide_results = alphaquant_results[alphaquant_results["modality"] == "peptide"]
proteoform_results = alphaquant_results[alphaquant_results["modality"] == "proteoform"]