Changeset 1352:4a2136565b48 in orange-bioinformatics


Ignore:
Timestamp:
03/23/11 14:42:20 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
544f29f9f69a3d2a92583c04c945bab2f58cd6eb
Message:

Calling gc.collect() when discarding an loaded Annotations object (otherwise it takes some time before it is collected).
Small code speedup in ontology tree construction.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • widgets/OWGOEnrichmentAnalysis.py

    r1340 r1352  
    499499            i+=1 
    500500        if org != self.loadedAnnotationCode: 
     501            self.annotations = None 
     502            gc.collect() # Force run garbage collection. 
    501503            code = self.annotationFiles[org].split(".")[-3] 
    502504            self.annotations = obiGO.Annotations(code, genematcher=obiGene.GMDirect(), progressCallback=lambda value: pb.advance()) 
     
    623625         
    624626        self.treeStructRootKey = None 
     627         
     628        parents = {} 
     629        for id in ids: 
     630            parents[id] = set([term for typeId, term in self.ontology[id].related]) 
     631             
     632        children = {} 
    625633        for term in self.terms: 
    626             parents = lambda t: [term for typeId, term in  self.ontology[t].related] 
    627             self.treeStructDict[term] = TreeNode(self.terms[term], [id for id in ids if term in parents(id)]) 
     634            children[term] = set([id for id in ids if term in parents[id]]) 
     635             
     636        for term in self.terms: 
     637            self.treeStructDict[term] = TreeNode(self.terms[term], children[term]) 
    628638            if not self.ontology[term].related and not getattr(self.ontology[term], "is_obsolete", False): 
    629639                self.treeStructRootKey = term 
     
    689699 
    690700        terms = self.graph.items() 
    691         terms.sort(lambda a,b:cmp(a[1][1],b[1][1])) 
     701        terms = sorted(terms, key=lambda item: item[1][1]) 
    692702        self.sigTableTermsSorted = [t[0] for t in terms] 
    693703         
Note: See TracChangeset for help on using the changeset viewer.