TCT.name_resolver

This is a wrapper around the Name Resolver API.

API docs: https://name-lookup.ci.transltr.io/docs

TCT.name_resolver.URL = 'https://name-lookup.ci.transltr.io/'

This is the root URL for the API.

TCT.name_resolver.batch_lookup(strings: list[str], size: int = 25, return_top_response: bool = True, return_synonyms: bool = False, **kwargs) dict[source]

A wrapper around the bulk-lookup api endpoint. Given a list of query strings, this returns a TranslatorNode object or a list of TranslatorNode objects corresponding to the given name.

Parameters:
stringslist[str]

List of query strings.

sizeint

Desired chunking size, default is 25.

return_top_responsebool

If true, this returns only the top response per string. If false, this returns a list of all responses per string. Default: True

return_synonymsbool

If true, the resulting TranslatorNode objects contain a list of synonyms. If false, they do not include synonyms. Default: False

**kwargs

Other arguments to bulk-lookup

Returns:
Dict of stringTranslatorNode object if return_top_response is True, list of TranslatorNode objects if return_top_response is False

Examples

>>> batch_lookup(['AML', 'CML'])
{'AML': TranslatorNode(curie='MONDO:0018874', label='acute myeloid leukemia',...),
 'CML': TranslatorNode(curie='MONDO:0010809', label='familial chronic myelocytic leukemia-like syndrome',...)}
TCT.name_resolver.lookup(query: str, return_top_response: bool = True, return_synonyms: bool = False, **kwargs)[source]

A wrapper around the lookup api endpoint. Given a query string, this returns a TranslatorNode object or a list of TranslatorNode objects corresponding to the given name.

Parameters:
querystr

Query string

return_top_responsebool

If true, this returns only the top response. If false, this returns a list of all responses. Default: True

return_synonymsbool

If true, the resulting TranslatorNode objects contain a list of synonyms. If false, they do not include synonyms. Default: False

**kwargs

Other arguments to lookup

Returns:
TranslatorNode object if return_top_response is True, list of TranslatorNode objects if return_top_response is False

Examples

>>> lookup('AML')
TranslatorNode(curie='MONDO:0018874', label='acute myeloid leukemia', types=['biolink:Disease', 'biolink:DiseaseOrPhenotypicFeature', 'biolink:BiologicalEntity', 'biolink:ThingWithTaxon', 'biolink:NamedThing', 'biolink:Entity'], synonyms=None, curie_synonyms=None)
TCT.name_resolver.synonyms(query: str, **kwargs)[source]

A wrapper around the synonyms api endpoint. Given a query string, this returns a dict of CURIE id : TranslatorNode for all synonyms for the given query.

Parameters:
querystr

Query CURIE

**kwargs

Other arguments to synonyms

Returns:
Dict of CURIE idTranslatorNode