# Path: indra/ontology/standardize.py
# def standardize_name_db_refs(db_refs, ontology=None, ns_order=None):
#     """Return a standardized name and db refs dict for a given db refs dict.
# 
#     Parameters
#     ----------
#     db_refs : dict
#         A dict of db refs that may not be standardized, i.e., may be
#         missing an available UP ID corresponding to an existing HGNC ID.
#     ontology : Optional[indra.ontology.IndraOntology]
#         An IndraOntology object, if not provided, the default BioOntology
#         is used.
#     ns_order : Optional[list]
#         A list of namespaces which are in order of priority with higher
#         priority namespaces appearing earlier in the list.
# 
#     Returns
#     -------
#     str or None
#         The standard name based on the db refs, None if not available.
#     dict
#         The db_refs dict with standardized entries.
#     """
#     db_refs = standardize_db_refs(db_refs, ontology=ontology,
#                                   ns_order=ns_order)
#     name = get_standard_name(db_refs, ontology=ontology, ns_order=ns_order)
#     return name, db_refs
# 
# def get_standard_agent(name, db_refs, ontology=None, ns_order=None, **kwargs):
#     """Get a standard agent based on the name, db_refs, and a any other kwargs.
# 
#     name : str
#         The name of the agent that may not be standardized.
#     db_refs : dict
#         A dict of db refs that may not be standardized, i.e., may be
#         missing an available UP ID corresponding to an existing HGNC ID.
#     ontology : Optional[indra.ontology.IndraOntology]
#         An IndraOntology object, if not provided, the default BioOntology
#         is used.
#     ns_order : Optional[list]
#         A list of namespaces which are in order of priority with higher
#         priority namespaces appearing earlier in the list.
#     kwargs :
#         Keyword arguments to pass to :func:`Agent.__init__`.
# 
#     Returns
#     -------
#     Agent
#         A standard agent
#     """
#     standard_name, db_refs = standardize_name_db_refs(db_refs,
#                                                       ontology=ontology,
#                                                       ns_order=ns_order)
#     if standard_name:
#         name = standard_name
#     assert_valid_db_refs(db_refs)
#     return Agent(name, db_refs=db_refs, **kwargs)
# 
# Path: indra/databases/hgnc_client.py
# def get_uniprot_id(hgnc_id):
# def get_entrez_id(hgnc_id):
# def get_hgnc_from_entrez(entrez_id):
# def get_ensembl_id(hgnc_id):
# def get_hgnc_from_ensembl(ensembl_id):
# def get_hgnc_name(hgnc_id):
# def get_hgnc_id(hgnc_name):
# def get_current_hgnc_id(hgnc_name):
# def get_hgnc_from_mouse(mgi_id):
# def get_hgnc_from_rat(rgd_id):
# def get_rat_id(hgnc_id):
# def get_mouse_id(hgnc_id):
# def get_hgnc_entry(hgnc_id):
# def get_gene_type(hgnc_id: str) -> Union[str, None]:
# def is_kinase(gene_name):
# def is_transcription_factor(gene_name):
# def is_phosphatase(gene_name):
# def get_enzymes(hgnc_id: str) -> Set[str]:
# def get_hgncs_from_enzyme(ec_code: str) -> Set[str]:
# def _read_hgnc_maps():
# def _read_kinases():
# def _read_phosphatases():
# def _read_tfs():


import logging
from indra.statements import Inhibition, Agent, Evidence
from indra.statements.validate import assert_valid_db_refs
from indra.ontology.standardize import standardize_name_db_refs, \
    get_standard_agent
from indra.databases import hgnc_client, chembl_client, lincs_client
            if name is None:
                # This is one way to detect that the drug could not be
                # standardized beyond just its name so in the
                # standardized_only condition, we skip this drug
                if self.standardized_only:
                    continue
                elif 'HMS-LINCS' in db_refs:
                    name = \
                        lincs_client_obj.get_small_molecule_name(
                            db_refs['HMS-LINCS'])
                elif 'CHEMBL' in db_refs:
                    name = chembl_client.get_chembl_name(db_refs['CHEMBL'])
            # If name is still None, we just use the ID as the name
            if name is None:
                # With the named_only restriction, we skip drugs without
                # a proper name.
                if self.named_only:
                    continue
                name = id_
            assert_valid_db_refs(db_refs)
            drugs.append(Agent(name, db_refs=db_refs))
        drugs = list({agent.matches_key():
                      agent for agent in drugs}.values())
        return drugs

    def _extract_protein(self, name, gene_id):
        db_refs = {'EGID': gene_id}
        hgnc_id = hgnc_client.get_hgnc_from_entrez(gene_id)
        if hgnc_id is not None:
            db_refs['HGNC'] = hgnc_id

