Changeset 1798:f1e73901a1d3 in orange-bioinformatics for _bioinformatics/obiGeneSets.py


Ignore:
Timestamp:
05/21/13 13:01:28 (11 months ago)
Author:
Flashpoint <vid.flashpoint@…>
Branch:
default
Children:
1799:2f952a765716, 1805:c2e4880abd58
Message:

Added Reactome Pathways genesets for humans

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _bioinformatics/obiGeneSets.py

    r1795 r1798  
    9393 
    9494    return GeneSets(genesets) 
     95 
     96def reactomePathwaysGeneSets(): 
     97    """ 
     98    Prepare human pathways gene sets from reactome pathways 
     99    """ 
     100    import urllib 
     101    import io 
     102    from zipfile import ZipFile 
     103 
     104    url = urllib.urlopen("http://www.reactome.org/download/current/ReactomePathways.gmt.zip") 
     105    memfile = io.BytesIO(url.read()) 
     106    with ZipFile(memfile, "r") as myzip: 
     107        f = myzip.open("ReactomePathways.gmt") 
     108        content = f.read().splitlines()       
     109 
     110    genesets = [GeneSet(id=path.split("\t")[0], name=path.split("\t")[0], genes=path.split("\t")[2:] if path.split("\t")[2:] else [], hierarchy=("Reactome", "Pathways"), organism="9606", link="") for path in content] 
     111    return GeneSets(genesets) 
     112 
    95113 
    96114def omimGeneSets(): 
     
    396414 
    397415if __name__ == "__main__": 
    398     print cytobandGeneSets() 
     416    print reactomePathwaysGeneSets() 
    399417    exit() 
    400418    rsf = orngServerFiles.ServerFiles(username=sys.argv[1], password=sys.argv[2]) 
Note: See TracChangeset for help on using the changeset viewer.