alphapepttools.tl.diff_exp_ebayes

alphapepttools.tl.diff_exp_ebayes#

alphapepttools.tl.diff_exp_ebayes(adata, between_column, comparison)#

Run Limma eBayes moderated ttest for differential expression.

Parameters:
  • adata (AnnData) – AnnData object with expression data in .X and sample metadata in .obs.

  • between_column (str) – Column name in adata.obs containing the contrast levels.

  • comparison (tuple[str, str]) – Two levels to compare, meant to follow the convention (treatment, control).

Return type:

tuple[str, DataFrame]

Returns:

tuple[str, pd.DataFrame] Tuple containing: - comparison_key: String identifier for the comparison (e.g., “treatment_VS_control”) - result_df: DataFrame with standardized Limma eBayes differential expression results.

Raises:
  • ImportError – If inmoose is not installed.

  • ValueError – If specified levels are not found in the between_column.

Notes

This implementation removes all features with any missing values to ensure compatibility with the inmoose Limma implementation. If features with missing values should be retained, their missing values must be imputed prior to running this function.

Examples

Run empirical Bayes moderated t-test between treatment groups:

comparison_key, ebayes_results = at.tl.diff_exp_ebayes(
    adata=adata_precursor,
    between_column="treatment",
    comparison=("treated", "control"),
)

# Access significant proteins
significant = ebayes_results[ebayes_results["fdr"] < 0.05]