code: def stack(S):
      
      S, nreps = zip(*S)
      S = np.array([list(x) for x in S])
      rows, cols = S.shape
      counts = []
      for c in xrange(cols):
          freq = [0] * NBASES
          for b, nrep in zip(S[:, c], nreps):
              freq[BASES.index(b)] += nrep
          counts.append(freq)
      return counts
docs: From list of bases at a site D,  make counts of bases