diff --git a/pygoslin/data/goslin/Goslin.g4 b/pygoslin/data/goslin/Goslin.g4 index c502b6d..7903ae6 100644 --- a/pygoslin/data/goslin/Goslin.g4 +++ b/pygoslin/data/goslin/Goslin.g4 @@ -180,7 +180,7 @@ mediator_functional_group_clear: mediator_full_function | mediator_function_unkn mediator_function_unknown_pos : mediator_functions; mediator_functions : mediator_mono_functions | mediator_di_functions; mediator_mono_functions: 'H' | 'Oxo' | 'oxo' | 'OXO' | 'Hp' | 'HP' | 'NO2'; -mediator_di_functions: 'E' | 'Ep' | 'DH' | 'DiH' | 'diH'; +mediator_di_functions: 'E' | 'Ep' | 'EP' | 'DH' | 'DiH' | 'diH'; mediator_full_function : mediator_position_group '-' mediator_mono_functions | mediator_di_pos '-' mediator_di_functions; mediator_di_pos: mediator_position_group ',' mediator_position_group | mediator_position_group '_' mediator_position_group | mediator_position_group '(' mediator_position_group ')'; mediator_position_group : mediator_position | mediator_position mediator_position_isotope | mediator_position '(' mediator_position_isotope ')'; diff --git a/pygoslin/data/goslin/trivial_mediators.csv b/pygoslin/data/goslin/trivial_mediators.csv new file mode 100644 index 0000000..fb34cf4 --- /dev/null +++ b/pygoslin/data/goslin/trivial_mediators.csv @@ -0,0 +1,106 @@ +9S-HpODE 10,12 +13-Oxo-ODE 9,11 +9S-HOTrE 10,12,15 +13S-HpODE 9,11 +13R-HODE 9,11 +9(10)-EpOME 12 +12(13)-EpOME 9 +13S-HOTrE 9,11,15 +12,13S-EOT 9,11,15 +8R-HpOME 9 +13R-HpOME 11 +13S-HpOME 11 +12R-HpOME 13 +12S-HpOME 13 +14R-HpOME 12 +14S-HpOME 12 +12R-HpOME 13 +12S-HpOME 13 +10R-HpOME 11 +7-HpOME 5 +8-HpOME 6 +9-HpOME 7 +11-HpOME 9 +12-HpOME 10 +10R-HOME 11 +10S-HOME 11 +12R-HOME 13 +12S-HOME 13 +11R-HOME 12 +11S-HOME 12 +12R-HOME 10 +12S-HOME 10 +12R-HOME 13 +12S-HOME 13 +13R-HOME 11 +13S-HOME 11 +11R-HOME 12 +11S-HOME 12 +6-HpOME 7 +13-HpOME 14 +8R-HpODE 9,12 +13S-HpOTrE 9,11,14 +11S-HpODE 9,12 +9-HODE 10,12 +9S-HODE 10,12 +12R-HODE 9,15 +13R-HODE 9,11 +8R-HOME 9 +7S,8S-DiHODE 9,12 +7S,8S-DiHOME 9 +7S,8S-DiHOTrE 9,12,15 +8S-HODE 9,12 +13S-HODE 9,11 +9,10-DiHOME 12 +12,13-DiHOME 9 +9-OxoODE 10,12 +12,13S-EpODE 9,11 +12S,13R-EpOME 9 +9R,10S-EpOME 12 +8R-HODE 9,12 +17R,18S-EpETE 5,8,11,14 +5S,12R-diHETE 6,8,10,14 +12S-HHTrE 5,8,10 +15-HETrE 8,11,13 +5-HETrE 6,8,11 +8-HETrE 9,11,14 +12-oxoHT 5,8,10 +20-HETE 5,8,11,14 +5S-HpETE 6,8,11,14 +15S-HpETE 5,8,11,13 +11R-HETE 5,8,12,14 +8R-HpETE 5,9,11,14 +5,12-DiHETE 6,8,10,14 +8-HETE 5,9,11,14 +9-HETE 5,7,11,14 +11-HETE 5,8,12,14 +12-HETE 5,8,10,14 +12(S)-HETE 5,8,10,14 +12-HETE 5,8,10,14 +15-HETE 5,8,11,13 +15(R)-HETE 5,8,11,13 +5S,11R-DiHETE 6,8,12,14 +15-HPETE 5,8,11,13 +16-HETE 5,8,11,14 +19-HETE 5,8,11,14 +5,15-DiHETE 6,8,11,13 +5-HPETE 6,8,11,14 +13R-HETE 5,8,11,14 +11-HEPE 5,8,12,14,17 +14R,15S-EpETrE 5,8,11 +5,6-EET 8,11,14 +8,9-EET 5,11,14 +11,12-EET 5,8,14 +14,15-EET 5,8,11 +14S,15R-EpETrE 5,8,11 +11S,12R-EpETrE 5,8,14 +11R,12S-EpETrE 5,8,14 +5R,6S-EpETrE 8,11,14 +5S,6R-EpETrE 8,11,14 +8R,9S-EpETrE 5,11,14 +8S,9R-EpETrE 5,11,14 +17,18-diHEPE 5,8,11,13,15 +17R,18R-diHEPE 5,8,11,13,15 +17,18-diHEPE 5,8,11,13,15 +17R,18S-diHEPE 5,8,11,13,15 +10S,17S-DiHDoHE 4,7,11,13,15,19 diff --git a/pygoslin/parser/GoslinParserEventHandler.py b/pygoslin/parser/GoslinParserEventHandler.py index 34e14f7..d2be52b 100644 --- a/pygoslin/parser/GoslinParserEventHandler.py +++ b/pygoslin/parser/GoslinParserEventHandler.py @@ -420,8 +420,13 @@ def build_lipid(self, node): if self.plasmalogen != "" and self.lcb == None and len(self.fa_list) > 0: self.fa_list[0].lipid_FA_bond_type = LipidFaBondType.ETHER_PLASMANYL if self.plasmalogen == "O" else LipidFaBondType.ETHER_PLASMENYL + headgroup = self.prepare_headgroup_and_checks() - + + if self.trivial_mediator and node.get_text() in trivial_mediators: + self.fa_list[0].double_bonds = {p: "" for p in trivial_mediators[node.get_text()]} + self.level = LipidLevel.FULL_STRUCTURE + lipid = LipidAdduct() lipid.adduct = self.adduct lipid.lipid = self.assemble_lipid(headgroup) @@ -518,4 +523,11 @@ def add_heavy_component(self, node): self.adduct.heavy_elements[self.heavy_element] += self.heavy_element_number - +trivial_mediators = {} +tm_dir_name = path.dirname(pygoslin.__file__) +tm_file_name = path.join(tm_dir_name, "data", "goslin", "trivial_mediators.csv") +with open(tm_file_name, mode = "rt", encoding= "utf-8") as tm_infile: + for line in tm_infile: + tokens = line.strip().split("\t") + if len(tokens) != 2: continue + trivial_mediators[tokens[0]] = [int(p) for p in tokens[1].split(",")] diff --git a/pygoslin/parser/LipidBaseParserEventHandler.py b/pygoslin/parser/LipidBaseParserEventHandler.py index 789a25f..caa765b 100644 --- a/pygoslin/parser/LipidBaseParserEventHandler.py +++ b/pygoslin/parser/LipidBaseParserEventHandler.py @@ -87,21 +87,6 @@ def sp_regular_lcb(self): def prepare_headgroup_and_checks(self, allow_class_shift = True): - # checking if head group is a glyco-sphingolipid - """ - hg = self.head_group.lower() - if hg in glyco_table: - for carbohydrate in glyco_table[hg]: - try: - - functional_group = get_functional_group(carbohydrate) - functional_group.elements[Element.O] -= 1 - self.headgroup_decorators.append(functional_group) - except Exception: - raise LipidParsingException("Carbohydrate '%s' unknown" % carbohydrate) - self.head_group = "Cer" - """ - headgroup = HeadGroup(self.head_group, self.headgroup_decorators, self.use_head_group) if self.use_head_group: return headgroup diff --git a/setup.py b/setup.py index 7522547..5d1aab7 100644 --- a/setup.py +++ b/setup.py @@ -63,6 +63,6 @@ python_requires = '>=3.5', include_package_data = True, package_data = { - '': ['data/goslin/*.g4', 'data/goslin/*.G4', 'data/goslin/lipid-list.csv', 'data/goslin/functional-groups.csv'], + '': ['data/goslin/*.g4', 'data/goslin/*.G4', 'data/goslin/lipid-list.csv', 'data/goslin/functional-groups.csv', 'data/goslin/trivial_mediators.csv'], } )