Use pypath's Mapper() class for ID conversion

The class pypath.mapping.Mapper(), also independently from PyPath, can be used for ID translation. The default settings coming with pypath are set with the aim to translate everything to UniProt, and to lower memory consumption, other dictionaries (e.g. translate the reverse way) are not created. But it is possible to provide different input definitions for the Mapper(), so translate between any types of IDs.

In [1]:
from pypath import mapping

m = mapping.Mapper()

At the first translation query the instance loads the ID conversion tables, which takes time, but after the translation is quick:

In [2]:
m.map_name('EGFR', 'genesymbol', 'uniprot')
	:: Loading 'genesymbol' to 'uniprot' mapping table
	:: Loading 'uniprot-sec' to 'uniprot-pri' mapping table
	:: Loading 'genesymbol' to 'trembl' mapping table
In [3]:
m.map_name('207', 'entrez', 'uniprot')
	:: Loading 'entrez' to 'uniprot' mapping table
In [4]:
m.map_name('1950', 'entrez', 'uniprot')