Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • kjaja
    Member
    • Aug 2011
    • 58

    problem indexing a bam file

    I need to slice my bam file to look at the reads in a small region using IGV. I used samtools version 0.1.18 to do that but I am having problem indexing the .bam file, here is what I did

    samtools view myfile.bam chr2:20,100,000-20,200,000 > outfile.bam
    samtools index outfile.bam

    I am getting the following error message

    [bam_header_read] EOF marker is absent. The input is probably truncated.
    [bam_header_read] invalid BAM binary header (this is not a BAM file).
    Segmentation fault (core dumped)

    Any ideas?
  • swbarnes2
    Senior Member
    • May 2008
    • 910

    #2
    Originally posted by kjaja View Post
    I need to slice my bam file to look at the reads in a small region using IGV. I used samtools version 0.1.18 to do that but I am having problem indexing the .bam file, here is what I did

    samtools view myfile.bam chr2:20,100,000-20,200,000 > outfile.bam
    samtools index outfile.bam

    I am getting the following error message

    [bam_header_read] EOF marker is absent. The input is probably truncated.
    [bam_header_read] invalid BAM binary header (this is not a BAM file).
    Segmentation fault (core dumped)

    Any ideas?
    You didn't make a .bam file. You made a .sam file. Look at it, it's plain txt.

    Code:
    samtools view [B]-b[/B] myfile.bam chr2:20,100,000-20,200,000 > outfile.bam
    samtools index outfile.bam
    You have to add in the -b option to make the output .bam. Default behavior for samtools view is to make a .sam file.

    Comment

    Latest Articles

    Collapse

    ad_right_rmr

    Collapse

    News

    Collapse

    Topics Statistics Last Post
    Started by SEQadmin2, 06-09-2026, 11:58 AM
    0 responses
    30 views
    0 reactions
    Last Post SEQadmin2  
    Started by SEQadmin2, 06-05-2026, 10:09 AM
    0 responses
    38 views
    0 reactions
    Last Post SEQadmin2  
    Started by SEQadmin2, 06-04-2026, 08:59 AM
    0 responses
    42 views
    0 reactions
    Last Post SEQadmin2  
    Started by SEQadmin2, 06-02-2026, 12:03 PM
    0 responses
    64 views
    0 reactions
    Last Post SEQadmin2  
    Working...