bioinfo@ird.fr

Trainings 2019 – Advanced HPC – Practice

Advanced HPC Practice

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 23/05/2019

Summary


Practice 1: Install your own packages

1) Prepare your work environment

Create 2 folders:

  • ~/sources
  • ~/softs

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 .basrc 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.9 version in your ~/sources folder

Read the instruction in the archive and install it into ~/softs/samtools-1.9 folder

Configure your .basrc to use your version by default with adding the following line to your .bashrc:

export PATH=~/softs/samtools-1.9/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.9/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.9

Create a folder ~/privatemodules/samtools

Into that folder create a modulefile 1.9

Don't forget the conflict line

4) Check that you can see your modulefiles with module avail

5) Load your modules and test them with the commands:

$ whereis bwa
$ whereis samtools

6) Try to load the following softwares and notice what happen:

$ module load bwa/0.7.17
$ module load samtools/1.9

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 -tc 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 one node at the same time.

At the end, we will receive 15 results files directly in our /home.

1) Have a look of the data your going to use in /data2/formation/TP-advanced-hpc/bwa/fastqDir

The 2 pairs of individuals are named such as: CloneX.1.fastq_1 and CloneX.2.fastq_2

With X for 1 to 15. X will be replaced in our script by SGE_TASK_ID

2) Using a job array create a script to perform a bwa-mem on the 15 individuals

The script should transfer the /data2/formation/TP-advanced-hpc/bwa/ folder into the /scratch of the node.

Use your own module environment for bwa

The command to launch on every individual is

bwa mem bwa/reference.fasta bwa/fastqDir/CloneX.1.fastq bwa/fastqDir/CloneX.2.fastq > bwa/results/mapping-X.sam

Practice 4: Install Singularity

Install dependencies:

With apt get

$ sudo apt-get update && sudo apt-get install -y \

 build-essential \

 libssl-dev \

 uuid-dev \

 libgpgme11-dev \

 squashfs-tools \

 libseccomp-dev \

 git \

 pkg-config
 ```

 With `yum`

$ sudo yum update -y && \
sudo yum groupinstall -y 'Development Tools' && \
sudo yum install -y \
openssl-devel \
libuuid-devel \
libseccomp-devel \
wget \
squashfs-tools \
git


#### Install The programming  language `Go`:

Go to the [Download Page](https://golang.org/dl/) and choose the archive go.1.12.5.linux-amd64.tar.gz

Launch the following commands:

Download the archive

wget https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz
# Extract the archive into /usr/local
sudo tar -C /usr/local -xzvf go1.12.5.linux-amd64.tar.gz

Set up your environment for Go with  the following commands:

Create the GOPATH variable into .bashrc

echo 'export GOPATH=${HOME}/go' >> ~/.bashrc
# Set the PATH with Go
echo 'export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin' >> ~/.bashrc
# Resource your environment to take the modifications into account
 source ~/.bashrc

For Singularity > v3.0.0, we also need to install `dep` for dependency resolution

go get -u github.com/golang/dep/


#### Download and install singularity from repo:

To ensure that the Singularity source code is downloaded to the appropriate directory use these commands.

go get -d github.com/sylabs/singularity


You will obtain a warning but it will still download Singularity source code to the appropriate directory within the `$GOPATH`

```# move to the singularity folder
     cd ~/go/src/github.com/sylabs/singularity/ 
     # launch the mconfig command ( you can add the option --prefix=path to custom the installation directory)
     ./mconfig
     # Compile into the build directory
     make -C ./builddir
     # Install the binaries into /usr/local/bin by default as superuser
     sudo make -C ./builddir install

Type the following command to your `.bashrc` file to enable completion in singularity:

. /usr/local/etc/bash_completion.d/singularity
    # resource your .bashrc
    source ~/.bashrc

<a name="practice-5"></a>

Practice 5 : Create your own Singularity container

In your home user, create 2 folders:

  • `def`to host your singularity definition files
  • `containers`to host your containers
mkdir ~/def

mkdir ~/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`

2) Build your singularity image from your recipe file

singularity build bwa-0.7.17.simg bwa-0.7.17.def

It will produce a singularity image called bwa-0.7.17.simg

3) Test your container

singularity run bwa-0.7.17.simg

4) Transfer your container to the cluster into your `/home` and run it

qrsh -q formation.q

cd /scratch

mkdir formationX

cd formationX

scp -r /data2/formation/TP-advanced-hpc/bwa .

scp  ~/bwa-0.7.17.simg .

module load system/singularity/2.4.2

mkdir bwa/results

singularity run bwa-0.7.17.simg mem bwa/reference.fasta bwa/fastqDir/Clone1.1.fastq bwa/fastqDir/Clone2.2.fastq > bwa/results/mapping-1.sam

Links


License

The resource material is licensed under the Creative Commons Attribution 4.0 International License (here).