Question: [main_samview] fail to read the header from sample.bam
0
gravatar for sambioinfo2018
14 months ago by
sambioinfo20180 wrote:

Hi all, I get the following error when reading the sample.bam. The file was converted from sam to bam using the following command:

 samtools view -bS sample.sam > sample.bam.

[E::bgzf_read] bgzf_read_block error -1 after 194938 of 8572040 bytes
[E::bam_hdr_read] error reading BGZF stream
[main_samview] fail to read the header from sample.bam

Looking forward to get your suggestion.

thanks in advance

sam

alignment • 1.0k views
ADD COMMENTlink modified 14 months ago by genomax67k • written 14 months ago by sambioinfo20180

Does your sam file have a valid header? If yes, then have you tried reconverting the file? Perhaps something happened to corrupt the file first time around.

ADD REPLYlink written 14 months ago by genomax67k

Yes, a valid header is present in sam file. I could not understand about reconverting?

ADD REPLYlink written 14 months ago by sambioinfo20180

What is the output of:

samtools view -H sample.sam
samtools quickcheck -v sample.sam
ADD REPLYlink modified 14 months ago • written 14 months ago by ATpoint16k

while running samtools view -H sample.sam, it result is following: [main_samview] fail to read the header from sample.sam

ADD REPLYlink written 14 months ago by sambioinfo20180

That is your problem then. With what program was the sam file generated?

ADD REPLYlink modified 14 months ago • written 14 months ago by genomax67k

When i looked the same file with head command i could see the first 10 header lines. However with the above command its showed as failed to read. I have rerun the alignment once again. And now its reading the sam file. Thanks!! Shall convert to bam file now.

ADD REPLYlink written 14 months ago by sambioinfo20180

i have also tried converting using samtools view -h -b sample.sam > sample.bam

ADD REPLYlink written 14 months ago by sambioinfo20180
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: 926 users visited in the last hour