Example #1
0
 def efetch(self, db, id):
     """query the efetch endpoint
     """
     db = db.lower()
     xml = self._qs.efetch({'db': db, 'id': str(id)})
     doc = le.XML(xml)
     if db in ['gene']:
         return EntrezgeneSet(doc)
     if db in ['nuccore', 'nucest']:
         # TODO: GBSet is misnamed; it should be GBSeq and get the GBSeq XML node as root (see gbset.py)
         return GBSet(doc)
     if db in ['pubmed']:
         return PubmedArticleSet(doc)
     if db in ['snp']:
         return ExchangeSet(xml)
     if db in ['pmc']:
         return PubmedCentralArticleSet(doc)
     raise EutilsError('database {db} is not currently supported by eutils'.format(db=db))
Example #2
0
 def efetch(self, db, id=None, webenv=None, query_key=None, **kw):
     """query the efetch endpoint
     """
     db = db.lower()
     kw.update({'db': db})
     if id:
         kw.update({'id': id})
     else:
         kw.update({'webenv': webenv, 'query_key': query_key})
     xml = self._qs.efetch(kw)
     if db in ['gene']:
         return Gene(xml)
     if db in ['nuccore']:
         # TODO: GBSet is misnamed; it should be GBSeq and get the GBSeq XML node as root (see gbset.py)
         return GBSet(xml)
     if db in ['pubmed']:
         return PubMedArticleSet(xml)
     if db in ['snp']:
         return ExchangeSet(xml)
     raise EutilsError(
         'database {db} is not currently supported by eutils'.format(db=db))
Example #3
0
    @property
    def inference(self):
        return self._xml_root.xpath(
            'GBFeature_quals/GBQualifier[GBQualifier_name/text()="inference"]/GBQualifier_value/text()')[0]


if __name__ == "__main__":
    import os
    import lxml.etree as le
    from eutils.xmlfacades.gbset import GBSet

    data_dir = os.path.join(os.path.dirname(__file__), '..', '..', 'tests', 'data')
    relpath = 'efetch.fcgi?db=nuccore&id=148536845&retmode=xml.xml'
    path = os.path.join(data_dir, relpath)
    gbset = GBSet(le.parse(path).getroot())
    gbseq = next(iter(gbset))


# <LICENSE>
# Copyright 2015 eutils Committers
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
# http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express