Skip to content

Commit

Permalink
schema.Hmdb: store id field list; built in data: resource names for…
Browse files Browse the repository at this point in the history
… HMDB
  • Loading branch information
deeenes committed Nov 13, 2024
1 parent 7e81a47 commit 4f42f9c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
15 changes: 15 additions & 0 deletions omnipath_metabo/_data/resource-labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
HMDB:
- kegg_id: KEGG
- bigg_id: BIGG
- pbd_id: PBD
- wikipedia: WikiPedia
- chemspiter: ChemSpider
- fbonto: FBOnto
- chebi: ChEBI
- biocyc_id: BioCyc
- drugbank_id: DrugBank
- foodb_id: FoodDB
- metlin_id: Metlin
- pubchem_compound_id: PubChem
- phenol_explorer_id: Phenol-Explorer
- vmh_id: Virtual Metbolic Human
10 changes: 6 additions & 4 deletions omnipath_metabo/schema/_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class Identifier(Base):
)
authoritative = Column(Boolean)
id_type = Column(
Integer,
ForeignKey('resources.id'),
Integer,
ForeignKey('resources.id'),
nullable = False)
is_polymer = Column(Boolean)
has_stereo = Column(Boolean)
Expand Down Expand Up @@ -102,13 +102,15 @@ class Mappings(Base):
resource_id = Column(String)
chebi_id = Column(String)
pubchem_id = Column(String)




class Hmdb():
scheme = Structure
name = 'HMDB'
id_fields = sorted(f'{s}_id' for s in hmdb.ID_FIELDS)

def __iter__(self):

for met in hmdb.metabolites_processed(
Expand All @@ -118,7 +120,7 @@ def __iter__(self):
'monisotopic_molecular_weight',
'chemical_formula',
'inchi',
*sorted(f'{s}_id' for s in hmdb.ID_FIELDS)
*self.id_fields,
):

yield {
Expand Down

0 comments on commit 4f42f9c

Please sign in to comment.