orange-bioinformatics / _bioinformatics / obiKEGG /

Return types from api classes interface for the SOAP kegg api.


from datetime import datetime
from collections import namedtuple

Definition = namedtuple(
    "Definition", ["entry_id",

def _Definition_from_items(items):
    """ Definition 'items' tuple from a list of items
    items_list = []
    for name, val in items:
        if isinstance(name, list):
            name = name[0]
        if isinstance(val, list):
            val = val[0]
        items_list.append((str(name), str(val)))
    return Definition(**dict(items_list))

Definition.from_items = staticmethod(_Definition_from_items)
BInfo = namedtuple(
    'BInfo', ["entry_id",

def _BInfo_from_text(text):
    """ Parse the return string from binfo into a new BInfo instance.
    lines = text.splitlines()
    name, definition = lines[0].split(" ", 1)
    definition = definition.strip()
    entry_id, release = lines[1].split(" ", 1)
    _, release = release.strip().split(" ", 1)
    curator = lines[2].strip()
    contents = lines[3].strip()
    _, last_update = lines[4].strip().split(":",1)
    last_update = datetime.strptime(last_update.strip(), "%y/%m/%d").date()
    supported_formats = lines[5].strip()
    return BInfo(entry_id, definition, name, release, curator,
                 contents, last_update, supported_formats)

BInfo.from_text = staticmethod(_BInfo_from_text)

SSDBRelation = namedtuple(
    "SSDBRelation", ["genes_id1",

MotifResult = namedtuple(
    "MotifResult", ["motif_id",

LinkDBRelation = namedtuple(
    "LinkDBRelation", ["entry_id1",

PathwayElement = namedtuple(
    "PathwayElement", ["element_id",

PathwayElementRelation = namedtuple(
    "PathwayElementRelation", ["element_id1",

Subtype = namedtuple(
    "Subtype", ["element_id",
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.