Changeset 1802:959e64f489d2 in orange-bioinformatics for _bioinformatics/obiGeneSetSig.py


Ignore:
Timestamp:
05/29/13 12:58:35 (11 months ago)
Author:
markotoplak
Branch:
default
Message:

obiGeneSetSig: Prevent crashing of LLR if the standard deviation is zero.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _bioinformatics/obiGeneSetSig.py

    r1801 r1802  
    166166     
    167167    if common_if_extreme and extreme(): 
    168         print "extreme", st1, st2, 
    169168        st1 = st2 = statc.std(list1 + list2) 
    170         print "new", st1, st2 
    171169 
    172170    return mi1, st1, mi2, st2 
     
    671669 
    672670def _llrlogratio(v, mi1, std1, mi2, std2): 
    673     if mi1 == None or std1 == None or mi2 == None or std2 == None: 
     671    if mi1 == None or std1 == None or mi2 == None or std2 == None or std1 == 0 or std2 == 0: 
    674672        return 0. #problem with estimation 
    675673    #lpdf1 = scipy.stats.norm.logpdf(v, mi1, std1) 
     
    723721                for v,g in zip(vals, genes_gs): 
    724722                    m,s = normalizec[g] 
    725                     vals2.append((v-m)/s) 
     723                    if s == 0: #disregard attributes without differences 
     724                        vals2.append(0.) 
     725                    else: 
     726                        vals2.append((v-m)/s) 
    726727                vals = vals2 
    727728             
Note: See TracChangeset for help on using the changeset viewer.