Skip to content

Commit

Permalink
Make different drugs inherit from a generic drug concept
Browse files Browse the repository at this point in the history
  • Loading branch information
leungmanhin committed May 8, 2020
1 parent da56bfd commit c5389a3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drugbank.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def get_pubchem_cid(sid):
# If no desired external IDs is found, use the DrugBank ID
id_dict[drugbank_id] = "DrugBank:" + drugbank_id

# Finally do the conversion for each of the drugs
drug_groups = []
for drug in xml_root:
drugbank_id = get_child_tag_text(drug, "drugbank-id")
standard_id = id_dict.get(drugbank_id)
Expand All @@ -152,8 +154,11 @@ def get_pubchem_cid(sid):
evalink("has_description", "MoleculeNode", "ConceptNode", standard_id, description)

for group in findall_tag(find_tag(drug, "groups"), "group"):
drug_group = group.text
inhlink("MoleculeNode", "ConceptNode", standard_id, drug_group + " drug")
drug_group = group.text + " drug"
inhlink("MoleculeNode", "ConceptNode", standard_id, drug_group)
if drug_group not in drug_groups:
inhlink("ConceptNode", "ConceptNode", drug_group, "drug")
drug_groups.append(drug_group)

for article in findall_tag(find_tag(find_tag(drug, "general-references"), "articles"), "article"):
pubmed_id = get_child_tag_text(article, "pubmed-id")
Expand Down

0 comments on commit c5389a3

Please sign in to comment.