# Path: indra/ontology/standardize.py
# def standardize_agent_name(agent, standardize_refs=True, ontology=None,
#                            ns_order=None):
#     """Standardize the name of an Agent based on grounding information.
# 
#     The priority of which namespace is used as the bases for the
#     standard name depends on
# 
#     Parameters
#     ----------
#     agent : indra.statements.Agent
#         An INDRA Agent whose name attribute should be standardized based
#         on grounding information.
#     standardize_refs : Optional[bool]
#         If True, this function assumes that the Agent's db_refs need to
#         be standardized, e.g., HGNC mapped to UP.
#         Default: True
#     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
#     -------
#     bool
#         True if a new name was set, False otherwise.
#     """
#     # If the Agent is None, we return immediately
#     if agent is None:
#         return False
#     # If we want to standardize the Agent's db_refs, we call this now
#     if standardize_refs:
#         agent.db_refs = standardize_db_refs(agent.db_refs, ontology=ontology)
#     # We next try to get a standard name based on the Agent's grounding
#     standard_name = get_standard_name(agent.db_refs, ontology=ontology,
#                                       ns_order=ns_order)
#     # If we got a proper standard name, we apply it
#     if standard_name:
#         agent.name = standard_name
#         return True
#     return False


import re
import logging
from indra.databases import uniprot_client
from indra.statements import Agent, Complex, Evidence
from indra.ontology.standardize import standardize_agent_name
    }

    text_refs = parse_text_refs(row['publication'])

    ev = Evidence(source_api='virhostnet', annotations=annotations,
                  text_refs=text_refs, pmid=text_refs.get('PMID'),
                  source_id=source_ids.get('virhostnet-rid'))

    stmt = Complex([host_agent, vir_agent], evidence=[ev])
    return stmt


def get_agent_from_grounding(grounding, up_web_fallback=False):
    """Return an INDRA Agent based on a grounding annotation."""
    db_ns, db_id = grounding.split(':')
    # Assume UniProt or RefSeq IDs
    assert db_ns in {'uniprotkb', 'refseq', 'ddbj/embl/genbank'}, db_ns
    if db_ns == 'uniprotkb':
        if '-' in db_id:
            up_id, feat_id = db_id.split('-')
            # Assume it's a feature ID
            assert feat_id.startswith('PRO'), feat_id
            db_refs = {'UP': up_id, 'UPPRO': feat_id}
        else:
            db_refs = {'UP': db_id}
    elif db_ns == 'refseq':
        db_refs = {'REFSEQ_PROT': db_id}
    else:
        db_refs = {'NCBIPROTEIN': db_id}
    agent = Agent(db_id, db_refs=db_refs)

# Path: indra/ontology/standardize.py
# def standardize_agent_name(agent, standardize_refs=True, ontology=None,
#                            ns_order=None):
#     """Standardize the name of an Agent based on grounding information.
# 
#     The priority of which namespace is used as the bases for the
#     standard name depends on
# 
#     Parameters
#     ----------
#     agent : indra.statements.Agent
#         An INDRA Agent whose name attribute should be standardized based
#         on grounding information.
#     standardize_refs : Optional[bool]
#         If True, this function assumes that the Agent's db_refs need to
#         be standardized, e.g., HGNC mapped to UP.
#         Default: True
#     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
#     -------
#     bool
#         True if a new name was set, False otherwise.
#     """
#     # If the Agent is None, we return immediately
#     if agent is None:
#         return False
#     # If we want to standardize the Agent's db_refs, we call this now
#     if standardize_refs:
#         agent.db_refs = standardize_db_refs(agent.db_refs, ontology=ontology)
#     # We next try to get a standard name based on the Agent's grounding
#     standard_name = get_standard_name(agent.db_refs, ontology=ontology,
#                                       ns_order=ns_order)
#     # If we got a proper standard name, we apply it
#     if standard_name:
#         agent.name = standard_name
#         return True
#     return False


# Path: indra/sources/virhostnet/processor.py
import re
import logging
from indra.databases import uniprot_client
from indra.statements import Agent, Complex, Evidence
from indra.ontology.standardize import standardize_agent_name

    }

    text_refs = parse_text_refs(row['publication'])

    ev = Evidence(source_api='virhostnet', annotations=annotations,
                  text_refs=text_refs, pmid=text_refs.get('PMID'),
                  source_id=source_ids.get('virhostnet-rid'))

    stmt = Complex([host_agent, vir_agent], evidence=[ev])
    return stmt


def get_agent_from_grounding(grounding, up_web_fallback=False):
    """Return an INDRA Agent based on a grounding annotation."""
    db_ns, db_id = grounding.split(':')
    # Assume UniProt or RefSeq IDs
    assert db_ns in {'uniprotkb', 'refseq', 'ddbj/embl/genbank'}, db_ns
    if db_ns == 'uniprotkb':
        if '-' in db_id:
            up_id, feat_id = db_id.split('-')
            # Assume it's a feature ID
            assert feat_id.startswith('PRO'), feat_id
            db_refs = {'UP': up_id, 'UPPRO': feat_id}
        else:
            db_refs = {'UP': db_id}
    elif db_ns == 'refseq':
        db_refs = {'REFSEQ_PROT': db_id}
    else:
        db_refs = {'NCBIPROTEIN': db_id}
    agent = Agent(db_id, db_refs=db_refs)

    standardized = standardize_agent_name(agent)