code: def picard_fastq_to_bam(picard, fastq_one, fastq_two, out_dir, names, order="queryname"):
      
      out_bam = os.path.join(out_dir, "%s-fastq.bam" %
                             os.path.splitext(os.path.basename(fastq_one))[0])
      if not file_exists(out_bam):
          with tx_tmpdir(picard._config) as tmp_dir:
              with file_transaction(picard._config, out_bam) as tx_out_bam:
                  opts = [("FASTQ", fastq_one),
                          ("READ_GROUP_NAME", names["rg"]),
                          ("SAMPLE_NAME", names["sample"]),
                          ("PLATFORM_UNIT", names["pu"]),
                          ("PLATFORM", names["pl"]),
                          ("TMP_DIR", tmp_dir),
                          ("OUTPUT", tx_out_bam),
                          ("SORT_ORDER", order)]
                  if fastq_two:
                      opts.append(("FASTQ2", fastq_two))
                  picard.run("FastqToSam", opts)
      return out_bam
docs: Convert fastq file(s) to BAM, adding sample, run group and platform information.