Error when sorting a SAM file with samtools sort, sam file created with bwa mem
1
0
Entering edit mode
7.5 years ago
mpyle • 0

Hi, I created a .sam file using bwa mem, but when I try to sort the file using samtools sort I get this error:

[W::sam_read1] parse error at line 1
[bam_sort_core] truncated file. Aborting.

There is probably something worng with the header but I am not sure what. This is the first few lines of the sam file:

[M::bwa_idx_load_from_disk] read 0 ALT contigs
[M::process] read 100378 sequences (10000099 bp)...
[M::process] read 100394 sequences (10000125 bp)...
[M::mem_pestat] # candidate unique pairs for (FF, FR, RF, RR): (5, 34952, 9, 3)
[M::mem_pestat] skip orientation FF as there are not enough pairs
[M::mem_pestat] analyzing insert size distribution for orientation FR...
[M::mem_pestat] (25, 50, 75) percentile: (175, 212, 292)
[M::mem_pestat] low and high boundaries for computing mean and std.dev: (1, 526)
[M::mem_pestat] mean and std.dev: (235.46, 84.91)
[M::mem_pestat] low and high boundaries for proper pairs: (1, 643)
[M::mem_pestat] skip orientation RF as there are not enough pairs
[M::mem_pestat] skip orientation RR as there are not enough pairs
[M::mem_process_seqs] Processed 100378 reads in 43.264 CPU sec, 43.255 real sec
@SQ     SN:2L   LN:23513712
@SQ     SN:2R   LN:25286936
@SQ     SN:3L   LN:28110227

Please let me know if you see what the problem is so I can get past this. Thank you.

alignment sequence next-gen software error • 2.5k views
ADD COMMENT
0
Entering edit mode
7.5 years ago

When you redirected the output of bwa mem, you redirected stderr to the same file as stdout. You want something like:

bwa mem ...stuff... > file.sam

Do not use 2>&1 anywhere, which appears to be what you did.

ADD COMMENT
0
Entering edit mode

I ran the bwa command as a job and so I never specified > file.sam at the end of the command because the sam file ends up just telling you the job number, this is the command I used:

sqsub -q serial -o aligned/drosophila2.sam -r 6h --mpp=16g bwa mem ref/drosophila_melanogaster_genome.fna reads/SRR3931619_1_val_1.fq.gz reads/SRR3931619_2_val_2.fq.gz

Instead I had to specify the output at the beginning

ADD REPLY
0
Entering edit mode

Perhaps you need a -e aligned/drosophila2.txtoption too. Either way, it's the fact that stderr is getting sent to stdout that's causing your problem.

ADD REPLY

Login before adding your answer.

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