Changeset 1736:b3b664abcfdd in orange-bioinformatics for _bioinformatics/obiKEGG/__init__.py


Ignore:
Timestamp:
04/05/13 19:43:36 (13 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Added sphinx rst documentation for obiKEGG.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _bioinformatics/obiKEGG/__init__.py

    r1735 r1736  
    44============================================== 
    55 
    6 This is a python module for access to `KEGG`_ using its web services. 
    7  
    8 To use this module you need to have `slumber` and `requests` package 
    9 installed. 
    10  
    11 .. _`KEGG`: http://www.genome.jp/kegg/ 
    12  
     6:mod:`obiKEGG` is a python module for accessing `KEGG (Kyoto Encyclopedia 
     7of Genes and Genomes) <http://www.genome.jp/kegg/>`_ using its web services. 
     8 
     9.. note:: To use this module you need to have `slumber`_ and `requests`_ 
     10          package installed. 
     11 
     12.. _`slumber`: https://pypi.python.org/pypi/slumber/ 
     13 
     14.. _`requests`: https://pypi.python.org/pypi/requests 
     15 
     16 
     17>>> # Create a KEGG Genes database interface 
     18>>> genome = KEGGGenome() 
     19>>> # List all available entry ids 
     20>>> keys = genome.keys() 
     21>>> print keys[0] 
     22T01001 
     23>>> # Retrieve the entry for the key. 
     24>>> entry = genome[keys[0]] 
     25>>> print entry.entry_key 
     26T01001 
     27>>> print entry.definition 
     28Homo sapiens (human) 
     29>>> print str(entry) 
     30ENTRY       T01001            Complete  Genome 
     31NAME        hsa, HUMAN, 9606 
     32DEFINITION  Homo sapiens (human) 
     33... 
     34 
     35The :class:`Organism` class can be used as a convenient starting point 
     36for organism specific databases. 
     37 
     38>>> organism = Organism("Homo sapiens")  # searches for the organism by name 
     39>>> print organism.org_code  # prints the KEGG organism code 
     40hsa 
     41>>> genes = organism.genes  # get the genes database for the organism 
     42>>> gene_ids = genes.keys() # KEGG gene identifiers 
     43>>> entry = genes["hsa:672"] 
     44>>> print entry.definition 
     45breast cancer 1, early onset 
     46>>> print entry  # print the entry in DBGET database format. 
     47ENTRY       672               CDS       T01001 
     48NAME        BRCA1, BRCAI, BRCC1, BROVCA1, IRIS, PNCA4, PPP1R53, PSCP, RNF53 
     49DEFINITION  breast cancer 1, early onset 
     50... 
    1351 
    1452""" 
     
    64102    organism in the KEGG Genes database. 
    65103 
    66     :param org: KEGGG organism code (e.g. "hsa", "sce") 
     104    :param org: KEGG organism code (e.g. "hsa", "sce"). Can also be a 
     105        descriptive name (e.g. 'yeast', "homo sapiens") in which case the 
     106        organism code will be searched for by using KEGG `find` api. 
    67107    :type org: str 
     108 
     109    .. seealso:: 
     110 
     111        :func:`organism_name_search` 
     112            Search KEGG for an organism code 
    68113 
    69114    """ 
     
    83128    def genes(self): 
    84129        """ 
    85         An :class:`Genes` database instance for this organism. 
     130        An :class:`~.databases.Genes` database instance for this organism. 
    86131        """ 
    87132        # TODO: This should not be a property but a method. 
     
    134179    def list_pathways(self): 
    135180        """ 
    136         List all pathways. 
     181        List all pathways for this organism. 
     182 
     183        .. deprecated: 2.5 
     184            Use :func:`pathways` instead. 
     185 
    137186        """ 
    138187        # NOTE: remove/deprecate and use pathways() 
     
    304353 
    305354def organism_name_search(name): 
     355    """ 
     356    Search and organism by `name` and return an KEGG organism code. 
     357    """ 
    306358    return KEGGOrganism.organism_name_search(name) 
    307359 
    308360 
    309361def pathways(org): 
     362    """ 
     363    Return a list of all KEGG pathways for an KEGG organism code `org`. 
     364    """ 
    310365    return KEGGPathway.list(org) 
    311366 
    312367 
    313368def organisms(): 
     369    """ 
     370    Return a list of all KEGG organisms. 
     371    """ 
    314372    return KEGGOrganism.organisms() 
    315373 
    316374 
    317375def from_taxid(taxid): 
     376    """ 
     377    Return a KEGG organism code for a an NCBI Taxonomy id string `taxid`. 
     378    """ 
    318379    genome = KEGGGenome() 
    319380    res = genome.search(taxid) 
     
    328389 
    329390def to_taxid(name): 
     391    """ 
     392    Return a NCBI Taxonomy id for a given KEGG Organism name 
     393    """ 
    330394    genome = KEGGGenome() 
    331395    if name in genome: 
Note: See TracChangeset for help on using the changeset viewer.