Header Leaderboard Ad

Collapse

how to convert sam to bam with EOF marker in header

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
    [email protected]>@>ABBDDBDCBBBDBBBDCBABBBACAB>>B-8A?A?CAA:BB
    MD:Z:101
    110210940527208528 137 1 5 0 101M *
    0 0
    TTTCACTTCTGGATGCTTGTGGATATACACCTCACCATTCCTGTTCAACTCCTCCCCCTGTTTCAGTTCAGCAAAAGTTTAACTCTGCGGACGGCATCTAC
    @@[email protected][email protected]=>@@[email protected][email protected]>@[email protected]@@@BBB==:B<@[email protected]@@[email protected]@:>@@[email protected]@@[email protected]:/2/?BABBA<[email protected]/>B
    MD:Z:101
    110210850423407552 153 1 6 0 95M *
    0 0
    TGCCGTCCGCAGAGTTAAACTTTTGCTGAACTGAAACAGGGGGAGGAGTTGAACAGGAATGGTGAGGTGTATATCCACAAGCATCCAGAAGTGAA
    [email protected]@:CBBACCCCCCBA<[email protected]>:6(9(;@@:<[email protected]@[email protected]>[email protected]@[email protected]@
    MD:Z:95
    503410211145216346 153 1 6 0 101M *
    0 0
    GGTAGATGCCGTCCGCAGAGTTAAACTTTTGCTGAACTGAAACAGGGGGAGGAGTTGAACAGGAATGGTGAGGTCTATATCCACAAGCATCCAGAAGTGAA
    <<9'<[email protected]@@[email protected]<[email protected]?AB;BA5?5<>:
    MD:Z:26C74
    503410941820117468 153 1 7 0 85M *
    0 0
    CATCAATACTCTTTTGCTGAACTGAAACAGGGGGAGGAGTTGAACAGGAATGGTGAGGTGTATATCCACAAGCATCCAGAAGTGA
    CCCCCCCCCCCCCCCBCCCCCCCCCCCCC6CCCCBBB:[email protected]?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

      Working...
      X