code: def prep_bam_inputs(out_dir, sample, call_file, bam_file):
      
      base = utils.splitext_plus(os.path.basename(bam_file))[0]
      with open(call_file) as in_handle:
          for cur_hla in (x.strip() for x in in_handle):
              out_file = os.path.join(utils.safe_makedir(os.path.join(out_dir, base)),
                                      "%s.type.%s.filtered.bam" % (base, cur_hla))
              if not os.path.exists(out_file):
                  cmd = ["samtools", "view", "-b","-o", out_file, bam_file, cur_hla]
                  subprocess.check_call(cmd)
docs: Prepare expected input BAM files from pre-aligned.