Unconfigured Ad

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

    #1

    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

          • SEQadmin2
            New Genomics Technologies Take Aim at Long-Standing Limits
            by SEQadmin2


            Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

            We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
            ...
            Yesterday, 10:25 AM
          • SEQadmin2
            How Immunogenomics Decodes Immunity’s Genetic Blueprint
            by SEQadmin2




            The immune system’s power comes from its genetic diversity, allowing myriad threats to be neutralized through first recognizing foreign antigens. That diversity is also what makes the immune system so difficult to study. Recent advances in sequencing technology and computational biology, however, are giving researchers new tools to understand immune responses and immune-related diseases in greater detail.

            This convergence of genetics, immunology, and computation...
            09-01-2026, 05:41 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, Today, 09:51 AM
          0 responses
          10 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 09-25-2026, 09:06 AM
          0 responses
          32 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 09-23-2026, 11:05 AM
          0 responses
          27 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 09-18-2026, 11:37 AM
          1 response
          48 views
          0 reactions
          Last Post pekgio
          by pekgio
           
          Working...