code: def picard_prep(in_bam, names, ref_file, dirs, data):
      
      runner = broad.runner_from_path("picard", data["config"])
      work_dir = utils.safe_makedir(os.path.join(dirs["work"], "bamclean", names["sample"]))
      runner.run_fn("picard_index_ref", ref_file)
      reorder_bam = os.path.join(work_dir, "%s-reorder.bam" %
                                 os.path.splitext(os.path.basename(in_bam))[0])
      if not utils.file_exists(reorder_bam):
          reorder_bam = os.path.join(work_dir, "%s-reorder.bam" % dd.get_sample_name(data))
      reorder_bam = runner.run_fn("picard_reorder", in_bam, ref_file, reorder_bam)
      rg_bam = runner.run_fn("picard_fix_rgs", reorder_bam, names)
      return _filter_bad_reads(rg_bam, ref_file, data)
docs: Prepare input BAM using Picard and GATK cleaning tools.
  
      - ReorderSam to reorder file to reference
      - AddOrReplaceReadGroups to add read group information and coordinate sort
      - PrintReads to filters to remove problem records:
      - filterMBQ to remove reads with mismatching bases and base qualities