mgkit.mappings.enzyme module¶
New in version 0.1.14.
EC mappings
-
mgkit.mappings.enzyme.
change_mapping_level
(ec_map, level=3)¶ New in version 0.1.14.
Given a dictionary, whose values are dictionaries, in which a key is named ec and its value is an iterable of EC numbers, returns an iterator that can be used to build a dictionary with the same top level keys and the values are sets of the transformed EC numbers.
Parameters: - ec_map (dict) – dictionary generated by
mgkit.net.uniprot.get_gene_info()
- level (int) – number from 1 to 4, to specify the level of the mapping,
passed to
get_enzyme_level()
Yields: tuple – a tuple (gene_id, set(ECs)), which can be passed to dict to make a dictionary
Example
>>> from mgkit.net.uniprot import get_gene_info >>> from mgkit.mappings.enzyme import change_mapping_level >>> ec_map = get_gene_info('Q9HFQ1', columns='ec') {'Q9HFQ1': {'ec': '1.1.3.4'}} >>> dict(change_mapping_level(ec_map, level=2)) {'Q9HFQ1': {'1.1'}}
- ec_map (dict) – dictionary generated by
-
mgkit.mappings.enzyme.
get_enzyme_full_name
(ec_id, ec_names, sep=', ')¶ New in version 0.2.1.
From a EC identifiers and a dictionary of names builds a comma separated name (by default) that identifies the function of the enzyme.
Parameters: - ec_id (str) – EC identifier
- ec_names (dict) – a dictionary of names that can be produced using
parse_expasy_file()
- sep (str) – string used to join the names
Returns: the enzyme classification name
Return type:
-
mgkit.mappings.enzyme.
get_enzyme_level
(ec, level=4)¶ New in version 0.1.14.
Returns an enzyme class at a specific level , between 1 and 4 (by default the most specific, 4)
Parameters: Returns: the EC number at the requested specificity
Return type: Example
>>> from mgkit.mappings.enzyme import get_enzyme_level >>> get_enzyme_level('1.1.3.4', 1) '1' >>> get_enzyme_level('1.1.3.4', 2) '1.1' >>> get_enzyme_level('1.1.3.4', 3) '1.1.3' >>> get_enzyme_level('1.1.3.4', 4) '1.1.3.4'
-
mgkit.mappings.enzyme.
get_mapping_level
(ec_map, level=3)¶ New in version 0.3.0.
Given a dictionary, whose values are iterable of EC numbers, returns an iterator that can be used to build a dictionary with the same top level keys and the values are sets of the transformed EC numbers.
Parameters: - ec_map (dict) – dictionary genes to EC
- level (int) – number from 1 to 4, to specify the level of the mapping,
passed to
get_enzyme_level()
Yields: tuple – a tuple (gene_id, set(ECs)), which can be passed to dict to make a dictionary
-
mgkit.mappings.enzyme.
parse_expasy_file
(file_name)¶ Used to load enzyme descriptions from the file enzclass.txt on expasy.
The FTP url for enzclass.txt is: ftp://ftp.expasy.org/databases/enzyme/enzclass.txt