# 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/sparser/processor.py
# class SparserJSONProcessor(object):
# class SparserError(ValueError):
# class InvalidAgent(SparserError):
# class TranslocationWithoutLocations(SparserError):
# class MissingSubj(SparserError):
# class MissingObj(SparserError):
# class UnaryComplex(SparserError):
# class NoAgents(SparserError):
# class MissingEvidenceText(SparserError):
# class InvalidEvidence(SparserError):
#     def __init__(self, json_dict):
#     def get_statements(self):
#     def set_statements_pmid(self, pmid):
#     def get_error_stats(self):
# def fix_agent(agent):
# def fix_json_stmt(json_stmt):
# def fix_json_agent(ag_obj):
# def check_statement_sanity(stmt):
# def _read_ncit_map():
# def _read_famplex_map():


import logging
from collections import defaultdict
from indra.statements import *
from indra.literature import id_lookup
from indra.databases import uniprot_client, hgnc_client
from .processor import ncit_map, famplex_map
            db_refs['TEXT'] = raw_text
        agent_name = raw_text
        # If we have a proper UID then we try to reconstruct an Agent from that
        if uid is not None and len(uid.split(':')) == 2:
            db_ns, db_id = uid.split(':')
            be_id = famplex_map.get((db_ns, db_id))
            if be_id:
                db_refs[db_ns] = db_id
                db_refs['FPLX'] = be_id
                agent_name = be_id
            elif db_ns in ['UP', 'Uniprot']:
                id_from_mnemonic = uniprot_client.get_id_from_mnemonic(db_id)
                if id_from_mnemonic:
                    db_id = id_from_mnemonic
                db_refs['UP'] = db_id
                hgnc_id = uniprot_client.get_hgnc_id(db_id)
                if hgnc_id:
                    db_refs['HGNC'] = hgnc_id
                    agent_name = hgnc_client.get_hgnc_name(hgnc_id)
                else:
                    gene_name = uniprot_client.get_gene_name(db_id)
                    if gene_name:
                        agent_name = gene_name
            elif db_ns == 'NCIT':
                db_refs['NCIT'] = db_id
                target = ncit_map.get(db_id)
                if target:
                    db_refs[target[0]] = target[1]
                    if target[0] == 'HGNC':
                        up_id = hgnc_client.get_uniprot_id(target[1])

# 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/sparser/processor.py
# class SparserJSONProcessor(object):
# class SparserError(ValueError):
# class InvalidAgent(SparserError):
# class TranslocationWithoutLocations(SparserError):
# class MissingSubj(SparserError):
# class MissingObj(SparserError):
# class UnaryComplex(SparserError):
# class NoAgents(SparserError):
# class MissingEvidenceText(SparserError):
# class InvalidEvidence(SparserError):
#     def __init__(self, json_dict):
#     def get_statements(self):
#     def set_statements_pmid(self, pmid):
#     def get_error_stats(self):
# def fix_agent(agent):
# def fix_json_stmt(json_stmt):
# def fix_json_agent(ag_obj):
# def check_statement_sanity(stmt):
# def _read_ncit_map():
# def _read_famplex_map():


# Path: indra/sources/sparser/xml_processor.py
import logging
from collections import defaultdict
from indra.statements import *
from indra.literature import id_lookup
from indra.databases import uniprot_client, hgnc_client
from .processor import ncit_map, famplex_map

            db_refs['TEXT'] = raw_text
        agent_name = raw_text
        # If we have a proper UID then we try to reconstruct an Agent from that
        if uid is not None and len(uid.split(':')) == 2:
            db_ns, db_id = uid.split(':')
            be_id = famplex_map.get((db_ns, db_id))
            if be_id:
                db_refs[db_ns] = db_id
                db_refs['FPLX'] = be_id
                agent_name = be_id
            elif db_ns in ['UP', 'Uniprot']:
                id_from_mnemonic = uniprot_client.get_id_from_mnemonic(db_id)
                if id_from_mnemonic:
                    db_id = id_from_mnemonic
                db_refs['UP'] = db_id
                hgnc_id = uniprot_client.get_hgnc_id(db_id)
                if hgnc_id:
                    db_refs['HGNC'] = hgnc_id
                    agent_name = hgnc_client.get_hgnc_name(hgnc_id)
                else:
                    gene_name = uniprot_client.get_gene_name(db_id)
                    if gene_name:
                        agent_name = gene_name
            elif db_ns == 'NCIT':
                db_refs['NCIT'] = db_id
                target = ncit_map.get(db_id)
                if target:
                    db_refs[target[0]] = target[1]
                    if target[0] == 'HGNC':
                        up_id = hgnc_client.get_uniprot_id(target[1])

                        agent_name = hgnc_client.get_hgnc_name(target[1])