Changeset 1768:9cb38945684f in orange-bioinformatics for _bioinformatics/obiGO.py


Ignore:
Timestamp:
04/30/13 13:22:17 (12 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Removed deprecated and nonfunctioning 'drawEnrichmentGraph_tostream' function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _bioinformatics/obiGO.py

    r1767 r1768  
    10911091 
    10921092 
    1093 def drawEnrichmentGraph_tostream(GOTerms, clusterSize, refSize, fh, width=None, height=None): 
    1094     def getParents(term): 
    1095         parents = extractGODAG([term]) 
    1096         parents = filter(lambda t: t.id in GOTerms and t.id != term, parents) 
    1097         c = [] 
    1098         map(c.extend, [getParents(t.id) for t in parents]) 
    1099         parents = filter(lambda t: t not in c, parents) 
    1100         return parents 
    1101     parents = dict([(term, getParents(term)) for term in GOTerms]) 
    1102     # print "Parentes", parents 
    1103  
    1104     def getChildren(term): 
    1105         return filter(lambda t: term in [p.id for p in parents[t]], GOTerms.keys()) 
    1106     topLevelTerms = filter(lambda t: not parents[t], parents.keys()) 
    1107     # print "Top level terms", topLevelTerms 
    1108     termsList = [] 
    1109  
    1110     def collect(term, parent): 
    1111         termsList.append( 
    1112             ((float(len(GOTerms[term][0])) / clusterSize) / (float(GOTerms[term][2]) / refSize), 
    1113             len(GOTerms[term][0]), 
    1114             GOTerms[term][2], 
    1115             "%.4f" % GOTerms[term][1], 
    1116             loadedGO.termDict[term].name, 
    1117             loadedGO.termDict[term].id, 
    1118             ", ".join(GOTerms[term][0]), 
    1119             parent) 
    1120             ) 
    1121 ##        print float(len(GOTerms[term][0])), float(GOTerms[term][2]), clusterSize, refSize 
    1122         parent = len(termsList) - 1 
    1123         for c in getChildren(term): 
    1124             collect(c, parent) 
    1125  
    1126     for topTerm in topLevelTerms: 
    1127         collect(topTerm, None) 
    1128  
    1129     drawEnrichmentGraphPIL_tostream(termsList, fh, width, height) 
    1130  
    1131  
    1132 def drawEnrichmentGraph(enriched, file="graph.png", width=None, height=None, header=None, ontology=None, precison=3): 
     1093def drawEnrichmentGraph(enriched, file="graph.png", width=None, height=None, 
     1094                        header=None, ontology=None, precison=3): 
    11331095    file = open(file, "wb") if type(file) == str else file 
    1134     drawEnrichmentGraph_tostreamMk2(enriched, file, width, height, header, ontology, precison) 
    1135  
    1136  
    1137 def drawEnrichmentGraph_tostreamMk2(enriched, fh, width, height, header=None, ontology=None, precison=4): 
     1096    drawEnrichmentGraph_tostreamMk2(enriched, file, width, height, header, 
     1097                                    ontology, precison) 
     1098 
     1099 
     1100def drawEnrichmentGraph_tostreamMk2(enriched, fh, width, height, header=None, 
     1101                                    ontology=None, precison=4): 
    11381102    ontology = ontology if ontology else Ontology() 
    11391103    header = header if header else ["List", "Total", "p-value", "FDR", 
     
    11591123 
    11601124    def collect(term, parent): 
    1161 ##        termsList.append( 
    1162 ##            ((float(len(GOTerms[term][0]))/clusterSize) / (float(GOTerms[term][2])/refSize), 
    1163 ##            len(GOTerms[term][0]), 
    1164 ##            GOTerms[term][2], 
    1165 ##            "%.4f" % GOTerms[term][1], 
    1166 ##            loadedGO.termDict[term].name, 
    1167 ##            loadedGO.termDict[term].id, 
    1168 ##            ", ".join(GOTerms[term][0]), 
    1169 ##            parent) 
    1170 ##            ) 
    11711125        termsList.append(GOTerms[term][1:4] + \ 
    11721126                         (fmt % GOTerms[term][4], 
     
    11741128                          ontology[term].name, 
    11751129                          ", ".join(GOTerms[term][6])) + (parent,)) 
    1176 ##        print float(len(GOTerms[term][0])), float(GOTerms[term][2]), clusterSize, refSize 
    11771130        parent = len(termsList) - 1 
    11781131        for c in getChildren(term): 
Note: See TracChangeset for help on using the changeset viewer.