Question: samtools sort error
0
gravatar for JC
12 months ago by
JC0
JC0 wrote:

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 • 233 views
ADD COMMENTlink modified 12 months ago by _r_am31k • written 12 months ago by JC0
1

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 REPLYlink written 12 months ago by _r_am31k
1

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

ADD REPLYlink written 12 months ago by GenoMax92k

it is working with v.1.9. Thanks!

ADD REPLYlink written 12 months ago by JC0
2
gravatar for swbarnes2
12 months ago by
swbarnes29.2k
United States
swbarnes29.2k wrote:

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 COMMENTlink written 12 months ago by swbarnes29.2k

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 REPLYlink modified 12 months ago by GenoMax92k • written 12 months ago by JC0
1

-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 REPLYlink written 12 months ago by swbarnes29.2k

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

ADD REPLYlink written 12 months ago by JC0
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: 1502 users visited in the last hour