Unconfigured Ad

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

    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

                ad_right_rmr

                Collapse

                News

                Collapse

                Topics Statistics Last Post
                Started by SEQadmin2, 06-05-2026, 10:09 AM
                0 responses
                12 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 06-04-2026, 08:59 AM
                0 responses
                23 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 06-02-2026, 12:03 PM
                0 responses
                28 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 06-02-2026, 11:40 AM
                0 responses
                22 views
                0 reactions
                Last Post SEQadmin2  
                Working...