Question: sam to bam conversion
0
gravatar for sukesh1411
2.2 years ago by
sukesh141130
South Africa
sukesh141130 wrote:

Hi

I could extract the unmapped reads from the bwa-mem alignment file in SAM format using below command

samtools view -S -f0x4 alnIRGSP.sam > UNMAP.sam.

After that i could not convert this sam file to bam file . I get the below error.

[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).
[main_samview] fail to read the header from "sortUNMAP.sam".

Can anyone help me to solve this..

samtools • 1.2k views
ADD COMMENTlink modified 2.2 years ago • written 2.2 years ago by sukesh141130
1

This is a question, not a tool. Please use the 'post type' accordingly.

ADD REPLYlink written 2.2 years ago by WouterDeCoster32k
1

Try -f 4.

ADD REPLYlink written 2.2 years ago by Devon Ryan85k
1

You should concat the sam file you generated to the header

ADD REPLYlink written 2.2 years ago by Asaf4.9k
4
gravatar for Carlo Yague
2.2 years ago by
Carlo Yague4.3k
Belgium
Carlo Yague4.3k wrote:

use -h (include header) :

samtools view -h -f 4 -S alnIRGSP.sam > UNMAP.sam

u can also output bam directly with -b:

samtools view -h -b -f 4 -S alnIRGSP.sam > UNMAP.bam
ADD COMMENTlink modified 2.2 years ago • written 2.2 years ago by Carlo Yague4.3k
0
gravatar for Charles Plessy
2.2 years ago by
Charles Plessy2.5k
Japan
Charles Plessy2.5k wrote:

The error message indicates that the program you use expects data in the BAM (binary) format. However, you are using a SAM (text) file as input. The program reads it as if it were a BAM file, and stops when it detects that it can not find the BAM binary header. Use the -b option of samtools for outputting in BAM format.

ADD COMMENTlink modified 2.2 years ago • written 2.2 years ago by Charles Plessy2.5k
0
gravatar for sukesh1411
2.2 years ago by
sukesh141130
South Africa
sukesh141130 wrote:

Thank you all of you.. It worked fine.

ADD COMMENTlink written 2.2 years ago by sukesh141130
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1282 users visited in the last hour