Skip to content

Commit

Permalink
Load NCBI taxonomy IDs for MeSH
Browse files Browse the repository at this point in the history
  • Loading branch information
bgyori committed Aug 13, 2024
1 parent 19b1429 commit a140819
Show file tree
Hide file tree
Showing 3 changed files with 30,781 additions and 30,766 deletions.
12 changes: 11 additions & 1 deletion indra/databases/mesh_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
mesh_name_to_id_name = {}
mesh_id_to_tree_numbers = {}
mesh_supp_to_primary = {}
mesh_to_ncbitaxon = {}
ncbitaxon_to_mesh = {}


def _load_mesh_file(path, supplementary):
Expand All @@ -31,7 +33,15 @@ def _load_mesh_file(path, supplementary):
mesh_id, mesh_label, mesh_terms_str, mapped_to_str = terms
mesh_supp_to_primary[mesh_id] = mapped_to_str.split(',')
else:
mesh_id, mesh_label, mesh_terms_str, tree_number_str = terms
mesh_id, mesh_label, mesh_terms_str, \
tree_number_str, taxon_ids = terms
if taxon_ids:
taxon_ids = taxon_ids.split('|')
for taxon_id in taxon_ids:
# Note that these seem to be one-to-one so
# we don't need to worry about overwriting
ncbitaxon_to_mesh[taxon_id] = mesh_id
mesh_to_ncbitaxon[mesh_id] = taxon_ids
# This is a rare corner case where an entry is outside the
# tree structure, e.g., D005260, D008297
if not tree_number_str:
Expand Down
Loading

0 comments on commit a140819

Please sign in to comment.