# Path: indra/ontology/standardize.py
# def standardize_name_db_refs(db_refs, ontology=None, ns_order=None):
#     """Return a standardized name and db refs dict for a given db refs dict.
# 
#     Parameters
#     ----------
#     db_refs : dict
#         A dict of db refs that may not be standardized, i.e., may be
#         missing an available UP ID corresponding to an existing HGNC ID.
#     ontology : Optional[indra.ontology.IndraOntology]
#         An IndraOntology object, if not provided, the default BioOntology
#         is used.
#     ns_order : Optional[list]
#         A list of namespaces which are in order of priority with higher
#         priority namespaces appearing earlier in the list.
# 
#     Returns
#     -------
#     str or None
#         The standard name based on the db refs, None if not available.
#     dict
#         The db_refs dict with standardized entries.
#     """
#     db_refs = standardize_db_refs(db_refs, ontology=ontology,
#                                   ns_order=ns_order)
#     name = get_standard_name(db_refs, ontology=ontology, ns_order=ns_order)
#     return name, db_refs
# 
# def get_standard_agent(name, db_refs, ontology=None, ns_order=None, **kwargs):
#     """Get a standard agent based on the name, db_refs, and a any other kwargs.
# 
#     name : str
#         The name of the agent that may not be standardized.
#     db_refs : dict
#         A dict of db refs that may not be standardized, i.e., may be
#         missing an available UP ID corresponding to an existing HGNC ID.
#     ontology : Optional[indra.ontology.IndraOntology]
#         An IndraOntology object, if not provided, the default BioOntology
#         is used.
#     ns_order : Optional[list]
#         A list of namespaces which are in order of priority with higher
#         priority namespaces appearing earlier in the list.
#     kwargs :
#         Keyword arguments to pass to :func:`Agent.__init__`.
# 
#     Returns
#     -------
#     Agent
#         A standard agent
#     """
#     standard_name, db_refs = standardize_name_db_refs(db_refs,
#                                                       ontology=ontology,
#                                                       ns_order=ns_order)
#     if standard_name:
#         name = standard_name
#     assert_valid_db_refs(db_refs)
#     return Agent(name, db_refs=db_refs, **kwargs)
# 
# Path: indra/databases/hgnc_client.py
# def get_uniprot_id(hgnc_id):
# def get_entrez_id(hgnc_id):
# def get_hgnc_from_entrez(entrez_id):
# def get_ensembl_id(hgnc_id):
# def get_hgnc_from_ensembl(ensembl_id):
# def get_hgnc_name(hgnc_id):
# def get_hgnc_id(hgnc_name):
# def get_current_hgnc_id(hgnc_name):
# def get_hgnc_from_mouse(mgi_id):
# def get_hgnc_from_rat(rgd_id):
# def get_rat_id(hgnc_id):
# def get_mouse_id(hgnc_id):
# def get_hgnc_entry(hgnc_id):
# def get_gene_type(hgnc_id: str) -> Union[str, None]:
# def is_kinase(gene_name):
# def is_transcription_factor(gene_name):
# def is_phosphatase(gene_name):
# def get_enzymes(hgnc_id: str) -> Set[str]:
# def get_hgncs_from_enzyme(ec_code: str) -> Set[str]:
# def _read_hgnc_maps():
# def _read_kinases():
# def _read_phosphatases():
# def _read_tfs():


# Path: indra/sources/tas/processor.py
import logging
from indra.statements import Inhibition, Agent, Evidence
from indra.statements.validate import assert_valid_db_refs
from indra.ontology.standardize import standardize_name_db_refs, \
    get_standard_agent
from indra.databases import hgnc_client, chembl_client, lincs_client

            if name is None:
                # This is one way to detect that the drug could not be
                # standardized beyond just its name so in the
                # standardized_only condition, we skip this drug
                if self.standardized_only:
                    continue
                elif 'HMS-LINCS' in db_refs:
                    name = \
                        lincs_client_obj.get_small_molecule_name(
                            db_refs['HMS-LINCS'])
                elif 'CHEMBL' in db_refs:
                    name = chembl_client.get_chembl_name(db_refs['CHEMBL'])
            # If name is still None, we just use the ID as the name
            if name is None:
                # With the named_only restriction, we skip drugs without
                # a proper name.
                if self.named_only:
                    continue
                name = id_
            assert_valid_db_refs(db_refs)
            drugs.append(Agent(name, db_refs=db_refs))
        drugs = list({agent.matches_key():
                      agent for agent in drugs}.values())
        return drugs

    def _extract_protein(self, name, gene_id):
        db_refs = {'EGID': gene_id}
        hgnc_id = hgnc_client.get_hgnc_from_entrez(gene_id)
        if hgnc_id is not None:
            db_refs['HGNC'] = hgnc_id

        return get_standard_agent(name, db_refs=db_refs)