Changeset 1549:bff566fa42dc in orange-bioinformatics for obiGeneSets.py


Ignore:
Timestamp:
02/03/12 14:56:10 (2 years ago)
Author:
ales_erjavec
Branch:
default
Message:

obiGeneSets.keggGeneSets now uses obiKEGG2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • obiGeneSets.py

    r1216 r1549  
    175175    Returns gene sets from KEGG pathways. 
    176176    """ 
     177    import obiKEGG2 as obiKEGG 
     178     
    177179    kegg = obiKEGG.KEGGOrganism(org) 
    178180 
     
    180182    for id in kegg.pathways(): 
    181183        pway = obiKEGG.KEGGPathway(id) 
    182         hier = ("KEGG",) 
    183         gs = obiGeneSets.GeneSet(id=id, name=pway.title, genes=kegg.get_genes_by_pathway(id), hierarchy=hier, organism=org, link=pway.link) 
     184        hier = ("KEGG","pathways") 
     185        gs = obiGeneSets.GeneSet(id=id, 
     186                                 name=pway.title, 
     187                                 genes=kegg.get_genes_by_pathway(id), 
     188                                 hierarchy=hier, 
     189                                 organism=org, 
     190                                 link=pway.link) 
    184191        genesets.append(gs) 
    185192 
     
    204211    link_fmt = "http://www.mirbase.org/cgi-bin/mirna_entry.pl?acc=%s" 
    205212    mirnas = [(id, obimiRNA.get_info(id)) for id in obimiRNA.ids(org_code)] 
    206     genesets = [GeneSet(id=mirna.matACC, name=mirna.matID, genes=mirna.targets.split(","), hierarchy=("miRNA",), 
     213    genesets = [GeneSet(id=mirna.matACC, name=mirna.matID, genes=mirna.targets.split(","), hierarchy=("miRNA", "Targets"), 
    207214                        organism=org, link=link_fmt % mirna.matID) for id, mirna in mirnas] 
    208215    return GeneSets(genesets) 
     216 
     217def go_miRNASets(org, ontology=None, enrichment=True, pval=0.05, treshold=0.04): 
     218    import obimiRNA, obiGO 
     219    mirnas = obimiRNA.ids(int(org)) 
     220    if ontology is None: 
     221        ontology = obiGO.Ontology() 
     222          
     223    annotations = obiGO.Annotations(org, ontology=ontology) 
     224     
     225    go_sets = obimiRNA.get_GO(mirnas, annotations, enrichment=enrichment, pval=pval, goSwitch=False) 
     226    print go_sets 
     227     
     228    go_sets = obimiRNA.filter_GO(go_sets, annotations, treshold=treshold) 
     229     
     230    import obiGeneSets as gs 
     231    link_fmt = "http://amigo.geneontology.org/cgi-bin/amigo/term-details.cgi?term=%s" 
     232    gsets = [gs.GeneSet(id=key, name=ontology[key].name, genes=value, hierarchy=("miRNA", "go_sets",), 
     233                        organism=org, link=link_fmt % key) for key, value in go_sets.items()] 
     234    gset = gs.GeneSets(gsets) 
     235    return gset 
     236 
    209237 
    210238def loadGMT(contents, name): 
Note: See TracChangeset for help on using the changeset viewer.