SAM to BAM conversion error
1
0
Entering edit mode
7.1 years ago

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 • 2.6k views
ADD COMMENT
0
Entering edit mode

Which version of samtools are you using?

ADD REPLY
0
Entering edit mode

samtools version 1.2

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode
7.1 years ago

try

samtools view -Sb  -o BAM_output.bam SAM_output.sam
ADD COMMENT
0
Entering edit mode

Doesn't work. Gives the same error

ADD REPLY
0
Entering edit mode

what is the output of

head SAM_output.sam
ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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?

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

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