<p>I would start with:</p>
<pre><code>module avail
</code></pre>
<p>Then look to see (a) if there is a samtools module avilable and (b) exactly what it's called.</p>
<p>If it's called samtools/1.11 then:</p>
<pre><code>module load samtools/1.11
</code></pre>
<p>Should work, if it doesn't speak to your sys admin.</p>

CC BY-SA 4.0
2021-02-12T17:20:17.053Z
Great. Thanks for the tips. It worked. Didn't know about ```avail```.
Dmitrii Trubetskoy
CC BY-SA 4.0
2021-02-11T22:11:45.157Z
2021-02-11T22:11:45.157Z
Liam McIntyre
<p>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:</p>
<pre><code>samtools: command not found
</code></pre>
<p>That means slurm cannot understand the module if I am not mistaken. What would be a solution here?</p>
<pre><code>#!/bin/bash


#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;

do


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

#         echo &quot;$FILE&quot; ;


        samtools flagstat -O tsv <span class="math-container">$FILE &gt; file$</span>{NUM}.txt

done
</code></pre>

<samtools><slurm>
How can I run the latest version of samtools on Slurm?
# How can I run the latest version of samtools on Slurm?

(Asked by: username_0 on 2021-02-11)

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?
#!/bin/bash


#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;

do


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

#         echo "$FILE" ;


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

done

**Tags:** samtools, slurm

---

## 1 answers

### Answer by username_1 on 2021-02-11. Score: 2 | Accepted answer

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.

> **Comments:**
> **username_0**: Great. Thanks for the tips. It worked. Didn't know about ```avail```.  

---

