code: def _filter_bad_reads(in_bam, ref_file, data):
      
      bam.index(in_bam, data["config"])
      out_file = "%s-gatkfilter.bam" % os.path.splitext(in_bam)[0]
      if not utils.file_exists(out_file):
          with tx_tmpdir(data) as tmp_dir:
              with file_transaction(data, out_file) as tx_out_file:
                  params = [("FixMisencodedBaseQualityReads"
                             if dd.get_quality_format(data, "").lower() == "illumina"
                             else "PrintReads"),
                            "-R", ref_file,
                            "-I", in_bam,
                            "-O", tx_out_file,
                            "-RF", "MatchingBasesAndQualsReadFilter",
                            "-RF", "SeqIsStoredReadFilter",
                            "-RF", "CigarContainsNoNOperator"]
                  jvm_opts = broad.get_gatk_opts(data["config"], tmp_dir)
                  do.run(broad.gatk_cmd("gatk", jvm_opts, params), "Filter problem reads")
      bam.index(out_file, data["config"])
      return out_file
docs: Use GATK filter to remove problem reads which choke GATK and Picard.