def entropy_score(seq): ''' go over the sequence with a sliding window and return the window of size cfg.kol_winsize that has the lowest kolmogorov entropy score. if it is too low, this sequence shouldn't be used as a mutant (as it likely contains sequence of low complexity). ''' min_entr = 1 if seq < cfg.kol_winsize: raise(ValueError('The sequence given is too short to compute entropy!')) chunks = sliding_window(seq,cfg.kol_winsize) for chunk in chunks: chunk_entr = entropy.kolmogorov(chunk) if chunk_entr < min_entr: min_entr = chunk_entr return min_entr
def kolmogorov(self): return round(kolmogorov(self.payload),4)