예제 #1
0
 def __init__(self):
     self.has_local_text_db = False
     if has_config('INDRA_DB_LITE_LOCATION'):
         try:
             from indra_db_lite import get_plaintexts_for_text_ref_ids
             self.has_local_text_db = True
         except Exception as e:
             pass
     try:
         from indra_db.util.content_scripts import TextContentSessionHandler
         self.__tc = TextContentSessionHandler()
     except Exception as e:
         logger.info('INDRA DB is not available for text content '
                     'retrieval for grounding disambiguation.')
         logger.debug('Could not connect to the DB: %s' % e)
         self.__tc = None
예제 #2
0
from copy import deepcopy
from indra.statements import *
from indra.util import read_unicode_csv
from indra.config import has_config, get_config
from indra.databases import uniprot_client, hgnc_client, phosphosite_client
# Python 2
try:
    basestring
# Python 3
except:
    basestring = str

logger = logging.getLogger('sitemapper')


if has_config('SITEMAPPER_CACHE_PATH'):
    sitemapper_cache = get_config('SITEMAPPER_CACHE_PATH')
else:
    sitemapper_cache = None


class MappedStatement(object):
    """Information about a Statement found to have invalid sites.

    Parameters
    ----------
    original_stmt : :py:class:`indra.statements.Statement`
        The statement prior to mapping.
    mapped_mods : list of tuples
        A list of invalid sites, where each entry in the list has two
        elements: ((gene_name, residue, position), mapped_site).  If the
예제 #3
0
파일: gilda.py 프로젝트: thebeastadi/indra
"""This module implements a client to the Gilda grounding web service,
and contains functions to help apply it during the course of INDRA assembly."""
import logging
import requests
from copy import deepcopy
from urllib.parse import urljoin
from indra.ontology.standardize \
    import standardize_agent_name
from indra.config import get_config, has_config
from indra.pipeline import register_pipeline

logger = logging.getLogger(__name__)

grounding_service_url = get_config('GILDA_URL', failure_ok=True) \
    if has_config('GILDA_URL') else 'http://grounding.indra.bio/'


def get_grounding(txt, context=None, mode='web'):
    """Return the top Gilda grounding for a given text.

    Parameters
    ----------
    txt : str
        The text to ground.
    context : Optional[str]
        Any context for the grounding.
    mode : Optional[str]
        If 'web', the web service given in the GILDA_URL config setting or
        environmental variable is used. Otherwise, the gilda package is
        attempted to be imported and used. Default: web