metachat.pp.generate_adata_met_compass
- metachat.pp.generate_adata_met_compass(compass_output, score='Balance', norm='rank', agg='topk_mean', topk=5, **score_kwargs)[source]
Generate processed metabolite matrix for COMPASS analysis using reaction-level penalty scores.
Metabolite-level production / consumption scores are derived from COMPASS reaction penalties via stoichiometric aggregation across all internal reactions that involve each cytoplasmic metabolite. Only metabolites in the
[c]compartment are retained and mapped to HMDB IDs.Reaction metadata (
rxn_md.csv) and metabolite annotation (met_md.csv) are loaded from the package’s built-in data.Parameters
- compass_outputstr
Path to the COMPASS output file.
- scorestr
Score column to extract for each metabolite. One of
"Prod","Cons", or"Balance"(default)."Balance"is production minus consumption.- normstr
Per-reaction normalisation across cells before aggregation.
"rank"(default) uses percentile rank;"minmax"uses min-max scaling.- aggstr
Aggregation method across reactions.
"topk_mean"(default) averages the top-k reactions per cell;"max"takes the maximum.- topkint
Number of top reactions used when
agg="topk_mean". Default 5.- **score_kwargs
Additional keyword arguments forwarded to
_compass_utils.compute_metabolite_scores(), e.g.exclude_transport=False.
Returns
- adata_metanndata.AnnData
AnnData with shape (cells × metabolites).
obsindex = cell IDs;varindex = HMDB IDs.