How to use the bioservices.REST function in bioservices

To help you get started, we’ve selected a few bioservices examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cokelaer / bioservices / src / bioservices / intact.py View on Github external
-- From Intact web page Feb 2015


"""
from bioservices import REST


__all__ = ['IntactComplex']


class Intact(object):
    def __init__(self):
        print("Not implemented yet. For Intact Complex, please use IntactComplex class")


class IntactComplex(REST):
    """Interface to the `Intact `_ service

    .. doctest::

            >>> from bioservices import IntactComplex
            >>> u = IntactComplex()

    """

    _url = "http://www.ebi.ac.uk/intact/complex-ws"

    def __init__(self, verbose=False, cache=False):
        """**Constructor** IntactComplex

        :param verbose: set to False to prevent informative messages
        """
github cokelaer / bioservices / src / bioservices / eutils.py View on Github external
"""
import json
from bioservices import REST
from bioservices import __version__
from bioservices import logger
logger.name = __name__


__all__ = ["EUtils", "EUtilsParser"]

# source:
# http://www.dalkescientific.com/writings/diary/archive/2005/09/30/using_eutils.html


class EUtils(REST):
    """Interface to `NCBI Entrez Utilities `_ service

    .. note:: Technical note: the WSDL interface was dropped in july 2015
        so we now use the REST service.

    .. warning:: Read the `guidelines
        `_ before sending requests.
        No more than 3 requests per seconds otherwise your IP may be banned.
        You should provide your email by filling the :attr:`email` so that
        before being banned, you may be contacted.

    There are a few methods such as :meth:`ELink`, :meth:`EFetch`.
    Here is an example on how to use :meth:`EFetch` method to retrieve the
    FASTA sequence of a given identifier (34577063)::

        >>> from bioservices import EUtils
github cokelaer / bioservices / src / bioservices / psicquic.py View on Github external
"""

from bioservices import REST, UniProt


#http://code.google.com/p/psicquic/wiki/PsicquicSpec_1_3_Rest

#http://www.biocatalogue.org/services/2078#operations

__all__ = ["PSICQUIC"]


class PSICQUIC(REST):
    """Interface to the `PSICQUIC `_ service

    There are 2 interfaces to the PSICQUIC service (REST and WSDL) but we used
    the REST only.


    This service provides a common interface to more than 25 other services
    related to protein. So, we won't detail all the possiblity of this service.
    Here is an example that consists of looking for interactors of the
    protein ZAP70 within the IntAct database::

        >>> from bioservices import *
        >>> s = PSICQUIC()
        >>> res = s.query("intact", "zap70")
        >>> len(res) # there are 11 interactions found
        11
github cokelaer / bioservices / src / bioservices / omnipath.py View on Github external
.. highlights::

        A comprehensive collection of literature curated human signaling pathways.

        -- From OmniPath web site, March 2016


"""
from bioservices import REST
from easydev import to_list 
from bioservices import logger
logger.name = __name__



class OmniPath(REST):
    """Interface to the `OmniPath `_ service

    .. doctest::

            >>> from bioservices import OmniPath
            >>> o = OmniPath()
            >>> net = o.get_network()
            >>> interactions = o.get_interactions('P00533')

    """

    _url = "http://omnipathdb.org/"

    def __init__(self, verbose=False, cache=False):
        """**Constructor** OmniPath
github cokelaer / bioservices / src / bioservices / hgnc.py View on Github external
from bioservices.xmltools import bs4
import easydev
from bioservices import logger
logger.name = __name__


try:
    from urllib.error import HTTPError
except:
    from urllib2 import HTTPError


__all__ = ["HGNC", 'HGNCDeprecated']


class HGNC(REST):
    """Wrapper to the genenames web service


    See details at http://www.genenames.org/help/rest-web-service-help

    """
    def __init__(self, verbose=False, cache=False):
        url = "http://rest.genenames.org/"
        super(HGNC, self).__init__("HGNC", url=url, verbose=verbose,
                cache=cache)

        self._info = self.get_info()
        self.searchable_fields = self._info['searchableFields']
        self.stored_fields = self._info['storedFields']

    def get_info(self, frmt='json'):
github cokelaer / bioservices / src / bioservices / chemspider.py View on Github external
ChemSpider is a free chemical structure database providing fast access to
        over 28 million structures, properties and associated information. By
        integrating and linking compounds from more than 400 data sources, ChemSpider
        enables researchers to discover the most comprehensive view of freely
        available chemical data from a single online search. It is owned by the Royal Society of Chemistry.

        -- ChemSpider home page, March 2013
"""
from bioservices import REST
try:
    from urllib.parse import quote
except:
    from urllib2 import quote


class ChemSpider(REST):
    """ChemSpider Web Service Interface

    :status: in progress you can already search for Id and compound or
        retrieve the chemical image of an Id


    ::

        >>> from bioservices import *
        >>> s = ChemSpider()
        >>> s.find("Pyridine")
        [1020]
        >>> results = s.GetExtendedCompoundInfo(1020)
        >>> results['averagemass']
        79.0999
github cokelaer / bioservices / src / bioservices / hgnc.py View on Github external
raise ValueError('you must provide at least one parameter')
        elif database_or_query is not None and query is None:
            # presumably user wants to search all databases
            query = database_or_query
            url = 'search/{0}'.format(query)
        else:
            database = database_or_query
            easydev.check_param_in_list(database, self.searchable_fields)
            url = 'search/{0}/{1}'.format(database, query)

        headers = self.get_headers(content=frmt)
        res = self.http_get(url, frmt=frmt, headers=headers)
        return res


class HGNCDeprecated(REST):
    """Interface to the `HGNC `_ service


    ::

        >>> from bioservices import *
        >>> # Fetch XML document for gene ZAP70
        >>> s = HGNC()
        >>> xml = s.get_xml("ZAP70")
        >>> # You can fetch several gene names:
        >>> xml = s.get_xml("ZAP70;INSR")
        >>> # Wrong gene name request returns an empty list
        >>> s.get_xml("wrong")
        []

    For a single name, the following methods are available::
github cokelaer / bioservices / src / bioservices / biomart.py View on Github external
__all__ = ["BioMart"]


def require_host(f):
    @wraps(f)
    def wrapper(*args, **kargs):
        if args[0].host is None:
            print("You must set the host (e.g. f.host='www.ensembl.org' ")
            return
        return f(*args, **kargs)
    return wrapper


class BioMart(REST):
    r"""Interface to the `BioMart `_ service

    BioMart is made of different views. Each view correspond to a specific **MART**.
    For instance the UniProt service has a `BioMart view `_.

    The registry can help to find the different services available through
    BioMart.

        >>> from bioservices import *
        >>> s = BioMart()
        >>> ret = s.registry() # to get information about existing services

    The registry is a list of dictionaries. Some aliases are available to get
    all the names or databases::

        >>> s.names      # alias to list of valid service names from registry
github cokelaer / bioservices / src / bioservices / unichem.py View on Github external
.. highlights::

        "UniChem is a 'Unified Chemical Identifier' system, designed to assist
        in the rapid cross-referencing of chemical structures, and their identifiers,
        between databases (read more). "

        -- From UniChem web page June 2013


"""
from bioservices import REST
from bioservices import logger
logger.name = __name__


class UniChem(REST):
    """Interface to the `UniChem `_ service

    .. doctest::

            >>> from bioservices import UniChem
            >>> u = UniChem()


    """

    _url = "http://www.ebi.ac.uk/unichem/rest"

    def __init__(self, verbose=False, cache=False):
        """**Constructor** UniChem

        :param verbose: set to False to prevent informative messages