Description | Hands On Lab Exercises for HPC |
---|---|
Related-course materials | AdvancedHPC |
Authors | Ndomassi TANDO (ndomassi.tando@ird.fr) |
Creation Date | 10/05/2019 |
Last Modified Date | 17/05/2022 |
Summary
- Practice 1: Install you own packages
- Practice 2: Create a module environment
- Practice 3: Launch a job array
- Practice 4: Install Singularity
- Practice 5: Create your own Singularity container
- Practice 6: Use your own Singularity container with sbatch
- Links
- License
Practice 1: Install your own packages
1) Prepare your work environment
Create 3 folders:
- ~/sources
- ~/softs
- ~/results
2) Install bwa
Go to the download page of bwa
Download the 0.7.17 version in your ~/sources folder using wget
Read the instructions in the archive and install it into ~/softs/bwa-0.7.17 folder
Configure your .bashrc to use your version by default with adding the following line to your .bashrc:
export PATH=~/softs/bwa-0.7.17/:$PATH
source ~/.bashrc
Test your installation with the command:
which bwa
3) Install samtools
Go to the download page of samtools
Download the 1.15 version in your ~/sources folder
Read the instruction in the archive and install it into ~/softs/samtools-1.15 folder
Configure your .bashrc to use your version by default with adding the following line to your .bashrc:
export PATH=~/softs/samtools-1.15/bin:$PATH
source ~/.bashrc
Test your installation with the command:
which samtools
Practice 2: Create a module environment
1) Prepare your work environment
Create the folder ~/privatemodules
Modify your .basrc with the following:
module use --append $HOME/privatemodules
Place it after the if loop.
Comment the following lines:
export PATH=~/softs/bwa-0.7.17/:$PATH
export PATH=~/softs/samtools-1.15/bin:$PATH
Retrieve the following modulefile as example and modify it to your needs: /data2/formation/TP-advanced-hpc/modulefile-blast-2.4.0+
2) Create a modulefile for bwa 0.7.17
Create a folder ~/privatemodules/bwa
Into that folder create a modulefile 0.7.17
Don’t forget the conflict line
3) Create a modulefile for samtools-1.15
Create a folder ~/privatemodules/samtools
Into that folder create a modulefile 1.15
Don’t forget the conflict line
4) Check that you can see your modulefiles with module avail
They will appear under a new session /home/<your_login>/privatemodules
5) Load your modules and test them with the commands:
6) Try to load the following softwares and notice what happen:
Practice 3 : Launch a job array
A job array allows you to launch several computations at the same time in one script.
You can imagine launch up to 10000 jobs as the same time.
That is why is very important to launch your job array with %5
to launch it with 5 running jobs at the same time maximum.
In this exercise, we are going to launch a bwa mem on 15 different individuals in one job array script on several nodes at the same time.
At the end, we will receive 15 results files directly into our /home.
1) Have a look of the data you are going to use in /data2/formation/TP-advanced-hpc/bwa/fastqDir
The 2 pairs of read files for individual X are named as follow: CloneX.1.fastq
and CloneX.2.fastq
With X
for 1 to 15. X
will be replaced in our script by SLURM_ARRAY_TASK_ID
2) Using a job array create a script to perform a bwa-mem on the 15 individuals
You can use the template script here: /data2/formation/TP-advanced-hpc/exemple-batch.sh
The script should transfer the /data2/formation/TP-advanced-hpc/bwa/
folder into the /scratch
of the node.
The command to use for the transfer is:
Use your own module environment for bwa
The command to launch on every individual is
Practice 4: Install Singularity
Install dependencies:
With apt get
With yum
Install The programming language Go
:
We are going to install the archive go.1.20.4.linux-amd64.tar.gz
Launch the following commands:
Set up your environment for Go with the following commands:
Download and install singularity from repo:
Launch the following command to install singularity
Type the following command to your .bashrc
file to locate singularity
Practice 5 : Create your own Singularity container
In your home user, create 2 folders:
def
to host your singularity definition filescontainers
to host your containers
1) Create a recipe file:
A Singularity Recipe includes specifics about installation software, environment variables, files to add, and container metadata.
Retrieve the singularity.def file /data2/formation/TP-advanced-hpc/singularity.def
Modify it to create a recipe file for bwa 0.7.17 named bwa-0.7.17.def
in your ~/def folder
2) On your own PC in your ~/containers folder, Build your singularity image from your recipe file as superuser
It will produce a singularity image called bwa-0.7.17.simg
3) Test your container
4) Transfer your container from your PC to bioinfo-nas.ird.fr into your /home
using filezilla
or scp
Then , connect to bioinfo-master.ird.fr and run the following commands:
Check if you get a mapping-1.sam file then erase your folder and go back to master0
Practice 6 : Use your own Singularity container with sbatch
- On the cluster, create a modulefile called 0.7.17-singu to use bwa-0.7.17.simg as a module
You have to add module load system/singularity/3.6.0
in your modulefile and point to the location of your container
-
Create a folder
~/results2
-
Copy your script made in practice3 and modify it to use your singularity modulefile of 0.7.17-singu, place your results into
~/results2
Links
- Related courses : HPC Trainings
- Tutorials : How tos