liana.rs.get_metalinks#
- liana.rs.get_metalinks(db_path=None, types=None, cell_location=None, tissue_location=None, biospecimen_location=None, disease=None, pathway=None, hmdb_ids=None, uniprot_ids=None, source=None, *, split=False)#
Fetches edges of metabolite-proteins with specified annotations, applying filters if they are not None.
- Overloads:
db_path (
str|Path|None) =None, types (str|list[str] |None) =None, cell_location (str|list[str] |None) =None, tissue_location (str|list[str] |None) =None, biospecimen_location (str|list[str] |None) =None, disease (str|list[str] |None) =None, pathway (str|list[str] |None) =None, hmdb_ids (str|list[str] |None) =None, uniprot_ids (str|list[str] |None) =None, source (str|list[str] |None) =None, *, split (Literal[False]) =False→DataFramedb_path (
str|Path|None) =None, types (str|list[str] |None) =None, cell_location (str|list[str] |None) =None, tissue_location (str|list[str] |None) =None, biospecimen_location (str|list[str] |None) =None, disease (str|list[str] |None) =None, pathway (str|list[str] |None) =None, hmdb_ids (str|list[str] |None) =None, uniprot_ids (str|list[str] |None) =None, source (str|list[str] |None) =None, *, split (Literal[True]) →tuple[DataFrame,DataFrame,DataFrame|None]db_path (
str|Path|None) =None, types (str|list[str] |None) =None, cell_location (str|list[str] |None) =None, tissue_location (str|list[str] |None) =None, biospecimen_location (str|list[str] |None) =None, disease (str|list[str] |None) =None, pathway (str|list[str] |None) =None, hmdb_ids (str|list[str] |None) =None, uniprot_ids (str|list[str] |None) =None, source (str|list[str] |None) =None, *, split (bool) =False→DataFrame|tuple[DataFrame,DataFrame,DataFrame|None]
Allows filtering by lists of hmdb and uniprot IDs and avoids duplicate column names, and returns the results as a pandas DataFrame. Filters are applied using INNER JOINs and WHERE clauses - i.e. the results are the intersection of the filters.
- Parameters:
- db_path
str|Path|None(default:None) Path to the SQLite database file. If None, the database is fetched into
scanpy.settings.datasetdirand reused from there.- types
str|list[str] |None(default:None) Desired edge types. Options are: [‘lr’, ‘pd’], where ‘lr’ stands for ‘ligand-receptor’ and ‘pd’ stands for ‘production-degradation’.
- cell_location
str|list[str] |None(default:None) Desired metabolite cell locations.
- tissue_location
str|list[str] |None(default:None) Desired metabolite tissue locations.
- biospecimen_location
str|list[str] |None(default:None) Desired metabolite biospecimen locations.
- disease
str|list[str] |None(default:None) Desired metabolite diseases.
- pathway
str|list[str] |None(default:None) Desired metabolite pathways.
- hmdb_ids
str|list[str] |None(default:None) Desired HMDB IDs.
- uniprot_ids
str|list[str] |None(default:None) Desired UniProt IDs.
- source
str|list[str] |None(default:None) Desired source databases.
- split
bool(default:False) Whether to split the edges into the inputs of
liana.mt.estimate_metalinks(). Requires both ‘lr’ and ‘pd’types, which is also the default whentypesis None.
- db_path
- Returns:
- If
splitis False, a pandas DataFrame with one row per edge and curatingsource, so an edge annotated by several databases appears once per database and a per-edge mean of
moris a vote across them.
If
splitis True, a tuple of(resource, pd_net, t_net):resource: the unique metabolite-receptor pairs of the ‘lr’ edges, withligandandreceptorcolumns.pd_net: the ‘pd’ edges assource(metabolite),target(gene), andweight– the meanmoracross curating databases, so +1 is production, -1 is degradation, and 0 is a tie that is kept.t_net: the ‘pd’ edges with a transport direction, with export (‘out’) as +1 and import (‘in’) as -1, averaged per edge and with ties (0) removed; None if no such edges remain.
- If
Examples
This function downloads MetalinksDB on first use, so it is not run here. Metabolite-receptor edges restricted to secreted metabolites are obtained with:
resource = get_metalinks( types=["lr"], biospecimen_location="Blood", )
With
split=True, the edges are instead returned as the inputs ofliana.mt.estimate_metalinks():resource, pd_net, t_net = get_metalinks(biospecimen_location="Blood", split=True) mdata = li.mt.estimate_metalinks(adata, resource, pd_net=pd_net, t_net=t_net)