Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update interpretation of DrugBank actions #1265

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions indra/sources/drugbank/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
from typing import Optional, Sequence, Union
from xml.etree import ElementTree

from .processor import DrugbankProcessor

logger = logging.getLogger(__name__)
Expand Down
97 changes: 73 additions & 24 deletions indra/sources/drugbank/processor.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import logging
from xml.etree import ElementTree
from indra.statements import *
from indra.databases.identifiers import ensure_chebi_prefix, \

from indra.databases.identifiers import ensure_chebi_prefix,\
ensure_chembl_prefix
from indra.ontology.standardize import get_standard_agent
from indra.statements import Activation, Complex, DecreaseAmount, Evidence,\
IncreaseAmount, Inhibition
from indra.statements.validate import assert_valid_db_refs
from indra.ontology.standardize import standardize_name_db_refs, \
get_standard_agent

logger = logging.getLogger(__name__)

drugbank_ns = {'db': 'http://www.drugbank.ca'}

_UNHANDLED = set()


class DrugbankProcessor:
"""Processor to extract INDRA Statements from DrugBank content.
Expand All @@ -28,6 +31,7 @@ class DrugbankProcessor:
statements : list of indra.statements.Statement
A list of INDRA Statements that were extracted from DrugBank content.
"""

def __init__(self, xml_tree: ElementTree.ElementTree):
self.xml_tree = xml_tree
self.statements = []
Expand Down Expand Up @@ -59,9 +63,7 @@ def _extract_statements_for_drug(drug_element):

@staticmethod
def _get_statement_type(action):
if action in neutral_actions:
return None
elif action in activation_actions:
if action in activation_actions:
return Activation
elif action in inhibition_actions:
return Inhibition
Expand All @@ -71,8 +73,13 @@ def _get_statement_type(action):
return IncreaseAmount
elif action == 'N/A':
return Inhibition
else:
elif action in neutral_actions:
return _complex
elif action in skip_actions:
return None
elif action not in _UNHANDLED:
_UNHANDLED.add(action)
logger.warning('unhandled DrugBank action: %s', action)

@staticmethod
def _get_target_agent(target_element):
Expand Down Expand Up @@ -160,22 +167,64 @@ def db_findall(element, path):
return element.findall(path, namespaces=drugbank_ns)


activation_actions = {'substrate', 'agonist', 'inducer', 'potentiator',
'stimulator', 'cofactor', 'activator', 'ligand',
'chaperone', 'partial agonist', 'protector',
'positive allosteric modulator', 'positive modulator'}

inhibition_actions = {'antagonist', 'inhibitor', 'binder', 'antibody',
'inactivator', 'binding', 'blocker', 'negative modulator',
'inverse agonist', 'neutralizer', 'weak inhibitor',
'suppressor', 'disruptor',
'inhibitory allosteric modulator'}
def _complex(a, b, evidence):
return Complex([a, b], evidence=evidence)

decrease_amount_actions = {'downregulator', 'metabolizer', 'chelator',
'degradation',
'incorporation into and destabilization'}

increase_amount_actions = {'stabilization'}
activation_actions = {'inducer', 'potentiator',
'stimulator', 'cofactor', 'activator',
'protector',
'positive allosteric modulator', 'positive modulator'}

neutral_actions = {'modulator', 'other/unknown', 'unknown', 'other',
'regulator'}
inhibition_actions = {'inhibitor', 'binder', 'antibody',
'inactivator', 'binding', 'blocker', 'negative modulator',
'neutralizer', 'weak inhibitor',
'suppressor', 'disruptor', 'chelator',
'inhibitory allosteric modulator',
'translocation inhibitor', 'nucleotide exchange blocker',
}

decrease_amount_actions = {
'downregulator',
'metabolizer',
'degradation',
'incorporation into and destabilization',
'cleavage',
'inhibition of synthesis',
}

increase_amount_actions = {'stabilization', 'chaperone'}

neutral_actions = {
'modulator',
'regulator',
'antagonist',
'substrate',
'agonist',
'ligand',
# e.g., Doxorubicin intercalates DNA to prevent transcription
'intercalation',
'inverse agonist',
# e.g., inhibits process on a protein's aggregation (like APP or LRRK)
'aggregation inhibitor',
'partial agonist',
'partial antagonist',
'antisense oligonucleotide',
'adduct',
'component of',
'product of',
'reducer',
'oxidizer',
# map to Ac INDRA statement?, but I'm not convinced by the idea of
# splitting up actions
'acetylation',
'allosteric modulator',
'deoxidizer',
'cross-linking/alkylation', # e.g. Busulfan (DB01008) alkalytes DNA
}

skip_actions = {
'other/unknown',
'unknown',
'other',
}