code: def _count_files_to_amber(tumor_counts, normal_counts, work_dir, data):
      
      amber_dir = utils.safe_makedir(os.path.join(work_dir, "amber"))
      out_file = os.path.join(amber_dir, "%s.amber.baf" % dd.get_sample_name(data))
  
      if not utils.file_uptodate(out_file, tumor_counts):
          with file_transaction(data, out_file) as tx_out_file:
              with open(tumor_counts) as tumor_handle:
                  with open(normal_counts) as normal_handle:
                      with open(tx_out_file, "w") as out_handle:
                          writer = csv.writer(out_handle, delimiter="\t")
                          writer.writerow(["Chromosome", "Position", "TumorBAF", "TumorModifiedBAF", "TumorDepth",
                                           "NormalBAF", "NormalModifiedBAF", "NormalDepth"])
                          header = None
                          for t, n in zip(tumor_handle, normal_handle):
                              if header is None and t.startswith("CONTIG"):
                                  header = t.strip().split()
                              elif header is not None:
                                  t_vals = dict(zip(header, t.strip().split()))
                                  n_vals = dict(zip(header, n.strip().split()))
                                  amber_line = _counts_to_amber(t_vals, n_vals)
                                  if amber_line:
                                      writer.writerow(amber_line)
      return out_file
docs: Converts tumor and normal counts from GATK CollectAllelicCounts into Amber format.