Esempio n. 1
0
    def __init__(self, verbose=True):
        """.. rubric:: Constructor

        :param bool verbose: print informative messages

        .. doctest::

            >>> from bioservices import PSICQUIC
            >>> s = PSICQUIC()

        """
        self.services = REST(
            "PSICQUIC",
            verbose=verbose,
            url="https://www.ebi.ac.uk/Tools/webservices/psicquic",
            url_defined_later=True)  # this prevent annoying warning

        self._registry = None

        try:
            self.uniprot = UniProt(verbose=False)
        except:
            self.services.logging.warning(
                "UniProt service could be be initialised")
        self.buffer = {}
Esempio n. 2
0
    def __init__(self, verbose=False, cache=False):
        url = "http://rest.genenames.org/"
        self.services = REST("HGNC", url=url, verbose=verbose, cache=cache)

        self._info = self.get_info()
        self.searchable_fields = self._info['searchableFields']
        self.stored_fields = self._info['storedFields']
Esempio n. 3
0
 def _einfo_rest(self, db=None, **kargs):
     s = REST("test", "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/")
     ret = s.http_get("einfo.fcgi?db=%s" % db,
                      frmt="xml",
                      params={
                          'tool': kargs.get('tool', self.tool),
                          'email': kargs.get('email', self.email)
                      })
     ret = self.easyXML(ret)
     return ret
Esempio n. 4
0
    def __init__(self, verbose=False, email="unknown"):
        #url = "http://www.ncbi.nlm.nih.gov/entrez/eutils/soap/v2.0/eutils.wsdl?"

        # according to http://www.ncbi.nlm.nih.gov/books/NBK25497/#chapter2.chapter2_table1
        # this url should be use
        url = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/soap/v2.0/eutils.wsdl?"
        super(EUtils, self).__init__(name="EUtils", verbose=verbose, url=url)

        warning = """

        NCBI recommends that users post no more than three URL requests per second.
        Failure to comply with this policy may result in an IP address being blocked
        from accessing NCBI. If NCBI blocks an IP address, service will not be
        restored unless the developers of the software accessing the E-utilities
        register values of the tool and email parameters with NCBI. The value of
        email will be used only to contact developers if NCBI observes requests
        that violate our policies, and we will attempt such contact prior to blocking
        access.  For more details see http://www.ncbi.nlm.nih.gov/books/NBK25497/#chapter2.chapter2_table1

        BioServices does not check if you send more than 3 requests per seconds.
        This is considered to be the user responsability. Within BioServices, we
        fill the parameter **tool** and **email**, however, to fill the later
        you should provide your email either globablly when instanciating EUtils,
        or locally when calling a method.

        This message will not appear if you set the email as a parameter::

            e = EUtils(email="name@adress")

        or in you bioservices configuration file (.config/bioservices/bioservices.cfg)
        under linux with a user section::

            [user]
            email = yourname@somewhere


        """
        # on top of the WSDL protocol we also need a REST for the EFetch method
        # Indeed, although we have a WSDL class for EFetch, it is (i) limited
        # because doc could not be found (ii) required sn instanciation for
        # each database whereas with REST, we ca do it just once
        self._efetch = REST("Efetch",
                            "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/")

        self._databases = None
        self.tool = "bioservices"
        self.email = email
        if self.email == "unknown":
            # trying the bioservices config file
            if self.settings.params['user.email'][0] != "unknown":
                self.email = self.settings.params['user.email'][0]
            else:
                self.logging.warning(warning)
Esempio n. 5
0
 def _esummary_rest(self, db, sid):
     # [(x.attrib['Name'], x.text) for x in ret.getchildren()[0].getchildren()[1:]]
     s = REST("test", "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/")
     ret = s.http_get("esummary.fcgi?db=%s&id=%s" % (db, sid), None)
     ret = self.easyXML(ret)
     return ret