pypath.utils.mapping.MappingTable§

class pypath.utils.mapping.MappingTable(data, id_type, target_id_type, ncbi_tax_id, lifetime=300)[source]§

Bases: Logger

This is the class directly handling ID translation data. It does not care about loading it or what kind of IDs these only accepts the translation dictionary.

lifetimeint

If this table has not been used for longer than this preiod it is to be removed at next cleanup. Time in seconds.

__init__(data, id_type, target_id_type, ncbi_tax_id, lifetime=300)[source]§

Wrapper around a dictionary of identifier mapping. The dictionary is located in the data attribute, keys are the source identifiers, values are sets of target identifiers. Most often the mapping is unambigous, which means one target identifier for each source identifier.

Args

data (dict): The identifier translation dictionary. id_type (str): The source ID type. target_id_type (str): The target ID type. ncbi_tax_id (int): NCBI Taxonomy identifier of the organism. lifetime (int): Time in seconds to keep the table loaded in

the memory. If not used, the table will be unloaded after this time. Each usage resets the expiry time.

Methods

__init__(data, id_type, target_id_type, ...)

Wrapper around a dictionary of identifier mapping.

get_key()

Creates a mapping table key, a tuple with all the defining properties of the mapping table.

reload()

Attributes

items

key

keys

values

get_key()[source]§

Creates a mapping table key, a tuple with all the defining properties of the mapping table.