Changeset 1919:8de40fbc5a87 in orange-bioinformatics


Ignore:
Timestamp:
11/27/13 21:34:48 (5 months ago)
Author:
blaz <blaz.zupan@…>
Branch:
default
Message:

Some revision of rst documentation.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • docs/rst/index.rst

    r1790 r1919  
    33 
    44Orange Bioinformatics is an add-on for Orange_ data mining software package. It 
    5 extends Orange by providing common functionality for basic tasks in 
    6 bioinformatics. It also provides widgets for Orange Canvas, which enable users 
    7 who are not programmers to manage microarray and genomic data flow and to 
    8 customize their analysis by combining common data analysis tools to fit their 
    9 needs. 
     5extends Orange by providing functionality for some elementary tasks in 
     6bioinformatics, like gene set analysis, enrichment, and access to pathway 
     7libraries. Included are also widgets for with graphical user interface 
     8for, mainly, gene expression analytics. 
    109 
    1110.. _Orange: http://orange.biolab.si/ 
  • docs/rst/reference/dictybase.rst

    r1790 r1919  
    1 ================================ 
    2 dictyBase Mutants (:mod:`obiDictyMutants`) 
    3 ================================ 
     1.. py:currentmodule:: Orange.bio.obiDictyMutants 
    42 
    5 This module presents data on `Mutant phenotypes  
    6 <http://dictybase.org/Downloads/>`_ from the dictyBase. 
     3.. index:: mutant phenotypes 
     4.. index:: phenotypes 
     5.. index:: 
     6   single: D. dictyostelium; mutants 
     7 
     8******************************************************** 
     9D. discoideum Mutant Phenotypes (:mod:`obiDictyMutants`) 
     10******************************************************** 
     11 
     12Module :mod:`obiDictyMutants` provides interface to `Dictyostelium mutant phenotypes 
     13<http://dictybase.org/Downloads/>`_ data from the dictyBase_. 
     14The mutants are presented as `DictyMutant` objects with their respective name, 
     15strain descriptor, associated genes and associated phenotypes. 
     16 
     17Classes and Functions 
     18===================== 
    719 
    820.. automodule:: Orange.bio.obiDictyMutants 
     
    1022   :member-order: bysource 
    1123 
     24Examples 
     25======== 
     26 
     27   >>> from Orange.bio.obiDictyMutants import * 
     28   >>> # Create a set of all mutant objects 
     29   >>> dicty_mutants = mutants() 
     30   >>> # List a set of all genes referenced by a single mutant 
     31   >>> print mutant_genes(dicty_mutants[0]) 
     32   ['cbfA'] 
     33   >>> # List a set of all phenotypes referenced by a single mutant 
     34   >>> print mutant_phenotypes(dicty_mutants[0]) 
     35   ['aberrant protein localization'] 
     36   >>> # List all genes or all phenotypes referenced on Dictybase 
     37   >>> print genes() 
     38   >>> print phenotypes() 
     39   >>> # Display a dictionary {phenotypes: set(mutant_objects)} 
     40   >>> print phenotype_mutants() 
     41   >>> # Display a dictionary {genes: set(mutant_objects)} 
     42   >>> print gene_mutants() 
     43 
  • orangecontrib/bio/obiDictyMutants.py

    r1873 r1919  
    1 """ 
    2 ============================================================================== 
    3 DictyMutants - An interface to Dictyostelium discoideum mutants from Dictybase 
    4 ============================================================================== 
    5  
    6 :mod:`DictyMutants` is a python module for accessing Dictyostelium discoideum  
    7 mutant collections from the `Dictybase <http://www.dictybase.org/>`_ website. 
    8  
    9 The mutants are presented as `DictyMutant` objects with their respective name, 
    10 strain descriptor, associated genes and associated phenotypes. 
    11  
    12 >>> from Orange.bio.obiDictyMutants import * 
    13 >>> # Create a set of all mutant objects 
    14 >>> dicty_mutants = mutants()  
    15 >>> # List a set of all genes referenced by a single mutant 
    16 >>> print mutant_genes(dicty_mutants[0]) 
    17 ['cbfA'] 
    18 >>> # List a set of all phenotypes referenced by a single mutant 
    19 >>> print mutant_phenotypes(dicty_mutants[0]) 
    20 ['aberrant protein localization'] 
    21 >>> # List all genes or all phenotypes referenced on Dictybase 
    22 >>> print genes() 
    23 >>> print phenotypes() 
    24 >>> # Display a dictionary {phenotypes: set(mutant_objects)} 
    25 >>> print phenotype_mutants() 
    26 >>> # Display a dictionary {genes: set(mutant_objects)} 
    27 >>> print gene_mutants() 
    28 """ 
    29  
    301import os 
    312import urllib2 
     
    4314tags = ["Dictyostelium discoideum", "mutant", "dictyBase", "phenotype"] 
    4415 
     16 
    4517class DictyMutant(object): 
    4618    """ 
     
    4921    
    5022    :param mutant_entry: A single mutant entry from  
    51         dictybase's `all curated mutants file <http://dictybase.org/db/cgi-bin/dictyBase/download/download.pl?area=mutant_phenotypes&ID=all-mutants.txt>`_ (updated monthly) 
     23        dictyBase's `all curated mutants file <http://dictybase.org/db/cgi-bin/dictyBase/download/download.pl?area=mutant_phenotypes&ID=all-mutants.txt>`_ (updated monthly) 
    5224    :type mutant_entry: str 
    5325 
     
    6941        self.develop = False 
    7042        self.other = False 
    71   
     43 
     44 
    7245class DictyMutants(object): 
    7346    """ 
     
    7548    a dictionary of `DictyMutant` objects 
    7649     
    77     :param local_database_path: A user defined path for storing dicty mutants objects in a file. If `None` then a default database path is used. 
     50    :param local_database_path: A user defined path for storing D. dictyostelium mutants objects in a file. If `None` then a default database path is used. 
    7851     
    7952    """ 
     
    10477    def load_mutants(self, file): 
    10578        data = open(file) 
    106         data_header = data.readline() 
     79        #data_header = data.readline() 
    10780        data = data.read() 
    10881        return data.splitlines() 
     
    11083    def download_mutants(self):    
    11184        all_mutants = self.load_mutants(self.update_file("all-mutants.txt")) 
    112         null_mutants = self.load_mutants(self.update_file("null-mutants.txt")) 
    113         overexp_mutants = self.load_mutants(self.update_file("overexpression-mutants.txt")) 
    114         multiple_mutants = self.load_mutants(self.update_file("multiple-mutants.txt")) 
    115         develop_mutants = self.load_mutants(self.update_file("developmental-mutants.txt")) 
    116         other_mutants = self.load_mutants(self.update_file("other-mutants.txt")) 
     85        null_mutants = self.load_mutants( 
     86            self.update_file("null-mutants.txt")) 
     87        overexp_mutants = self.load_mutants( 
     88            self.update_file("overexpression-mutants.txt")) 
     89        multiple_mutants = self.load_mutants( 
     90            self.update_file("multiple-mutants.txt")) 
     91        develop_mutants = self.load_mutants( 
     92            self.update_file("developmental-mutants.txt")) 
     93        other_mutants = self.load_mutants( 
     94            self.update_file("other-mutants.txt")) 
    11795    
    11896        _mutants = [DictyMutant(mutant) for mutant in all_mutants] 
     
    150128 
    151129    def genes(self): 
    152         return sorted(set(reduce(list.__add__, [self.mutant_genes(mutant) for mutant in self.mutants()], []))) 
     130        return sorted(set(reduce(list.__add__, 
     131                                 [self.mutant_genes(mutant) 
     132                                  for mutant in self.mutants()], []))) 
    153133 
    154134    def phenotypes(self): 
    155         return sorted(set(reduce(list.__add__, [self.mutant_phenotypes(mutant) for mutant in self.mutants()], []))) 
     135        return sorted(set(reduce(list.__add__, 
     136                                 [self.mutant_phenotypes(mutant) 
     137                                  for mutant in self.mutants()], []))) 
    156138 
    157139    def mutant_genes(self, mutant): 
     
    163145    def gene_mutants(self): 
    164146        dgm = defaultdict(set) 
    165         for mutant, genes in [(mutant, self.mutant_genes(mutant)) for mutant in self.mutants()]: 
     147        for mutant, genes in [(mutant, self.mutant_genes(mutant)) 
     148                              for mutant in self.mutants()]: 
    166149            for gene in genes: 
    167150                dgm[gene].add(mutant) 
     
    170153    def phenotype_mutants(self): 
    171154        dpm = defaultdict(set) 
    172         for mutant, phenotypes in [(mutant, self.mutant_phenotypes(mutant)) for mutant in self.mutants()]: 
     155        for mutant, phenotypes in [(mutant, self.mutant_phenotypes(mutant)) 
     156                                   for mutant in self.mutants()]: 
    173157            for phenotype in phenotypes: 
    174158                dpm[phenotype].add(mutant) 
    175159        return dpm 
    176160 
     161 
    177162def mutants(): 
    178163    """ Return all mutant objects 
     
    180165    return DictyMutants.get_instance().mutants() 
    181166 
     167 
    182168def genes(): 
    183169    """ Return a set of all genes referenced in dictybase 
     
    185171    return DictyMutants.get_instance().genes() 
    186172 
     173 
    187174def phenotypes(): 
    188175    """ Return a set of all phenotypes referenced in dictybase 
     
    190177    return DictyMutants.get_instance().phenotypes() 
    191178 
     179 
    192180def mutant_genes(mutant): 
    193181    """ Return a set of all genes referenced by a mutant in dictybase 
     
    195183    return DictyMutants.get_instance().mutant_genes(mutant) 
    196184 
     185 
    197186def mutant_phenotypes(mutant):    
    198187    """ Return a set of all phenotypes referenced by a mutant in dictybase 
     
    200189    return DictyMutants.get_instance().mutant_phenotypes(mutant) 
    201190 
     191 
    202192def gene_mutants(): 
    203193    """ Return a dictionary {gene: set(mutant_objects for mutant), ...} 
     
    205195    return DictyMutants.get_instance().gene_mutants() 
    206196 
     197 
    207198def phenotype_mutants(): 
    208199    """ Return a dictionary {phenotype: set(mutant_objects for mutant), ...} 
     
    210201    return DictyMutants.get_instance().phenotype_mutants() 
    211202 
     203 
    212204def download_mutants(): 
    213205    return DictyMutants.get_instance().pickle_data() 
    214206 
    215 if  __name__  == "__main__": 
     207 
     208if __name__ == "__main__": 
    216209    dicty_mutants = mutants() 
    217210    print mutant_phenotypes(dicty_mutants[0]) 
    218 #    print(phenotypes())#_mutants())     
Note: See TracChangeset for help on using the changeset viewer.