Question: [main_samview] fail to read the header from sample.bam
0
gravatar for sambioinfo2018
2.1 years 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 • 2.3k views
ADD COMMENTlink modified 2.1 years ago by genomax80k • written 2.1 years 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 2.1 years ago by genomax80k

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

ADD REPLYlink written 2.1 years ago by sambioinfo20180

What is the output of:

samtools view -H sample.sam
samtools quickcheck -v sample.sam
ADD REPLYlink modified 2.1 years ago • written 2.1 years ago by ATpoint32k

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

ADD REPLYlink written 2.1 years ago by sambioinfo20180

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

ADD REPLYlink modified 2.1 years ago • written 2.1 years ago by genomax80k

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 2.1 years ago by sambioinfo20180

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

ADD REPLYlink written 2.1 years 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: 1970 users visited in the last hour