This is a test version of Biostars. For the public version, visit https://www.biostars.org.
samtools warning in sort file bam

The script I have is

samtools sort '/home/rasoul/Desktop/tophat_out-16/accepted_hits.bam' accepted_hitssort.bam

the command is not executed

Why?

rna-seq

1 answer

you need to check the version of samtools you use, and the help messages (samtools sort arguments changed (like after v0.9?), introduced -o option for output file)

For example, I use version 1.9, and the command line like this:

$ samtools sort -o accepted_hitssort.bam  /home/rasoul/Desktop/tophat_out-16/accepted_hits.bam

Here are the version and help message.

$ samtools --version
samtools 1.9
Using htslib 1.9
Copyright (C) 2018 Genome Research Ltd.

$ samtools sort 
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
  -t TAG     Sort by value of TAG. Uses position as secondary index (or read name if -n is set)
  -o FILE    Write final output to FILE rather than standard output
  -T PREFIX  Write temporary files to PREFIX.nnnn.bam
      --input-fmt-option OPT[=VAL]
               Specify a single input file format option in the form
               of OPTION or OPTION=VALUE
  -O, --output-fmt FORMAT[,OPT[=VAL]]...
               Specify output format (SAM, BAM, CRAM)
      --output-fmt-option OPT[=VAL]
               Specify a single output file format option in the form
               of OPTION or OPTION=VALUE
      --reference FILE
               Reference sequence FASTA FILE [null]
  -@, --threads INT
               Number of additional threads to use [0]

Log in to answer this question.