Changeset 1871:aa8b068bd7a1 in orange-bioinformatics for _bioinformatics/widgets/OWHeatMap.py


Ignore:
Timestamp:
10/09/13 20:37:57 (6 months ago)
Author:
markotoplak
Branch:
default
Message:

Fixed HeatMap selections with "Sort genes" option. Selection also works correctly with Merge parameter and multiple classes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _bioinformatics/widgets/OWHeatMap.py

    r1867 r1871  
    12281228        if self.sorted_data: 
    12291229            if self.selected_rows: 
    1230                 #bug if merge is used does not return enough genes 
    1231                 #examples = [self.sorted_data[i] for i in self.selected_rows] 
    1232  
    1233                 #uses Merge parameter, but does not work correctly for data with multiple classes 
    1234                 examples = [self.sorted_data[i*self.Merge+j] for i in self.selected_rows for j in range(self.Merge) if i*self.Merge+j < len(self.sorted_data)] 
    1235  
     1230                 
     1231                #obtain examples directly from the heatmap, so their order does not matter 
     1232 
     1233                rd = self.selection_manager.rows_to_heatmaps() 
     1234                hr = self.selection_manager._heatmap_ranges 
     1235 
     1236                examples = [] 
     1237                for row in self.selected_rows: 
     1238                    h = rd[row][0] 
     1239                    begin,_ = hr[h] 
     1240                    hm = h.heatmap 
     1241                    examples.extend(hm.examples[hm.exampleIndices[row-begin] : hm.exampleIndices[row+1-begin]]) 
     1242                     
    12361243                data = orange.ExampleTable(examples) 
     1244 
    12371245            else: 
    12381246                data = None 
Note: See TracChangeset for help on using the changeset viewer.