code: def _produce_compatible_vcf(out_file, data, is_somatic):
      
      base, ext = utils.splitext_plus(out_file)
      legacy_file = "%s.legacy%s" % (base, ext)
      if is_somatic:
          legacy_file = _covert_to_diploid(legacy_file, data)
      final_file = "%s.vcf.gz" % base
      cat_cmd = "zcat" if legacy_file.endswith(".gz") else "cat"
      contig_cl = vcfutils.add_contig_to_header_cl(dd.get_ref_file(data), out_file)
      remove_problem_alleles = r"sed 's/,\*\([A-Z]\)/,\1/'"
      cmd = ("{cat_cmd} {legacy_file} | sed 's/fileformat=VCFv4.3/fileformat=VCFv4.2/' | "
             "{remove_problem_alleles} | {contig_cl} | bgzip -c > {final_file}")
      do.run(cmd.format(**locals()), "Produce compatible VCF output file from octopus")
      return vcfutils.bgzip_and_index(out_file, data["config"])
docs: Create a compatible VCF that downstream tools can deal with.
  
      - htsjdk and thus GATK and Picard do not support VCF4.3:
        https://github.com/broadinstitute/gatk/issues/2092
      - Use octopus legacy format to avoid incompatibilities.
        https://github.com/luntergroup/octopus#output-format
      - Fixes `##contig` lines since octopus only writes contigs
        used in the BED file region, causing incompatibilies with
        GatherVcfs when merging
      - Fixes alleles prefixed with '*' like 'C,*T' which cause
        downstream failures when reading with GATK.