We've moved!
This site is now read-only. You can find our new documentation site and support forum for posting questions here.
Be sure to read our welcome blog!

troubles with BAM files generated by Mutect2 and FilterAlignmentArtifacts

Dear team

I am using GATK 4.1.4.0 and noticed the following : if Mutect2 is run with parameter --bam-output it makes a BAM file that contains :
@PG ID:HalpotypeBAMWriter
(note the typo)
If then FilterAlignmentArtifacts is run with this file as input and BAM output is asked, it says
java.lang.IllegalArgumentException: Program record with group id HalpotypeBAMWriter already exists in SAMFileHeader!
and does not create the file

Regards
Guy Bottu
VIB BioinformaticsCore

Issue · Github
by bhanuGandham

Issue Number
6287
State
open
Last Updated
Assignee
Array
Milestone
Array

Answers

  • bhanuGandhambhanuGandham Cambridge MAMember, Administrator, Broadie, Moderator admin

    Hi @gbottu

    1. Let me begin by saying that this is an experimental tool. Please use at your won risk. We do not recommend using this in production.
    2. Please post the exact command you used and the entire error log.
  • bhanuGandhambhanuGandham Cambridge MAMember, Administrator, Broadie, Moderator admin

    Also try to set --add-output-sam-program-record false and see if that helps.

  • gbottugbottu Member

    It did not help. The command that generated the BAM file was :smile:

    gatk Mutect2 --input normal.recalibrated.vcf --input tumor.recalibrated.vcf -normal mormal -tumor tumor --reference /data/Homo_sapiens.UCSC.hg38.fa --output tumor.recalibrated.mutect2/vcf --f1r2-tar-gz f1r2.tar.gz --native-pair-hmm-threads 4 --bam-output tumor.recalibrated.realigned.bam --add-output-sam-program-record false -bam-output

    The log of the command that generated the error was :

    Using GATK jar /data/genepattern/patches/gatk-4.1.4.0/gatk-package-4.1.4.0-local.jar
    Running:
    java -Dsamjdk.use_async_io_read_samtools=false -Dsamjdk.use_async_io_write_samtools=true -Dsamjdk.use_async_io_write_tribble=false -Dsamjdk.compression_level=2 -jar /data/genepattern/patches/gatk-4.1.4.0/gatk-package-4.1.4.0-local.jar FilterAlignmentArtifacts --variant tumor.recalibrated.filtered.vcf --input tumor.recalibrated.realigned.bam --reference /data/genepattern/users/.cache/uploads/cache/data.gp.vib.be/pub/genome/Homo_sapiens.UCSC.hg38.fa --bwa-mem-index-image /data/genepattern/users/.cache/uploads/cache/data.gp.vib.be/pub/bwa_index_img/Homo_sapiens.UCSC.hg38.img --output tumor.recalibrated.filtered2.vcf --bam-output tumor.recalibrated.realigned2.bam --verbosity ERROR --tmp-dir TMP --QUIET true
    14:38:44.077 INFO NativeLibraryLoader - Loading libgkl_utils.so from jar:file:/data/genepattern/patches/gatk-4.1.4.0/gatk-package-4.1.4.0-local.jar!/com/intel/gkl/native/libgkl_utils.so
    14:38:44.103 INFO SmithWatermanAligner - AVX accelerated SmithWaterman implementation is not supported, falling back to the Java implementation
    java.lang.IllegalArgumentException: Program record with group id HalpotypeBAMWriter already exists in SAMFileHeader!
    at htsjdk.samtools.SAMFileHeader.addProgramRecord(SAMFileHeader.java:202)
    at htsjdk.samtools.SAMTextHeaderCodec.parsePGLine(SAMTextHeaderCodec.java:158)
    at htsjdk.samtools.SAMTextHeaderCodec.decode(SAMTextHeaderCodec.java:107)
    at htsjdk.samtools.SAMFileHeader.clone(SAMFileHeader.java:398)
    at org.broadinstitute.hellbender.utils.read.ReadUtils.createCommonSAMWriterFromFactory(ReadUtils.java:1215)
    at org.broadinstitute.hellbender.utils.read.ReadUtils.createCommonSAMWriter(ReadUtils.java:1163)
    at org.broadinstitute.hellbender.utils.haplotype.SAMFileDestination.(SAMFileDestination.java:35)
    at org.broadinstitute.hellbender.utils.haplotype.HaplotypeBAMWriter.(HaplotypeBAMWriter.java:74)
    at org.broadinstitute.hellbender.tools.walkers.realignmentfilter.FilterAlignmentArtifacts.onTraversalStart(FilterAlignmentArtifacts.java:194)
    at org.broadinstitute.hellbender.engine.GATKTool.doWork(GATKTool.java:1046)
    at org.broadinstitute.hellbender.cmdline.CommandLineProgram.runTool(CommandLineProgram.java:139)
    at org.broadinstitute.hellbender.cmdline.CommandLineProgram.instanceMainPostParseArgs(CommandLineProgram.java:191)
    at org.broadinstitute.hellbender.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:210)
    at org.broadinstitute.hellbender.Main.runCommandLineProgram(Main.java:163)
    at org.broadinstitute.hellbender.Main.mainEntry(Main.java:206)
    at org.broadinstitute.hellbender.Main.main(Main.java:292)
    Process exited with an error: 1 (Exit value: 1)[[email protected] 7953]$ vi stdout.txt

    I think that there really is a bug in Mutect2 and/or in FilterAlignmentArtifacts.

  • bhanuGandhambhanuGandham Cambridge MAMember, Administrator, Broadie, Moderator admin

    Hi @gbottu

    You are right this is a bug in the code. I have created a issue ticket for this in github for our dev team. You can follow the progress on this here: https://github.com/broadinstitute/gatk/issues/6287

    In the meantime a workaround for this is to rename PG ID in bam file header which will fix problem for now.

Sign In or Register to comment.