liana.mt.estimate_metalinks#
- liana.mt.estimate_metalinks(adata, resource, pd_net, t_net=None, x_name='metabolite', y_name='receptor', use_raw=False, layer=None, verbose=False, **kwargs)#
Estimate Metabolites from anndata object, and return a MuData object of metabolites and receptors.
- Parameters:
- adata
AnnData Annotated data matrix.
- resource
DataFrame Resource to use for ligand-receptor inference.
- pd_net
DataFrame Metabolic production-degradation network to use.
- t_net
DataFrame|None(default:None) Transport set to use.
- x_name
str(default:'metabolite') Name of the metabolite modality.
- y_name
str(default:'receptor') Name of the receptor modality. Must be present as a column in the resource.
- use_raw
bool(default:False) Whether to use the
.rawattribute of adata. Defaults to False (uses.X).- layer
str|None(default:None) Layer in anndata.AnnData.layers to use. If None, use anndata.AnnData.X.
- verbose
bool(default:False) Verbosity flag.
- **kwargs
object Additional arguments to pass to the decoupler-py functions. Method-specific arguments are not supported.
- adata
- Return type:
- Returns:
A MuData object with metabolite & receptor assays.
Examples
pd_netis a metabolite-to-enzyme network whose weights say whether a gene produces (+) or degrades (-) a metabolite, andresourcelinks metabolites to their receptors. Both normally come from MetalinksDB (seeliana.rs.get_metalinks()); toy ones are built here so the example stays offline:>>> import numpy as np >>> import pandas as pd >>> import liana as li >>> adata = li.ds.generate_toy_adata() >>> genes = adata.var_names[:16].tolist() >>> pd_net = pd.DataFrame({"source": np.repeat(["HMDB0000122", "HMDB0000148"], 8), "target": genes, "weight": 1.0}) >>> resource = pd.DataFrame({"source": ["HMDB0000122", "HMDB0000148"], "receptor": ["CD4", "ITGB2"]}) >>> mdata = li.mt.estimate_metalinks(adata, resource=resource, pd_net=pd_net)
Metabolite abundances are estimated from the enzyme expression and returned in a
'metabolite'modality, next to the receptors in a'receptor'one. Passt_netto additionally require a transporter for metabolites that cannot cross the membrane on their own. The result is the input toliana.mt.bivariateor to any single-cell method, withx_mod='metabolite'andy_mod='receptor'.