How to use the bioservices.EUtils 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 sequana / sequana / sequana / databases.py View on Github external
def __init__(self):
        from bioservices import EUtils
        self.eutils = EUtils()
github sequana / sequana / sequana / blaster.py View on Github external
def get_lineage_from_taxons(self, taxons):
        from bioservices import EUtils
        e = EUtils()
        res = e.EFetch("taxonomy", taxons)
        self.xml = easyXML(res)

        # There is one lineage per taxon so we can use the findAll
        lineage = [x.text for x in self.xml.findAll("lineage")]

        # We now want to get the scientific name for each taxon. Note,ever
        # that there are several taxon children-tags within a taxon each hving
        # a scientific name, so we first use getchildren() to make sure toloop
        # over a the children only
        scnames = []
        for taxon in self.xml.root.getchildren():
            name = taxon.findall("ScientificName")[0].text
            scnames.append(name)

        return lineage, scnames
github sequana / sequana / sequana / blaster.py View on Github external
def get_taxon_from_one_id(id_, eutils=None):
    """

    """
    if eutils is None:
        from bioservices import EUtils
        eutils = EUtils()
    ret = eutils.ELink("taxonomy", "nucleotide", [id_])
    parsed = eutils.parse_xml(ret, 'EUtilsParser')

    assert str(id_) == parsed.eLinkResult.LinkSet.IdList.Id
    return parsed.eLinkResult.LinkSet.LinkSetDb.Link.Id
github sequana / sequana / sequana / blaster.py View on Github external
def get_taxon_from_ids(idlist):

    from bioservices import EUtils
    eutils = EUtils(cache=True)
    pb = Progress(len(idlist))
    taxons = []
    for i, id_ in enumerate(idlist):
        taxons.append(get_taxon_from_one_id(id_, eutils))
        pb.animate(i+1)
    return taxons
github cokelaer / bioservices / src / bioservices / apps / taxonomy.py View on Github external
def __init__(self):
        super(Taxon, self).__init__()
        # self.df = pd.DataFrame(index=[], columns=["Taxon", "Scientific Name"])
        self._eutils_service = EUtils()
        self._ensembl_service = Ensembl() # there is a search by name, easier to use than EUtils
github sequana / sequana / sequana / taxonomy.py View on Github external
def find_taxon(self, taxid, mode="ncbi"):
        taxid = str(taxid)
        if mode == "ncbi":
            from bioservices import EUtils
            self.eutils = EUtils(verbose=False)
            res = self.eutils.taxonomy_summary(taxid)
        else:
            res = self.ensembl.get_taxonomy_by_id(taxid)
        return res
        """if "error" in res[taxid]:
            print("not found in NCBI (EUtils)")