Changeset 1741:1c2feb7cd8d2 in orange-bioinformatics for _bioinformatics/obiKEGG/databases.py


Ignore:
Timestamp:
04/10/13 10:25:41 (12 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Added 'prefix' parameter for KEGG Pathway database interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _bioinformatics/obiKEGG/databases.py

    r1737 r1741  
    397397    Interface to the KEGG Genes database. 
    398398 
    399     :param org_code: KEGG organism code (e.g. 'hsa'). 
    400     :type org_code: str 
     399    :param str org_code: KEGG organism code (e.g. 'hsa'). 
    401400 
    402401    """ 
     
    576575 
    577576class Pathway(DBDataBase): 
     577    """ 
     578    KEGG Pathway database 
     579 
     580    :param str prefix: 
     581        KEGG Organism code ('hsa', ...) or 'map', 'ko', 'ec' or 'rn' 
     582 
     583    """ 
    578584    DB = "path" 
    579585    ENTRY_TYPE = PathwayEntry 
    580586 
    581     def __init__(self): 
    582         DBDataBase.__init__(self) 
    583         self._keys = [d.entry_id for d in self.api.list("path")] 
     587    def __init__(self, prefix="map"): 
     588        DBDataBase.__init__(self) 
     589        self.prefix = prefix 
     590        valid = [d.org_code for d in self.api.list_organisms()] + \ 
     591                ["map", "ko", "ec", "rn"] 
     592 
     593        if prefix not in valid: 
     594            raise ValueError("Invalid prefix %r" % prefix) 
     595 
     596        self._keys = [d.entry_id for d in self.api.list("pathway/" + prefix)] 
Note: See TracChangeset for help on using the changeset viewer.