Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • rachmani
    Junior Member
    • Aug 2010
    • 2

    Parsing error in BAM header

    Hi~ I am pretty new to this area, having a hard time with these huge files..

    I wanted to use IndelGenotyperV2 (from GATK) with my newly built BAM files. When I executed the command I found an error like below..

    java.lang.RuntimeException: net.sf.samtools.SAMFormatException: Error parsing SAM header. Problem parsing @PG key:value pair.

    And the @PG line is like below:

    @PG ID:illumina_export2sam.pl VN:2.0.0 CL:/opt/GOAT/CASAVA_1.7.0a6/bin/illumina_export2sam.pl --read1=s_7_1_export.txt --read2=s_7_2_export.txt

    I don't figure out what the problem is here.. There are all three tags (ID, VN, and CL).

    One hint is that I can find a warning when I check the header part with samtools (samtools view myfile.bam -H) like below:

    The tag '--' present (at least) twice on line [@PG ID:illumina_export2sam.pl VN:2.0.0 CL:/opt/GOAT/CASAVA_1.7.0a6/bin/illumina_export2sam.pl --read1=s_7_1_export.txt --read2=s_7_2_export.txt]

    Is this a cause of this error? or there's any other problem in my file?

    Thanks,
  • zee
    NGS specialist
    • Apr 2008
    • 249

    #2
    I would recommend that you "reheader" your sam file with "samtools reheader" if you would like to try and isolate the cause of this problem.
    Basically use "samtools view -H file.bam > header.txt". Edit header.txt and perhaps remove the "--" from all your header lines, then use "samtools reheader" with your new header file and the bam file.

    Comment

    • jmarshall
      Samtools maintainer
      • Jul 2009
      • 39

      #3
      The hint from samtools view is telling you that '--' is being interpreted as a tag, which means that it is immediately following a tab character each time it appears.

      SAM header fields are delimited by tabs, so header field values of course cannot themselves contain tabs. Your CL: value has the words of the command line separated by tabs rather than spaces, leading to parsing confusion.

      If illumina_export2sam.pl is generating this CL: value with tabs inside it, then that is a bug in illumina_export2sam.pl -- it should be replacing tabs with spaces (or doing something similar) to ensure that it is outputting a valid SAM header.

      You may be able to reheader your BAM file so as to replace these spurious tabs with spaces yourself. Or when you produce the SAM file it would be easy to replace them with sed or a text editor. Or it should be easy to fix illumina_export2sam.pl yourself if it is a Perl script -- just search for /@PG/ and/or /CL:/ which most likely appear exactly once in the script.

      Comment

      • rachmani
        Junior Member
        • Aug 2010
        • 2

        #4
        Thank you zee and jmarshall.
        As in your postings, I extracted original headers from my BAM files using "samtools view -H myfile.bam > output.file". And using picard "ReplaceSamHeader", I successfully replaced the modified header.

        So, now the IndelGenotyperV2 does not arise an error message about bam headers.
        Now it is complaining about memory.. haha (althogh I gave 2g to him)

        Thank you both anyway

        Comment

        • disciple
          Junior Member
          • Mar 2011
          • 3

          #5
          Originally posted by zee View Post
          I would recommend that you "reheader" your sam file with "samtools reheader" if you would like to try and isolate the cause of this problem.
          Basically use "samtools view -H file.bam > header.txt". Edit header.txt and perhaps remove the "--" from all your header lines, then use "samtools reheader" with your new header file and the bam file.
          I also have a problem of the BAM file header
          "Error parsing SAM header. Problem parsing @PG key:value pair. Line:
          @PG TopHat VN:1.0.13"
          when i use "samtools view -H file.bam > header.txt" and Edit header.txt then use "samtools reheader" ,it comes out gibberish.how to use the "samtools reheader "??

          Comment

          Latest Articles

          Collapse

          • GATTACAT
            Reply to Nine Things a Sample Prep Scientist Thinks About Before Sequencing
            by GATTACAT
            Love this - good data definitely starts from good input, and poor input can only give relatively poor data. I particularly like the mention of Nanodrop/absorbance based methods for quantification. It's such a toss up if you'll get an accurate reading or what amounts to a randomly generated number, and a lot of library/sequencing related issues can be traced back to poor quant.
            07-01-2026, 11:43 AM
          • SEQadmin2
            Nine Things a Sample Prep Scientist Thinks About Before Sequencing
            by SEQadmin2


            I’m not a sequencing expert. I’m a purification scientist who uses NGS to evaluate workflows my group develops. With this perspective, we think about the sample first and the NGS workflow second. The sequencer is an exceptionally honest reporter, but it can only report on what you give it, so whether you get clean, interpretable data from an NGS workflow is largely determined before you begin.

            Here are nine questions we think about, in roughly the order they matter, before...
            06-18-2026, 07:11 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, Today, 11:05 AM
          0 responses
          6 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-02-2026, 11:08 AM
          0 responses
          27 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 06-30-2026, 05:37 AM
          0 responses
          25 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 06-26-2026, 11:10 AM
          0 responses
          25 views
          0 reactions
          Last Post SEQadmin2  
          Working...