This is a test version of Biostars. For the public version, visit https://www.biostars.org.
SAM to BAM conversion error

I am trying to convert SAM file to BAM file after genome alignment using bwa-mem on a cluster. I perform genome alignment on a cluster as well. The SAM file generated from bowtie2 works fine and I do not get error but there is problem when I use bwa-mem. I use following command to align my single end reads using bwa-mem

bwa mem –k 10 –v 3 bwa_index filtered_reads.fastq > SAM_output.sam

I run the following command for conversion of SAM to BAM file:

samtools view -b SAM_output.sam -o BAM_output.bam

It shows following error

[W::sam_read1] parse error at line 1
[main_samview] truncated file

I checked some answers from the similar questions but even then I was unable to solve the problem. Any help would be great.

bwa genome alignment samtools bam

Which version of samtools are you using?

Shouldn't that bwa mem command line have a bit about where the reference genome is?

1 answer

try

samtools view -Sb  -o BAM_output.bam SAM_output.sam

there is no output. when i run the command, following occurs Job <41483116> is submitted to queue <normal.4h>

when i check for job status bbjobs No jobs found for user_a

there is no output file generated in the directory

That means you don't have a file called SAM_output.sam in the directory where you ran the command. Is that file located somewhere else?

the file is in the directory where i ran the command, i am sure about it. i just checked the size of the file SAM_output.sam, and it is just 50bytes so i guess there isnt anything inside the file. i do not think that is the size i expect. it should be a huge file. however, when i ran the genome alignment command earlier, the command ran for quite a while after which it generated SAM_output.sam, which is interesting. maybe my genome alignment command/tool has some issue.

I was going to ask if your alignment had worked right and it looks like it has not. So you need to go back and investigate that first.

Log in to answer this question.