Trouble Sorting A Bam File
1
1
Entering edit mode
11.6 years ago
Jordan ★ 1.3k

Hi,

I'm having trouble sorting a bam file. I give the following command.

samtools sort -m 40G -o file.bam file.sorted

But I get lot of binary code displayed. I understand that it happens sometimes when you have insufficient memory. But I have given a memory of 40G and the bam file is only 250MB.

Can anyone tell what I'm doing wrong? Thanks!

bam samtools sort • 2.4k views
ADD COMMENT
1
Entering edit mode

have you just tried " samtools sort file.bam file.sort

ADD REPLY
0
Entering edit mode

Somehow I didn't think of that simple way of doing it! And it worked. Thanks!

ADD REPLY
0
Entering edit mode
11.6 years ago

You are wrongly using the -o parameter. It should be

samtools sort -m 40G file.bam file.sorted

OR

samtools sort -m 40G file.bam -o file.sorted.bam

ADD COMMENT
0
Entering edit mode

Actually I tried that too. I stil get the same issue. Binary code is still displayed.

ADD REPLY
1
Entering edit mode

That binary code is sorted bam file. I think -o parameter will redirect the output to stdout. You can -o and then redirect the output using > to the new output file.

ADD REPLY

Login before adding your answer.

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