…or which one of those bowtie arguments is the input sequence data file anyway…
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 :

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
1 answer
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.
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
Log in to answer this question.
the message is about a tab, not about a newline.
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.
Thank you for your help:D! It turns out that the '@' character brings the problem~