code: def scansum(self,seq,threshold = -1000):
          
          ll = self.ll
          sum = 0
          width        = self.width
          width_r      = range(width)
          width_rcr    = range(width-1,-1,-1)
          width_ranges = zip(width_r,width_rcr)
          seqcomp      = seq.translate(revcompTBL)
  
          total = 0
          hits  = 0
          etotal= 0
          for offset in range(len(seq)-width+1):
              total_f = 0
              total_r = 0
              for i,ir in width_ranges:
                  pos = offset+i
                  total_f = total_f + ll[i][    seq[pos]]
                  total_r = total_r + ll[i][seqcomp[pos]]
              total_max = max(total_f,total_r)
              if total_max >= threshold:
                  total = total + total_max
                  etotal = etotal + math.exp(total_max)
                  hits  = hits + 1
              if not hits:
                  ave = 0
              else:
                  ave = float(total)/float(hits)
          return(total,hits,ave,math.log(etotal))
docs: m.scansum(seq,threshold = -1000) -- Sum of scores over every window in the sequence.  Returns
                                              total, number of matches above threshold, average score, sum of exp(score)