code: def prepare_bam(bam_in, precursors):
      
      # use pybedtools to keep valid positions
      # intersect option with -b bigger_cluster_loci
      a = pybedtools.BedTool(bam_in)
      b = pybedtools.BedTool(precursors)
      c = a.intersect(b, u=True)
      out_file = utils.splitext_plus(op.basename(bam_in))[0] + "_clean.bam"
      c.saveas(out_file)
      return op.abspath(out_file)
docs: Clean BAM file to keep only position inside the bigger cluster