Unimod mapper¶
-
class
pyqms.
UnimodMapper
¶ UnimodMapper class that creates lookup to the unimod.xml located in kb/ext/unimod.xml and offers several helper methods.
Mapping from e.g. name to composition or unimod ID to mass is possible.
Please refer to unimod for further informations on modifications including naming, formulas, masses etc.
-
appMass2element_list
(mass, decimal_places=2)¶ Creates a list of element composition dicts for a given approximate mass
Parameters: mass (float) – approximate mass of modification Keyword Arguments: decimal_places (int) – Precision with which the masses in the Unimod is compared to the input, i.e. round( mass, decimal_places ) Returns: Dicts of elements Return type: list Examples:
>>> import pyqms >>> U = pyqms.UnimodMapper() >>> U.appMass2element_list(18, decimal_places=0) [{'F': 1, 'H': -1}, {'13C': 1, 'H': -1, '2H': 3}, {'H': -2, 'C': -1, 'S': 1}, {'H': 2, 'C': 4, 'O': -2}, {'H': -2, 'C': -1, 'O': 2}]
-
appMass2id_list
(mass, decimal_places=2)¶ Creates a list of unimod IDs for a given approximate mass
Parameters: mass (float) – approximate mass of modification Keyword Arguments: decimal_places (int) – Precision with which the masses in the Unimod is compared to the input, i.e. round( mass, decimal_places ) Returns: Unimod IDs Return type: list Examples:
>>> import pyqms >>> U = pyqms.UnimodMapper() >>> U.appMass2id_list(18, decimal_places=0) ['127', '329', '608', '1079', '1167']
-
appMass2name_list
(mass, decimal_places=2)¶ Creates a list of unimod names for a given approximate mass
Parameters: mass (float) – approximate mass of modification Keyword Arguments: decimal_places (int) – Precision with which the masses in the Unimod is compared to the input, i.e. round( mass, decimal_places ) Returns: Unimod names Return type: list Examples:
>>> import pyqms >>> U = pyqms.UnimodMapper() >>> U.appMass2name_list(18, decimal_places=0) ['Fluoro', 'Methyl:2H(3)13C(1)', 'Xle->Met', 'Glu->Phe', 'Pro->Asp']
-
composition2id_list
(composition)¶ Converts unimod composition to unimod name list, since a given composition can map to mutiple entries in the XML.
Parameters: composition (dict) – element composition (element, count pairs) Returns: Unimod IDs Return type: list
-
composition2mass
(composition)¶ Converts unimod composition to unimod monoisotopic mass.
Parameters: composition (dict) – element composition (element, count pairs) Returns: monoisotopic mass Return type: float
-
composition2name_list
(composition)¶ Converts unimod composition to unimod name list, since a given composition can map to mutiple entries in the XML.
Parameters: composition (dict) – element composition (element, count pairs) Returns: Unimod names Return type: list
-
id2composition
(unimod_id)¶ Converts unimod ID to unimod composition
Parameters: unimod_id (int) – identifier of modification Returns: Unimod elemental composition Return type: dict
-
id2mass
(unimod_id)¶ Converts unimod ID to unimod mass
Parameters: unimod_id (int) – identifier of modification Returns: Unimod mono isotopic mass Return type: float
-
id2name
(unimod_id)¶ Converts unimod ID to unimod name
Parameters: unimod_id (int) – identifier of modification Returns: Unimod name Return type: str
-
mass2composition_list
(mass)¶ Converts unimod mass to unimod element composition list, since a given mass can map to mutiple entries in the XML.
Parameters: mass (float) – mass of modification Returns: Unimod elemental compositions Return type: list
-
mass2id_list
(mass)¶ Converts unimod mass to unimod name list, since a given mass can map to mutiple entries in the XML.
Parameters: mass (float) – mass of modification Returns: Unimod IDs Return type: list
-
mass2name_list
(mass)¶ Converts unimod mass to unimod name list, since a given mass can map to mutiple entries in the XML.
Parameters: mass (float) – mass of modification Returns: Unimod names Return type: list
-
name2composition
(unimod_name)¶ Converts unimod name to unimod composition
Parameters: unimod_name (str) – name of modification (as named in unimod) Returns: Unimod elemental composition Return type: dict
-
name2id
(unimod_name)¶ Converts unimod name to unimod ID
Parameters: unimod_name (str) – name of modification (as named in unimod) Returns: Unimod ID Return type: int
-
name2mass
(unimod_name)¶ Converts unimod name to unimod mono isotopic mass
Parameters: unimod_name (str) – name of modification (as named in unimod) Returns: Unimod mono isotopic mass Return type: float
-
name2specificity_site_list
(unimod_name)¶ Converts unimod name to list of specified amino acids or sites
Parameters: unimod_name (str) – name of modification (as named in unimod) Returns: list of specificity sites Return type: list
-