Changeset 1954:9884f85531a9 in orange-bioinformatics


Ignore:
Timestamp:
01/29/14 14:45:41 (3 months ago)
Author:
markotoplak
Branch:
default
Message:

Updated GSEA examples to the new namespace.

Location:
docs/reference-html
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • docs/reference-html/gsea1.py

    r1662 r1954  
    1 import orange, obiGsea, obiGene 
     1import Orange 
     2from Orange.bio import obiGsea, obiGene 
    23 
    3 data = orange.ExampleTable("iris") 
     4data = Orange.data.Table("iris") 
    45 
    56gen1 = dict([ 
     
    1011res = obiGsea.runGSEA(data, matcher=obiGene.matcher([]), minSize=2, geneSets=gen1) 
    1112print "%5s  %6s %6s %s" % ("LABEL", "NES", "P-VAL", "GENES") 
    12 for name,resu in res.items(): 
    13     print "%5s  %6.3f %6.3f %s" % (name, resu["nes"], resu["p"], str(resu["genes"])) 
     13for gs,resu in res.items(): 
     14    print "%5s  %6.3f %6.3f %s" % (gs.id, resu["nes"], resu["p"], str(resu["genes"])) 
  • docs/reference-html/gsea2.py

    r1662 r1954  
    1 import obiDicty 
    2 import obiGeneSets 
    3 import obiGsea 
    4 import orange 
    5 import obiGene 
     1import Orange 
     2from Orange.bio import obiDicty, obiGeneSets, obiGsea,obiGene 
    63 
    74dbc = obiDicty.DatabaseConnection() 
    8 data = dbc.getData(sample='pkaC-', time="8")[0] #get first chip 
     5data = dbc.get_single_data(sample='pkaC-', time="8") 
    96 
    10 print "First 10 examples" 
    11 for ex in data[:10]: 
    12     print ex 
     7#select the first chip (the first attribute) 
     8data = data.translate([data.domain.attributes[0]], True) 
    139 
    14 matcher=obiGene.matcher([[obiGene.GMKEGG("ddi"),obiGene.GMDicty()]]) 
     10matcher = obiGene.matcher([[obiGene.GMKEGG("dicty"), obiGene.GMDicty()]]) 
     11genesets =  obiGeneSets.collections((("KEGG",), "dicty")) 
    1512 
    16 genesets =  obiGeneSets.collections([":kegg:ddi"]) 
    17 res = obiGsea.runGSEA(data, matcher=matcher, minPart=0.05, geneSets=genesets,  
    18     permutation="gene") 
     13res = obiGsea.runGSEA(data, matcher=matcher, minPart=0.05,  
     14    geneSets=genesets, permutation="gene") 
    1915 
    20 print "GSEA results" 
    21 print "%-40s %6s %6s %6s %7s" % ("LABEL", "NES", "P-VAL", "SIZE", "MATCHED")  
    22 for name,resu in res.items()[:10]:  
    23     print "%-40s %6.3f %6.3f %6d %7d" % (name[:30], resu["nes"], resu["p"],  
    24         resu["size"], resu["matched_size"])  
     16print "%-40s %6s %6s %6s %7s" % ("LABEL", "NES", "P-VAL", "SIZE", "MATCHED") 
     17for name,resu in sorted(res.items()[:10], key=lambda x: x[1]["p"]):  
     18    print "%-40s %6.3f %6.3f %6d %7d" % (name.name[:35], resu["nes"], 
     19        resu["p"], resu["size"], resu["matched_size"])  
    2520 
  • docs/reference-html/gsea3.py

    r1662 r1954  
    1 import obiGeneSets 
    2 import obiGsea 
    3 import orange 
    4 import obiGene 
    5 import obiGEO 
     1import Orange 
     2from Orange.bio import obiDicty, obiGeneSets, obiGsea, obiGene, obiGEO 
    63 
    7 import obiGEO 
    84gds = obiGEO.GDS("GDS10") 
    95data = gds.getdata()  
     
    128print map(lambda x: x[0], obiGsea.allgroups(data).items()) 
    139 
    14 matcher=obiGene.matcher([obiGene.GMKEGG("9606")]) 
     10matcher = obiGene.matcher([obiGene.GMKEGG("Homo sapiens")]) 
     11genesets = obiGeneSets.collections((("KEGG",), "Homo sapiens")) 
    1512 
    16 phenVar = "tissue" 
    17 geneVar = "gene" #use gene meta variable for gene names 
    18  
    19 genesets =  obiGeneSets.collections([":kegg:hsa"]) 
     13#the number of permutations (n) should be much higher 
    2014res = obiGsea.runGSEA(data, matcher=matcher, minPart=0.05, geneSets=genesets,  
    21     permutation="class", n=10, phenVar=phenVar, geneVar=geneVar) 
     15    permutation="class", n=10, phenVar="tissue", geneVar="gene")  
    2216 
    2317print 
    24 print "GSEA results (choosen descriptor: tissue)" 
     18print "GSEA results (descriptor: tissue)" 
    2519print "%-40s %6s %6s %6s %7s" % ("LABEL", "NES", "FDR", "SIZE", "MATCHED")  
    26 for name,resu in sorted(res.items(), key=lambda x: x[1]["fdr"])[:10]:  
    27     print "%-40s %6.3f %6.3f %6d %7d" % (name[:30], resu["nes"], resu["fdr"],  
    28         resu["size"], resu["matched_size"])  
     20for gs, resu in sorted(res.items(), key=lambda x: x[1]["fdr"])[:10]:  
     21    print "%-40s %6.3f %6.3f %6d %7d" % (gs.name[:30], 
     22        resu["nes"], resu["fdr"], resu["size"], resu["matched_size"])  
Note: See TracChangeset for help on using the changeset viewer.