omicverse.metabol.corr_network#
- omicverse.metabol.corr_network(adata, *, group_col=None, group=None, features=None, method='spearman', abs_r_threshold=0.5, padj_threshold=0.05, layer=None)[source]#
Pairwise metabolite correlation network within a single condition.
- Parameters:
group_col (
Optional[str] (default:None)) – If both given, restrict to samples whereadata.obs[group_col] == group. Ifgroup_colis given butgroupis None aValueErroris raised — partial filtering makes no sense. If both are None, all samples are used.group (
Optional[str] (default:None)) – If both given, restrict to samples whereadata.obs[group_col] == group. Ifgroup_colis given butgroupis None aValueErroris raised — partial filtering makes no sense. If both are None, all samples are used.features (
Optional[Sequence[str]] (default:None)) – Optional subset of metabolite names (reduces O(p^2)).method (
str(default:'spearman')) –"spearman"(default, heavy-tailed-friendly) or"pearson".abs_r_threshold (
float(default:0.5)) – Keep pairs with|r| >= abs_r_thresholdin the output edge list.padj_threshold (
float(default:0.05)) – Keep pairs with BH-FDRpadj < padj_threshold.layer (
Optional[str] (default:None)) – AnnData layer (defaultNone→adata.X).
- Returns:
Filtered edge list, columns
feature_a, feature_b, r, pvalue, padj. Sorted by|r|descending. Intended as input tonetworkx.Graph(nx.from_pandas_edgelist(df, source='feature_a', target='feature_b', edge_attr='r')).- Return type:
pd.DataFrame