Skip to content

Commit

Permalink
more work on RaMP identifiers insertion
Browse files Browse the repository at this point in the history
  • Loading branch information
for-hyde committed Nov 19, 2024
1 parent 4370cbd commit 36f6916
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 4 additions & 3 deletions omnipath_metabo/schema/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ def load(self):
)
psycopg2.extras.execute_values(cursor, query, cached_resource, page_size = 1000)

type(cached_resource)

raw_con.commit()
_log("structures have been inserted")
_log("structures have been inserted", level = -1)

return_ids = text("SELECT id, smiles FROM structures")
inserted_str = {
Expand All @@ -185,7 +186,7 @@ def load(self):


#vself.update_mol_column()
_log('resource ids collected.')
_log('resource ids collected.', level = -1)

insert_ids = (
(_id, strids[smiles], resource_key, i==0, resource_labels[i])
Expand All @@ -195,7 +196,7 @@ def load(self):
for i, _id in enumerate(itertools.chain((name, ), cached_resource.cached['struct']['identifiers']))
)

_log('inserting identifiers.')
_log('inserting identifiers.', level =-1)
with raw_con.cursor() as cursor:
query = """
INSERT INTO identifiers (identifier, structure_id, resource_id, authoritative, id_type) VALUES %s
Expand Down
5 changes: 2 additions & 3 deletions omnipath_metabo/schema/_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ def __iter__(self):
class Ramp(ResourceBase):
scheme = Structure
name = 'RaMP'
id_fields = sorted(ramp.ramp_id_types())

def __iter__(self):

Expand All @@ -201,9 +200,9 @@ def __iter__(self):
'identifiers': (row[2])
}

'''Alternative possibility
'''Alternative possibility without editing
source_data = {
row[]:row[] for row in ramp.ramp_iter('source')
row[1]:row[0] for row in ramp.ramp_iter('source')
}
for chem_props_row in ramp.ramp_iter('chem_props'):
source_row = source_data.get(chem_props_row[0])
Expand Down

0 comments on commit 36f6916

Please sign in to comment.