Actually, when i try to convert the sam file to a bam file, i still get the same error.
I recently tried to use bowtie2 and samtools to process some paired end data. I used bowtie2-build to index my reference genome, and used this index to align the paired end data. Once the alignment was over, i got the following on my STDOUT:
7659592 reads; of these:
7659592 (100.00%) were paired; of these:
136410 (1.78%) aligned concordantly 0 times
6927190 (90.44%) aligned concordantly exactly 1 time
595992 (7.78%) aligned concordantly >1 times
98.22% overall alignment rate
With this message, i assumed that the alignment is complete. I had used the -S option to obtain sam output file. So i tried to use samtools to sort and index the output file, but every time i get EOF not found error.
Please advise. Sameet
2 answers
samtools sort works on .bam files, not .sam files, that might be your problem.
Have you used the -S flag on samtools, too? You have to tell samtools that you are using sam-files, too, like this:
samtools view -S bla.sam
or
samtools view -Sb in.sam out to convert to a bam-file called out.bam
Hi, thanks for the post. I figured it out. Its correct, the samtools requires a bam file!! I managed to get what i wanted. Thank you all for your help.
If your sam file has no SQ header you'll need to create a reference index in samtools first with: samtools faidx <refgenome.fa>
Log in to answer this question.