# Path: indra/ontology/standardize.py
# def get_standard_name(db_refs, ontology=None, ns_order=None):
#     """Return a standardized name 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.
#     """
#     if ontology is None:
#         from indra.ontology.bio import bio_ontology
#         ontology = bio_ontology
# 
#     # We next look for prioritized grounding, if missing, we return
#     db_ns, db_id = get_grounding(db_refs, ns_order=ns_order)
# 
#     # If there's no grounding then we can't do more to standardize the
#     # name and return
#     if not db_ns or not db_id:
#         return None
# 
#     # If there is grounding available, we can try to get the standardized name
#     # and in the rare case that we don't get it, we don't set it.
#     standard_name = ontology.get_name(db_ns, db_id)
#     # Handle special case with UPPRO, if we can't get a feature name
#     # we fall back on regular gene/protein naming
#     if not standard_name and db_ns == 'UPPRO':
#         db_ns, db_id = get_grounding(db_refs, ns_order=['HGNC', 'UP'])
#         if not db_ns or not db_id:
#             return None
#         standard_name = ontology.get_name(db_ns, db_id)
#     if not standard_name:
#         return None
# 
#     return standard_name
# 
# Path: indra/sources/minerva/id_mapping.py
# def indra_db_refs_from_minerva_refs(refs):
#     db_refs = {}
#     for db_ns, db_id in refs:
#         db_ns = minerva_to_indra_map[db_ns] \
#             if db_ns in minerva_to_indra_map else db_ns
#         db_ns, db_id = fix_id_standards(db_ns, db_id)
#         db_refs[db_ns] = db_id
#     # We need some special handling here for issues in the curated maps
#     # If we have a specific gene grounding, remove ECCODE grounding since
#     # it can incorrectly result in a family interpretation
#     if 'HGNC' in db_refs:
#         db_refs.pop('ECCODE', None)
#     db_refs = standardize_db_refs(db_refs)
#     return db_refs


import logging
from indra.ontology.standardize import get_standard_name
from indra.ontology.bio import bio_ontology
from indra.statements import *
from .minerva_client import get_ids_to_refs, default_map_name
from .id_mapping import indra_db_refs_from_minerva_refs
                        annotations={'sif_str': sif_str,
                                     'minerva_model_id': model_id})
        stmt.evidence = [evid]
        return stmt


def get_agent(element_id, ids_to_refs, complex_members):
    """Get an agent for a MINERVA element.

    Parameters
    ----------
    element_id : str
        ID of an element used in MINERVA API and raw SIF files.
    ids_to_refs : dict
        A dictionary mapping element IDs to MINERVA provided references. Note
        that this mapping is unique per model (same IDs can be mapped to
        different refs in different models).
    complex_members : dict
        A dictionary mapping element ID of a complex element to element IDs of
        its members.

    Returns
    -------
    agent : indra.statements.agent.Agent
        INDRA agent created from given refs.
    """
    # Get references from MINERVA and filter to accepted namespaces
    exclude_ns = {'WIKIPATHWAYS', 'PUBMED', 'HGNC_SYMBOL', 'INTACT', 'PDB',
                  'DOI'}
    refs = ids_to_refs.get(element_id)

# Path: indra/ontology/standardize.py
# def get_standard_name(db_refs, ontology=None, ns_order=None):
#     """Return a standardized name 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.
#     """
#     if ontology is None:
#         from indra.ontology.bio import bio_ontology
#         ontology = bio_ontology
# 
#     # We next look for prioritized grounding, if missing, we return
#     db_ns, db_id = get_grounding(db_refs, ns_order=ns_order)
# 
#     # If there's no grounding then we can't do more to standardize the
#     # name and return
#     if not db_ns or not db_id:
#         return None
# 
#     # If there is grounding available, we can try to get the standardized name
#     # and in the rare case that we don't get it, we don't set it.
#     standard_name = ontology.get_name(db_ns, db_id)
#     # Handle special case with UPPRO, if we can't get a feature name
#     # we fall back on regular gene/protein naming
#     if not standard_name and db_ns == 'UPPRO':
#         db_ns, db_id = get_grounding(db_refs, ns_order=['HGNC', 'UP'])
#         if not db_ns or not db_id:
#             return None
#         standard_name = ontology.get_name(db_ns, db_id)
#     if not standard_name:
#         return None
# 
#     return standard_name
# 
# Path: indra/sources/minerva/id_mapping.py
# def indra_db_refs_from_minerva_refs(refs):
#     db_refs = {}
#     for db_ns, db_id in refs:
#         db_ns = minerva_to_indra_map[db_ns] \
#             if db_ns in minerva_to_indra_map else db_ns
#         db_ns, db_id = fix_id_standards(db_ns, db_id)
#         db_refs[db_ns] = db_id
#     # We need some special handling here for issues in the curated maps
#     # If we have a specific gene grounding, remove ECCODE grounding since
#     # it can incorrectly result in a family interpretation
#     if 'HGNC' in db_refs:
#         db_refs.pop('ECCODE', None)
#     db_refs = standardize_db_refs(db_refs)
#     return db_refs


# Path: indra/sources/minerva/processor.py
import logging
from indra.ontology.standardize import get_standard_name
from indra.ontology.bio import bio_ontology
from indra.statements import *
from .minerva_client import get_ids_to_refs, default_map_name
from .id_mapping import indra_db_refs_from_minerva_refs

                        annotations={'sif_str': sif_str,
                                     'minerva_model_id': model_id})
        stmt.evidence = [evid]
        return stmt


def get_agent(element_id, ids_to_refs, complex_members):
    """Get an agent for a MINERVA element.

    Parameters
    ----------
    element_id : str
        ID of an element used in MINERVA API and raw SIF files.
    ids_to_refs : dict
        A dictionary mapping element IDs to MINERVA provided references. Note
        that this mapping is unique per model (same IDs can be mapped to
        different refs in different models).
    complex_members : dict
        A dictionary mapping element ID of a complex element to element IDs of
        its members.

    Returns
    -------
    agent : indra.statements.agent.Agent
        INDRA agent created from given refs.
    """
    # Get references from MINERVA and filter to accepted namespaces
    exclude_ns = {'WIKIPATHWAYS', 'PUBMED', 'HGNC_SYMBOL', 'INTACT', 'PDB',
                  'DOI'}
    refs = ids_to_refs.get(element_id)

    db_refs = indra_db_refs_from_minerva_refs(refs)