Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ksw9
    Member
    • May 2013
    • 32

    #1

    Faulty BAM files

    Hi,
    I am having trouble with BAM file manipulation. Using samtools version: 0.1.19+ , I get the following error messages when trying to index a sorted BAM file:

    [bam_index_core] read 'HWI-ST1144:470:H88C0ADXX:1:1101:15534:7325' mapped to 'gi|11497060|ref|NC_000948.1|' at POS 0 to -1 has BIN 4680 but should be 266824
    [bam_index_core] Fix it by using BAM->SAM->BAM to force a recalculation of the BIN field
    [bam_index_build2] fail to index the BAM file.

    I have tried to convert to BAM->SAM->BAM with:
    samtools view -h Sample_Bbcap9_005_004.sort.bam | samtools view -hbS - > test.bam

    But this does not solve the problem and I continue to get the same erros.

    I also tried using an earlier version of Samtools, samtools-0.1.8, and though this allowed me to index the BAM file, I ran into errors when I tried to do any follow-up analysis

    bedtools intersect -abam test.bam -b $BED ?

    Error: Invalid record in file test.sort.bam. Record is
    gi|11497060|ref|NC_000948.1| -1 75 HWI-ST1144:470:H88C0ADXX:1:2202:10057:82693/2 37 +

    Please let me know if I am doing something obviously wrong, any help is much appreciated!
    Best,
  • Brian Bushnell
    Super Moderator
    • Jan 2014
    • 2709

    #2
    It would help if you could grep the sam file for the line containing HWI-ST1144:470:H88C0ADXX:1:1101:15534:7325 so we can see what it looks like. The error messages are not printing out the original line. 0.1.19 is not the latest samtools; some of them around that version were incompatible with the SAM 1.4 spec and produced strange errors like that because they parsed the cigar string improperly. I suggest using the latest version, which is at least 0.1.20. Or, it could be that the read was mapped to position 0, which is not allowed.

    Actually, it looks like 1.0 is out now, though I have not tried it.
    Last edited by Brian Bushnell; 09-11-2014, 08:46 AM.

    Comment

    • Richard Finney
      Senior Member
      • Feb 2009
      • 701

      #3
      What is ... "samtools version: 0.1.19+ " ???

      Can you run "samtools" and tell us the version string.

      Those messages don't appear to to be part of 0.1.19 or the new 1.0.

      Comment

      • ksw9
        Member
        • May 2013
        • 32

        #4
        I will try this with version 1.0. I had been using samtools-0.1.19. When I looked at the sam file, these reads are posing the problem:

        HWI-ST1144:470:H88C0ADXX:1:1101:15534:7325 73 gi|11497060|ref|NC_000948.1| 0 37 76M = 0 0 TCTATACTATTAATATCTGTAGTATTTTTACTACGTAAGTATAATCAGTTCTTAAATCCATAGGGCTTTACTAAGT CCCFFFFFHHHHHJJJJJJJJJHIGJJJJIJIJIJHIJJFHIJJJJJJJJIJJJIJJJJJJJIJJJJIJIJJJJJI XT:A:U NM:i:0 SM:i:37 AM:i:0 X0:i:1 X1:i:0 XM:i:3 XO:i:0 XG:i:0 MD:Z:0
        HWI-ST1144:470:H88C0ADXX:1:1101:15534:7325 133 gi|11497060|ref|NC_000948.1| 0 0 * = 0 0 GTATTGAATTTTTTCTTATATATAAATATATAGCAAAAACTATTTTTGCCAACTTTTTTACAAAAAATTTTTTATT @B@FFFFFHHHHHJJJJJJJJJJJIJJIJJIJIJJJJJJIJJJJJJJIJJIJJJJJJJJJIJJJJJHFFFFFDDDC

        Comment

        • ksw9
          Member
          • May 2013
          • 32

          #5
          I still get the same error when using Samtools version 1.0. Does this mean the BAM file is corrupted?

          Comment

          • Brian Bushnell
            Super Moderator
            • Jan 2014
            • 2709

            #6
            The problem is the sam file, in which the 'pos' field (4th field) is '0'. That's not allowed by samtools - it breaks if reads mapping off the ends of contigs are not clipped.

            What aligner did you use, or where did you get the sam file?

            Comment

            • ksw9
              Member
              • May 2013
              • 32

              #7
              I used bwa-0.7.7. I am trying to remap the reads against the reference, this time doing all sorting with Samtools version 1.0. Is it possible that if I sorted once with an old version of Samtools and once with a newer version, this caused the problem?
              Thank you for all of your help!

              Comment

              • Brian Bushnell
                Super Moderator
                • Jan 2014
                • 2709

                #8
                It's possible; any piece of software can have unexpected bugs. If you encounter the same problem again, you should either remove that read pair from the input dataset, or use a different aligner (or aligner version).

                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, 09-25-2026, 09:06 AM
                0 responses
                30 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 09-23-2026, 11:05 AM
                0 responses
                25 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 09-18-2026, 11:37 AM
                1 response
                46 views
                0 reactions
                Last Post pekgio
                by pekgio
                 
                Started by SEQadmin2, 09-16-2026, 10:23 AM
                1 response
                55 views
                0 reactions
                Last Post pekgio
                by pekgio
                 
                Working...