# 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


import re
import csv
import tqdm
import logging
import requests
from io import BytesIO, StringIO
from zipfile import ZipFile
from collections import namedtuple
from indra.util import read_unicode_csv
from indra.statements import Agent, Complex, Evidence
from indra.ontology.standardize import standardize_name_db_refs

    def _make_agent(self, symbol, entrez_id, swissprot_id, trembl_id):
        """Make an Agent object, appropriately grounded.

        Parameters
        ----------
        entrez_id : str
            Entrez id number
        swissprot_id : str
            Swissprot (reviewed UniProt) ID.
        trembl_id : str
            Trembl (unreviewed UniProt) ID.
        symbol : str
            A plain text symbol, or None if not listed.

        Returns
        -------
        agent : indra.statements.Agent
            A grounded agent object.
        """
        db_refs = {}
        name = symbol
        if swissprot_id:
            if '|' not in swissprot_id:
                db_refs['UP'] = swissprot_id
        elif trembl_id:
            if '|' not in trembl_id:
                db_refs['UP'] = trembl_id
        if entrez_id:
            db_refs['EGID'] = entrez_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


# Path: indra/sources/biogrid.py
import re
import csv
import tqdm
import logging
import requests
from io import BytesIO, StringIO
from zipfile import ZipFile
from collections import namedtuple
from indra.util import read_unicode_csv
from indra.statements import Agent, Complex, Evidence
from indra.ontology.standardize import standardize_name_db_refs


    def _make_agent(self, symbol, entrez_id, swissprot_id, trembl_id):
        """Make an Agent object, appropriately grounded.

        Parameters
        ----------
        entrez_id : str
            Entrez id number
        swissprot_id : str
            Swissprot (reviewed UniProt) ID.
        trembl_id : str
            Trembl (unreviewed UniProt) ID.
        symbol : str
            A plain text symbol, or None if not listed.

        Returns
        -------
        agent : indra.statements.Agent
            A grounded agent object.
        """
        db_refs = {}
        name = symbol
        if swissprot_id:
            if '|' not in swissprot_id:
                db_refs['UP'] = swissprot_id
        elif trembl_id:
            if '|' not in trembl_id:
                db_refs['UP'] = trembl_id
        if entrez_id:
            db_refs['EGID'] = entrez_id

        standard_name, db_refs = standardize_name_db_refs(db_refs)