I am trying to run the following script on slurm to extract information from .sam files. While everything is perfect on my local machine with the samtools version 1.11, it does not work on slurm. I have this error:

samtools: command not found

That means slurm cannot understand the module if I am not mistaken. What would be a solution here?


#SBATCH --time=05:00:00
#SBATCH --account=def-myaccount
#SBATCH --mem=200000M
#SBATCH --mail-user=mymail@gmail.com
#SBATCH --mail-type=All

module load nixpkgs/16.09  intel/2018.3
# module load samtools/1.11 # this is what I tried first
module spider samtools/1.11 # this does not help either...

for FILE in *.sam;


        NUM=`echo $FILE | sed -r 's/.sam//' | sed -r 's/nastya//'`

#         echo "$FILE" ;

        samtools flagstat -O tsv $FILE > file${NUM}.txt

  • 3
    $\begingroup$ @OP, these kinds of specific questions should be discussed with your sysadmin as it is specific to the cluster you work on. Alternatively you can install a local version with package managers such as conda but. $\endgroup$
    – ATpoint
    Feb 12, 2021 at 9:37

1 Answer 1


I would start with:

module avail

Then look to see (a) if there is a samtools module avilable and (b) exactly what it's called.

If it's called samtools/1.11 then:

module load samtools/1.11

Should work, if it doesn't speak to your sys admin.

  • $\begingroup$ Great. Thanks for the tips. It worked. Didn't know about avail. $\endgroup$ Feb 12, 2021 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.