Question: SAM to BAM conversion error
0
gravatar for jitendoshi2006
24 months ago by
jitendoshi20060 wrote:

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.

bam bwa samtools alignment genome • 1.1k views
ADD COMMENTlink modified 24 months ago by Pierre Lindenbaum119k • written 24 months ago by jitendoshi20060

Which version of samtools are you using?

ADD REPLYlink written 24 months ago by genomax65k

samtools version 1.2

ADD REPLYlink written 24 months ago by jitendoshi20060

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

ADD REPLYlink written 9 months ago by swbarnes25.2k
0
gravatar for Pierre Lindenbaum
24 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum119k wrote:

try

samtools view -Sb  -o BAM_output.bam SAM_output.sam
ADD COMMENTlink written 24 months ago by Pierre Lindenbaum119k

Doesn't work. Gives the same error

ADD REPLYlink written 24 months ago by jitendoshi20060

what is the output of

head SAM_output.sam
ADD REPLYlink modified 24 months ago • written 24 months ago by Pierre Lindenbaum119k

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 REPLYlink written 24 months ago by jitendoshi20060

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 REPLYlink modified 24 months ago • written 24 months ago by genomax65k

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 REPLYlink written 24 months ago by jitendoshi20060

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 REPLYlink modified 24 months ago • written 24 months ago by genomax65k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 910 users visited in the last hour