code: def peak_calling(clus_obj):
      
      new_cluster = {}
      for cid in clus_obj.clus:
          cluster = clus_obj.clus[cid]
          cluster.update()
          logger.debug("peak calling for %s" % cid)
          bigger = cluster.locimaxid
          if bigger in clus_obj.loci:
              s, e = min(clus_obj.loci[bigger].counts.keys()), max(clus_obj.loci[bigger].counts.keys())
              scale = s
              if clus_obj.loci[bigger].strand == "-":
                  scale = e
              logger.debug("bigger %s at %s-%s" % (bigger, s, e))
              dt = np.array([0] * (abs(e - s) + 12))
              for pos in clus_obj.loci[bigger].counts:
                  ss = abs(int(pos) - scale) + 5
                  dt[ss] += clus_obj.loci[bigger].counts[pos]
          x = np.array(range(0, len(dt)))
          logger.debug("x %s and y %s" % (x, dt))
          # tab = pd.DataFrame({'x': x, 'y': dt})
          # tab.to_csv( str(cid) + "peaks.csv", mode='w', header=False, index=False)
          if len(x) > 35 + 12:
              peaks = list(np.array(pysen.pysenMMean(x, dt)) - 5)
              logger.debug(peaks)
          else:
              peaks =  ['short']
          cluster.peaks = peaks
          new_cluster[cid] = cluster
      clus_obj.clus = new_cluster
      return clus_obj
docs: Run peak calling inside each cluster