From 8c7ed24ae550f2e48cb004d8f305361a56c55703 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Nov 2024 14:06:53 +0100 Subject: [PATCH] corrected indentation error on swisslipids; in loader use inchi instead of smiles --- omnipath_metabo/schema/_main.py | 4 ++-- omnipath_metabo/schema/_structure.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/omnipath_metabo/schema/_main.py b/omnipath_metabo/schema/_main.py index f9d901d..932a1fa 100644 --- a/omnipath_metabo/schema/_main.py +++ b/omnipath_metabo/schema/_main.py @@ -91,7 +91,7 @@ def chem_properties_populate(self): query = text(r""" UPDATE identifiers SET - is_polymer = (structures.smiles ~ '.*\)n.*'), + is_polymer = (structures.inchi ~ '.*\)n.*'), has_conformation = (structures.smiles ~ '.*[\\/]=.*'), has_stereo = (structures.smiles ~ '.*@.*'), complete_formula = NOT (structures.smiles ~ '.*\*.*') @@ -146,7 +146,7 @@ def load(self): with raw_con.cursor() as cursor: query = """ - INSERT INTO structures (name, smiles) VALUES %s ON CONFLICT (smiles) DO nothing; + INSERT INTO structures (name, smiles, inchi) VALUES %s ON CONFLICT (inchi) DO nothing; """ _log("loading insert statments for structures table") cached_resource = Tee( diff --git a/omnipath_metabo/schema/_structure.py b/omnipath_metabo/schema/_structure.py index 2d4bc71..ae1d590 100644 --- a/omnipath_metabo/schema/_structure.py +++ b/omnipath_metabo/schema/_structure.py @@ -118,10 +118,10 @@ class SwissLipids(): name = 'SwissLipids' def __iter__(self): for met in swisslipids.swisslipids_lipids(): - if met['Mass (pH7.3)'] == '': - mass = 0 - else: - mass = met['Mass (pH7.3)'] + if met['Mass (pH7.3)'] == '': + mass = 0 + else: + mass = met['Mass (pH7.3)'] yield { 'structure': (