Changeset 1570:950a2fb24181 in orange-bioinformatics


Ignore:
Timestamp:
02/16/12 21:28:25 (2 years ago)
Author:
markotoplak
Branch:
default
Message:

Prepared obiAssess for testing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • obiAssess.py

    r1414 r1570  
    1212import obiGeneSets 
    1313import orange 
     14import Orange 
    1415import stats 
    1516import statc 
     
    630631            
    631632    for name, gs in genesets.items(): #for each geneset 
    632  
     633        #for each gene set: take the attribute subset and work on the attribute subset only 
    633634        #only select the subset of genes from the learning data 
    634635        domain = orange.Domain([ldata.domain.attributes[ai] for ai in gs], ldata.domain.classVar) 
     
    658659 
    659660if __name__ == "__main__": 
    660      
    661     """ 
    662     data = orange.ExampleTable("DLBCL.tab") 
    663     """ 
    664  
    665     data = orange.ExampleTable("sterolTalkHepa.tab") 
    666     data = impute_missing(data) 
    667     choosen_cv = [ "LK935_48h", "Rif_12h"] 
    668     ncl = orange.EnumVariable("cl", values=choosen_cv) 
    669     ncl.getValueFrom = lambda ex,rw: orange.Value(ncl, ex[-1].value) 
    670     ndom = orange.Domain(data.domain.attributes, ncl) 
    671     data = orange.ExampleTable(ndom, [ ex for ex in data if ex[-1].value in choosen_cv ]) 
    672      
    673     choosen_cv = list(data.domain.classVar.values) 
    674  
    675     fp = int(9*len(data)/10) 
    676  
     661 
     662    data = Orange.data.Table("iris") 
     663    gsets = obiGeneSets.collections({ 
     664        "ALL": ['sepal length', 'sepal width', 'petal length', 'petal width'], 
     665        "f3": ['sepal length', 'sepal width', 'petal length'], 
     666        "l3": ['sepal width', 'petal length', 'petal width'], 
     667        }) 
     668 
     669    fp = 120 
    677670    ldata = orange.ExampleTable(data.domain, data[:fp]) 
    678671    tdata = orange.ExampleTable(data.domain, data[fp:]) 
    679672 
    680     matcher = obiGene.GMKEGG("hsa") 
    681  
    682     gsets = obiGeneSets.collections("steroltalk.gmt") 
    683     #gsets = obiGeneSets.collections("C2.CP.gmt", "C5.MF.gmt", "C5.BP.gmt") 
    684  
     673    matcher = obiGene.matcher([]) 
     674 
     675    choosen_cv = ["Iris-setosa", "Iris-versicolor"] 
    685676    #ass = AssessLearner()(data, matcher, gsets, rankingf=AT_loessLearner()) 
    686677    #ass = MeanLearner()(data, matcher, gsets, default=False)) 
     
    692683 
    693684    ar = defaultdict(list) 
    694  
    695     print data.domain.classVar.values 
    696  
    697     for d in list(ldata) + list(tdata): 
     685    for d in (list(ldata) + list(tdata))[:5]: 
    698686        for a,b in ass(d).items(): 
    699687            ar[a].append(b) 
    700688 
    701689    ol =  sorted(ar.items()) 
    702     #print ol 
    703  
    704     print '\n'.join([ str(a) + ": " +str(b) for a,b in ol]) 
     690    print '\n'.join([ a.id + ": " +str(b) for a,b in ol]) 
     691 
Note: See TracChangeset for help on using the changeset viewer.