Question: sam file error
0
gravatar for 2yuna710
2.6 years ago by
2yuna71010
2yuna71010 wrote:

After sequences mapping, I got Sam format files. So, I wanted to sort the files by samtools. But I got some error messages as below.

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

I opened the Sam files, and they may be error as below.

The lines like [M::mem_pestat] skip orientation FF as there are not enough pairs are also in between of Sam file.

I don't know how to fix them. Please help me!!

$ head -n 20 KPGP-00145_L1.sam
[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: (461, 468, 475)
[M::mem_pestat] low and high boundaries for computing mean and std.dev: (433, 503)
[M::mem_pestat] mean and std.dev: (467.88, 10.86)
[M::mem_pestat] low and high boundaries for proper pairs: (419, 517)
[M::mem_pestat] analyzing insert size distribution for orientation RF...
[M::mem_pestat] (25, 50, 75) percentile: (528, 1240, 2853)
[M::mem_pestat] low and high boundaries for computing mean and std.dev: (1, 7503)
[M::mem_pestat] mean and std.dev: (1599.90, 1413.75)
[M::mem_pestat] low and high boundaries for proper pairs: (1, 9828)
[M::mem_pestat] skip orientation RR as there are not enough pairs
[M::mem_pestat] skip orientation RF
@SQ SN:1            LN:249250621
@SQ SN:2    LN:243199373
@SQ SN:3    LN:198022430
@SQ SN:4    LN:191154276
@SQ SN:5    LN:180915260
@SQ SN:6    LN:171115067
@SQ SN:7    LN:159138663
sequence genome • 1.3k views
ADD COMMENTlink modified 2.6 years ago by Michael Dondrup46k • written 2.6 years ago by 2yuna71010
3

Hello,

what was the exact command for producing your sam file?

The lines with [M::mem_pestat] looks like info messages from bwa. But they should not appear in the sam file.

fin swimmer

ADD REPLYlink modified 2.6 years ago • written 2.6 years ago by finswimmer12k
1

I moved this to a comment because it's not an answer to the thread (although definitely helpful suggestion and follow-up question).

ADD REPLYlink written 2.6 years ago by WouterDeCoster41k
2

well this case some time occurs when you run your alignment command with "nohup". Try running without nohup option.

Try this might help you.

ADD REPLYlink written 2.6 years ago by mks002190

When I ran without nohup option, it worked normally!! I really appreciate your answer!!

But I don't know why nohup option makes abnormal result. Could you explain the reason? I cannot find the reason.

ADD REPLYlink written 2.5 years ago by 2yuna71010
2

It looks as if stdout and stderr were merged. Could you please post the commands that you typed a) to generate the sam, b) to sort the sam (which should not work (at least with the older samtools versions))

ADD REPLYlink written 2.6 years ago by cschu1811.8k

Your thought is right! Thank you so much. Because of nohup option the result was abnormal. I don't know why this situation happened.

ADD REPLYlink modified 2.5 years ago • written 2.5 years ago by 2yuna71010
2
gravatar for Michael Dondrup
2.6 years ago by
Bergen, Norway
Michael Dondrup46k wrote:

It is unclear which command and version you are using, but most likely nohup is the culprit. If running under nohup, it is mandatory in newer versions of samtools (htslib) to specify the output filename using option '-o sorted.bam', see the documentation http://www.htslib.org/doc/samtools.html

ADD COMMENTlink modified 2.5 years ago • written 2.6 years ago by Michael Dondrup46k

Yes, you are right. Thank you so much. nohup is the culprit. Although I used the newest version of samtools with nohup, the problem occurred.

ADD REPLYlink modified 2.5 years ago • written 2.5 years ago by 2yuna71010

It is because of using a later htslib versions of samtools have a different call syntax. In the earlier versions (0.x), a prefix for the output needed to be provided: like so samtools sort my.bam out.sorted which would generate out.sorted.bam and not write anything to stdout. The way it is now is imo much better.

You should be able to run it just fine under nohup like so:

nohup samtools sort -o aln.sorted.bam aln.bam
ADD REPLYlink modified 2.5 years ago • written 2.5 years ago by Michael Dondrup46k
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: 2479 users visited in the last hour