omicverse.metabol.dgca#
- omicverse.metabol.dgca(adata, *, group_col, group_a=None, group_b=None, features=None, method='pearson', abs_r_threshold=0.3, layer=None)[source]#
Differential correlation between two groups.
- Parameters:
group_col (
str) – Column inadata.obswith the two-class labels.group_a (
Optional[str] (default:None)) – Labels to contrast.None→ first two unique values. The z-diff direction isz_a - z_b(so positivez_diffmeans correlation is stronger in group A).group_b (
Optional[str] (default:None)) – Labels to contrast.None→ first two unique values. The z-diff direction isz_a - z_b(so positivez_diffmeans correlation is stronger in group A).features (
Optional[Sequence[str]] (default:None)) – Optional list of metabolite names to restrict the pair enumeration to.None→ all. Forpfeatures the output hasp*(p-1)/2rows.method (
str(default:'pearson')) –"pearson"(default) or"spearman". Spearman is rank-based and more appropriate for non-Gaussian metabolite distributions; Pearson is faster and matches the DGCA default.abs_r_threshold (
float(default:0.3)) – Threshold for calling a correlation “significant in group X” when assigning thedc_classlabel. Default 0.3 matches MetaboAnalyst’s network module.layer (
Optional[str] (default:None)) – AnnData layer (defaultNone→adata.X).
- Returns:
Long format, one row per feature pair, columns:
feature_a,feature_b— metabolite namesr_a,r_b— correlation in each groupz_diff— Fisher-z-transformed difference test statisticpvalue,padj— two-sided p and BH-FDRdc_class—"+/+","+/0","+/-","0/+","0/-","-/+","-/-", or"0/0". The first symbol is group A, the second group B.+/-means|r| ≥ abs_r_thresholdwith that sign;0means below threshold.
The result is sorted by
padjascending.- Return type:
pd.DataFrame