samtools sort error
1
0
Entering edit mode
5.1 years ago
JC • 0

I am having a problem with samtools.

It looks like I successfully created a .bam file. When I enter:

samtools view Y13.bam | head

I get a file that is formatted like this:

TCTGGCGCAGTATGTCACACCTGCATTGGACAGAGCTTGTTTTCATGGCAGACAAAC   AAFAFJFAJJFJJ<JJJJAJJJJF7F7FJJJJJ<FJJJJFJ-FJFJ<<JFJJJF-7JFJ-7FJ-F-AF7FF---<7<-7FFF--77F-F-A-777F<F<JF<---77FF-7A7A<-AA7--A<F-7FJ<77A7<--7-7--A-777F<-F  YT:Z:UP
E00558:452:H3WH2CCX2:1:1101:21572:5739  141 *   0   0   *   *   0   0

But when I run:

samtools sort Y13.bam -o Y13.sorted.bam

the output printed in terminal looks like this:

     W�����x��O�U�e�$ytL��S�#�_ɧN���Ie��ifz����!��nW���c�f54���HE���m^O��u;\���m���&8VTZ>���X0�I�#�X�
             g��}��J��y�e�����ܲ4� 7`�I��Iݼ�ʉLOՏ����!^H�=��d< Oj/��5ȩ"�܉�g��~����So4�mY�dd�z��|��WD��k9���ɵ�̎@<�t�pG��^O4d����S�(d"{ߗ���#��1�%��aA�x  �nt��

Also, there is no Y13.sorted.bam file being created.

Any suggestions as to what might be going on here?

SNP alignment • 1.2k views
ADD COMMENT
1
Entering edit mode

Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.
code_formatting

ADD REPLY
1
Entering edit mode

JC : Please upgrade your samtools to the latest version, which is now 1.9. Version you are using is really ancient.

ADD REPLY
0
Entering edit mode

it is working with v.1.9. Thanks!

ADD REPLY
2
Entering edit mode
5.1 years ago

What version of samtools are you running? It looks like an older version that wants a ">" instead of "-o" to redirect output to a file instead of the terminal.

ADD COMMENT
0
Entering edit mode

Version: 0.1.19-44428cd

it looks like -o is the option for this version based on the options available:

$ samtools sort

Usage:   samtools sort [options] <in.bam> <out.prefix>

Options: -n        sort by read name
         -f        use <out.prefix> as full file name instead of prefix
         -o        final output to stdout
         -l INT    compression level, from 0 to 9 [-1]
         -@ INT    number of sorting and compression threads [1]
         -m INT    max memory per thread; suffix K/M/G recognized [768M]
ADD REPLY
1
Entering edit mode

-o final output to stdout looks like exactly what is happening. I used that ancient version for a long time, I'm pretty sure I used > sorted.bam

ADD REPLY
0
Entering edit mode

It looks like it was a version issue. I have this step working now with the new version. Thanks!

ADD REPLY

Login before adding your answer.

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