Question: SAM to BAM conversion ERRORS
0
gravatar for amra.dhabalia
10 months ago by
amra.dhabalia • 0 wrote:

I want to convert a SAM file to BAM file. I've used SAMtools in Linux command-line for this. I am encountering the following errors:

  1. COMMAND - samtools view -bS ERR035486.sam > ERR035486.bam ERROR - [samopen] no @SQ lines in the header. [sam_read1] missing header? Abort!

In response to the above error, I used the next command. 2. COMMAND - samtools view -bT reference.fa ERR035486.sam > ERR035486.bam ERROR - [sam_header_read2] 361 sequences loaded. [sam_read1] reference 'SN:CHR_HSCHR15_4_CTG8' is recognized as '*'. Parse error at line 1: invalid CIGAR character Aborted (core dumped)

What do these errors mean? And how to resolve them?

bwa alignment samtools bam • 603 views
ADD COMMENT • link • modified 10 months ago by y.hoogstrate • 460 • written 10 months ago by amra.dhabalia • 0
1
gravatar for y.hoogstrate
10 months ago by
y.hoogstrate • 460
Netherlands
y.hoogstrate • 460 wrote:

SAM consists of 2 parts:

  • the header (describing which reference genome with corresponding sequences was used as reference and which aligner was used)
  • the body (alignment relative to the sequences in the header)

you seem to have a SAM file that only contains part 2: the body. I don't know where you got your sam file from, but if you are able to regenerate it from a BAM file, use -h to include the header.

samtools view -h original.bam > ERR....sam

edit: you also seem to get this error: Parse error at line 1: invalid CIGAR character Aborted (core dumped)

I think you need to open the first line(s) of your sam file in a text editor because this seems to be corrupt data?

ADD COMMENT • link modified 10 months ago • written 10 months ago by y.hoogstrate • 460
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 16.09
Traffic: 172 users visited in the last hour