Hi,
I am trying to run the command samtools sort -@ 12 in.bam -O bam in_sorted
using samtools version 1.1.
However this gives me the error:
Legacy usage: samtools sort [options...] <in.bam> <out.prefix>
Options:
-f Use <out.prefix> as full final filename rather than prefix
-o Write final output to stdout rather than <out.prefix>.bam
-l,m,n,@ Similar to corresponding options above
Usage: samtools sort [options...] [in.bam]
Options:
-l INT Set compression level, from 0 (uncompressed) to 9 (best)
-m INT Set maximum memory per thread; suffix K/M/G recognized [768M]
-n Sort by read name
-o FILE Write final output to FILE rather than standard output
-O FORMAT Write output as FORMAT ('sam'/'bam'/'cram') (either -O or
-T PREFIX Write temporary files to PREFIX.nnnn.bam -T is required)
-@ INT Set number of sorting and compression threads [1]
Should I not use -O and -@ with this version of samtools to specify that I want to use 12 threads and my output to be a bam file?
Thank you in advance for your help!
Is there a good-enough reason to do this? Shouldn't you rather use the most up to date version and that syntax?
I am trying to use the most up to date version of the syntax. My understanding was that the options -@ and -O are the new versions, not the legacy version?
I don't know when
-@
was introduced, but you no longer need-O
. samtools finds the file format based on the extension specified by-o
.So you can do
samtools sort -@12 -o sorted_alignment.bam myalignment.bam
I tried this and it worked. Thank you for your help!!