Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to convert sam to bam with EOF marker in header

    I aligned short reads by an nonpublished aligner. Then I converted the
    alignments to sam, then bam, and sote bam. It looks they worked for
    me. But, when I intend to index and mpileup bam of multiple samples to
    call variant. I faced a problem, I got errors:

    $ samtools index maplistbam-sorted.bam
    [bam_header_read] EOF marker is absent.
    [bam_index_core] truncated file? Continue anyway. (-2)

    I did these analysis using SAMtools-0.1.6, and it is said that the
    updated verison of SAMtools can add header when converting sam to bam.
    So, now I updated SAMtools to SAMtools-0.1.12. And I want to reconvert
    my sam to bam. But, I am not sure how to do that.

    (1) Can I use this command:
    samtools view -bht my.fa.fai my.sam > my.bam

    (2) Do I need add other arguments in the command?

    (3) Please also help me to check if my sam file is a good one.

    I need your helps. Thanks in advance.

    Jian-Feng

    Following is my old bam header:
    $ samtools view -H maplistbam-sorted.bam
    [bam_header_read] EOF marker is absent.
    @SQ SN:1 LN:33132539
    @SQ SN:2 LN:19320864
    @SQ SN:3 LN:24464547
    @SQ SN - - - - - - - - - -

    My sam looks like this:
    110210010374503018 67 1 1 0 68M1D3M1I3M
    * 0 0
    TCACTTTCACTTCTGGATGCTTGTGGTTAAACACCTCACCATTCCTGTTCAACTCCTCCCCCTGTTTCGTTCCCG
    CCCCCCCCCCCCCCCACCCCCCCDC##################################################
    MD:Z:26A2T38^A3N1A1
    110211181203212143 67 1 4 0 101M *
    0 0
    CTTTCACTTCTGGATGCTTGTGGATATACACCTCACCATTCCTGTTCAACTCCTCCCCCTGTTTCAGTTCAGCAAAAGTTTAACTCTGCGGACGGCATCTA
    CCCCCCCCCCCCCCCCCCCCDCCCCCCCCCCDCCCDDBBCBCC@DCBCDDCBBCDBB>@>ABBDDBDCBBBDBBBDCBABBBACAB>>B-8A?A?CAA:BB
    MD:Z:101
    110210940527208528 137 1 5 0 101M *
    0 0
    TTTCACTTCTGGATGCTTGTGGATATACACCTCACCATTCCTGTTCAACTCCTCCCCCTGTTTCAGTTCAGCAAAAGTTTAACTCTGCGGACGGCATCTAC
    @@BBA@B=@ABBB=>@@B@B=BBBBBBBBBBBBBBBBB@BBB>@BBBBB@@@@BBB==:B<@B@@@-@@:>@@B@A@@9AABB@B:/2/?BABBA<4@/>B
    MD:Z:101
    110210850423407552 153 1 6 0 95M *
    0 0
    TGCCGTCCGCAGAGTTAAACTTTTGCTGAACTGAAACAGGGGGAGGAGTTGAACAGGAATGGTGAGGTGTATATCCACAAGCATCCAGAAGTGAA
    CCCCCCCCCCCCCCCCCCCCCCCCCCC8CCCCCCACCCCCCACA@@:CBBACCCCCCBA<CB.@>:6(9(;@@:<B@BCDBDB@D@>B@9@0@6@
    MD:Z:95
    503410211145216346 153 1 6 0 101M *
    0 0
    GGTAGATGCCGTCCGCAGAGTTAAACTTTTGCTGAACTGAAACAGGGGGAGGAGTTGAACAGGAATGGTGAGGTCTATATCCACAAGCATCCAGAAGTGAA
    <<9'<AAAAACCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCD@@@CBCCACCCCC@<CCCABBCB9CBBBBBADAB@CBBB?AB;BA5?5<>:
    MD:Z:26C74
    503410941820117468 153 1 7 0 85M *
    0 0
    CATCAATACTCTTTTGCTGAACTGAAACAGGGGGAGGAGTTGAACAGGAATGGTGAGGTGTATATCCACAAGCATCCAGAAGTGA
    CCCCCCCCCCCCCCCBCCCCCCCCCCCCC6CCCCBBB:CBCCCCCCCC?CCCC@C?BB*B+;<?

  • #2
    Code:
    [bam_header_read] EOF marker is absent.
    It is not that it adds a header, it adds an EOF marker.
    If you start from your SAM alignments and with the latest version
    of samtools you won't have problems to generate the index. Try it out.

    The command that you show to convert to bam is fine.
    -drd

    Comment


    • #3
      Thanks drio,

      It is now working in the server. I hope it works this time.

      Comment

      Latest Articles

      Collapse

      • seqadmin
        Strategies for Sequencing Challenging Samples
        by seqadmin


        Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
        03-22-2024, 06:39 AM
      • seqadmin
        Techniques and Challenges in Conservation Genomics
        by seqadmin



        The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

        Avian Conservation
        Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
        03-08-2024, 10:41 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, Yesterday, 06:37 PM
      0 responses
      10 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, Yesterday, 06:07 PM
      0 responses
      9 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 03-22-2024, 10:03 AM
      0 responses
      49 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 03-21-2024, 07:32 AM
      0 responses
      67 views
      0 likes
      Last Post seqadmin  
      Working...
      X