code: def idxstats(in_bam, data):
      
      index(in_bam, data["config"], check_timestamp=False)
      AlignInfo = collections.namedtuple("AlignInfo", ["contig", "length", "aligned", "unaligned"])
      samtools = config_utils.get_program("samtools", data["config"])
      idxstats_out = subprocess.check_output([samtools, "idxstats", in_bam]).decode()
      out = []
      for line in idxstats_out.split("\n"):
          if line.strip():
              contig, length, aligned, unaligned = line.split("\t")
              out.append(AlignInfo(contig, int(length), int(aligned), int(unaligned)))
      return out
docs: Return BAM index stats for the given file, using samtools idxstats.