Samtools - [main_samview] fail to read the header
1
0
Entering edit mode
3.2 years ago
kstangline ▴ 80

Hi everyone,

I'm attempting to convert a SAM file to a BAM file using the following command:

samtools view -S -b test.sam > test.bam

However, I'm getting the error [main_samview] fail to read the header (see figure). The figure attached shows the error I'm getting on the top and the contents of the beginning of the SAM file on the bottom. Has anyone seen this before? Is there a simple fix? I'm still new to computational biology, so I'd appreciate any help I can get.

samtools view error

bam samtools • 2.8k views
ADD COMMENT
0
Entering edit mode

What is the samtools/htslib version you're using? What is the output to samtools view -H filename.sam? Also, please do not paste screenshots of plain text content, it is counterproductive. You can copy paste the content directly here (using the code formatting option shown below), or use a GitHub Gist if the content volume exceeds allowed length here.

code_formatting

ADD REPLY
0
Entering edit mode

Hello,

I'm using samtools 1.13, htslib 1.13.

This is what I'm getting from samtools view -H:

samtools view -H test.sam

[main_samview] fail to read the header from "test.sam".
ADD REPLY
1
Entering edit mode
3.2 years ago

The simplest explanation is that your sam has no header. How was it made? If you converted from a bam, you need to include -h to make sure the header isn't omitted.

ADD COMMENT

Login before adding your answer.

Traffic: 1973 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6