Changeset 1725:1c834422f29e in orange-bioinformatics for _bioinformatics/obiGeneSetSig.py


Ignore:
Timestamp:
11/21/12 21:56:03 (17 months ago)
Author:
markotoplak
Branch:
default
Message:

obiGeneSetSig: assess now works even if gene matcher did not perfectly match the whole file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _bioinformatics/obiGeneSetSig.py

    r1723 r1725  
    240240                for index_in_data, index_in_ex in indexes if 
    241241                ex[index_in_ex].value != '?' ] 
     242 
     243            indices_to_lcori = dict( (index_in_ex, i) for i,(_, index_in_ex) in enumerate(indexes)  
     244                if ex[index_in_ex].value != '?') 
     245 
    242246            #indexes in original lcor, sorted from higher to lower values 
    243247            ordered = obiGsea.orderedPointersCorr(lcor) 
    244248            rev2 = numpy.argsort(ordered) 
    245             self.example_buffer[key] = lcor,ordered,rev2 
     249            self.example_buffer[key] = lcor, ordered, rev2, indices_to_lcori 
    246250        return self.example_buffer[key] 
    247251 
     
    267271 
    268272            def t(ex, w, takegenes=takegenes, nm=nm, attrans=attrans, attransv=attransv): 
    269  
    270273                nm2, name_ind2, genes2 = self._match_instance(ex, takegenes) 
    271                 lcor, ordered, rev2 = self._ordered_and_lcor(ex, nm, name_ind, attrans, attransv) 
    272  
     274                lcor, ordered, rev2, indices_to_lcori = \ 
     275                    self._ordered_and_lcor(ex, nm, name_ind, attrans, attransv) 
     276         
    273277                #subset = list of indices, lcor = correlations, ordered = order 
    274                 subset = [ name_ind2[g] for g in genes2 ] 
     278                #make it compatible with lcor, if some are missing in lcor 
     279                subset = filter(None, 
     280                    [ indices_to_lcori.get(name_ind2[g], None) for g in genes2 ] ) 
    275281                return obiGsea.enrichmentScoreRanked(subset, lcor, ordered, rev2=rev2)[0]  
    276282 
Note: See TracChangeset for help on using the changeset viewer.