ERROR:SAM to BAM using samtools
1
0
Entering edit mode
4.4 years ago
Yi Chu • 0

I tried to convert the SAM file generated by Bowtie(1.2.3) to BAM file with samtools(1.9), but I met the following warnings and errors:

[W::sam_hdr_sanitise] Missing trailing newline on SAM header. Possibly truncated
[E::sam_hdr_error] Missing tab at line 32: "@HISEQ:154:CB8RGANXX:1:2101:1470:1000    16    Fvb7    20495637    255    16M    *    0    0    GTTGTGCTACAGCGGN    IIIIIIIIIIIIIIII    XA:i:1    MD:Z:15A0    NM:i:1    XM:i:3" 
[main_samview] failed to write the SAM header

but when I use cat -A to check the newline in my sam file, it looks normal that a $ character appears at every line end. Here is the header region of my sam file : enter image description here

I think there maybe some problems with my sam file. The commands I used are as below:

bowtie-build -f ref.fasta index 
bowtie -f -v 1 -p 8 -S -a -m 50 --best --strata index s3-7-6-hua-2_clean.fa s3-7-6-hua_clean.sam --sam-RG ID:s3-7-6-hua-2_clean
samtools view -bS s3-7-6-hua_clean.sam  >s3-7-6-hua_clean.bam

Appreciated for any help!QAQ

alignment software error • 2.4k views
ADD COMMENT
0
Entering edit mode

"Missing tab at line 32"

but when I use cat -A to check the newline in my sam file, it looks normal that

the message is about a tab, not about a newline.

ADD REPLY
0
Entering edit mode

did you use any tab instead of spaces in the command "bowtie -f -v 1 -p 8 -S -a -m 50 --best --strata index s3-7-6-hua-2_clean.fa s3-7-6-hua_clean.sam --sam-RG ID:s3-7-6-hua-2_clean" , it could mess the @PG line in the header.

ADD REPLY
0
Entering edit mode

Thank you for your help:D! It turns out that the '@' character brings the problem~

ADD REPLY
3
Entering edit mode
4.4 years ago

Your read names @HISEQ:154:etc look like SAM headers, so your SAM file is not usable. Read names in SAM files are not allowed to start with @ characters.

So either your FASTQ file somehow has two @@ characters at the start of its header lines, or your bowtie mapping pipeline is somehow leaving the @ FASTQ header character in as part of the read names.

ADD COMMENT
0
Entering edit mode

…or which one of those bowtie arguments is the input sequence data file anyway…

ADD REPLY
0
Entering edit mode

It is the @ character in the read names that leads to the error message. I modify my fasta file and then samtools works fine. Thank you so much :D

ADD REPLY

Login before adding your answer.

Traffic: 2619 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