Parasail

From Alliance Doc
Revision as of 16:53, 26 June 2024 by Diane27 (talk | contribs) (Created page with "1. Préparez le script Python. {{File |name=parasail-sw.py |lang="python" |contents= import parasail from Bio.Align import PairwiseAligner")
Jump to navigation Jump to search
Other languages:

parasail est une bibliothèque SIMD C (C99) qui contient des implémentations d'algorithmes d'alignement de séquences par paires Smith-Waterman (local), Needleman-Wunsch (global) et autres alignements (semi-globaux).

Light-bulb.pngStarting from StdEnv/2023, the parasail-python extension is now bundled in the module parasail. As for 2020, the module needs to be loaded in order for the python extension to be installed in a virtual environment.

Utilisation

Pour connaître la version disponible, utillisez

Question.png
[name@server ~]$ module spider parasail

Chargez la bibliothèque avec

Question.png
[name@server ~]$ module load parasail/2.6.2

Avec le binaire parasail_aligner

Il est important de définir le nombre de fils selon le nombre de cœurs alloués à votre tâche, par exemple

parasail_aligner -t ${SLURM_CPUS_PER_TASK:-1} ...}}

Extension Python

Le module contient des liaisons pour plusieurs versions de Python. Pour connaître les versions compatibles de Python, lancez

Question.png
[name@server ~]$ module spider parasail/1.3.4

Utiliser l'extension

1. Chargez les modules requis.

Question.png
[name@server ~]$ module load parasail/2.6.2 python/3.11 scipy-stack/2023b

2. Importez parasail 1.3.4.

Question.png
[name@server ~]$ python -c "import parasail"

If the command displays nothing, the import was successful.

Example

Run a quick local alignment score comparison between BioPython and parasail.

1. Préparez le script Python.

File : parasail-sw.py

import parasail
from Bio.Align import PairwiseAligner

A = "ACGT" * 1000

# parasail
matrix = parasail.matrix_create("ACGT", 1, 0)
parasail_score = parasail.sw(A, A, 1, 1, matrix).score

# biopython
bio_score = PairwiseAligner().align(A, A)[0].score

print('parasail:', parasail_score)
print('biopython:', bio_score)


2. Préparez le script de soumission selon votre environnement.

File : submit-parasail.sh

#!/bin/bash
#SBATCH --account=def-someuser  # replace with your PI account
#SBATCH --cpus-per-task=1 
#SBATCH --mem-per-cpu=3G      # increase as needed
#SBATCH --time=1:00:00

module load parasail/2.6.2 python/3.11 scipy-stack/2023b

# Install any other requirements, such as Biopython
virtualenv --no-download $SLURM_TMPDIR/env
source $SLURM_TMPDIR/env/bin/activate
pip install --no-index --upgrade pip
pip install --no-index biopython==1.83

python parasail-sw.py


2.1. Identify available wheels first :

Question.png
[name@server ~]$ avail_wheel parasail
name      version    python    arch
--------  ---------  --------  -------
parasail  1.2.4      py2,py3   generic

Then install the desired version in your virtual environment:

File : submit-parasail.sh

#!/bin/bash
#SBATCH --account=def-someuser  # replace with your PI account
#SBATCH --cpus-per-task=1 
#SBATCH --mem-per-cpu=3G      # increase as needed
#SBATCH --time=1:00:00
</div>

module load StdEnv/2020 gcc parasail/2.5 python/3.10

# Install any other requirements, such as Biopython
virtualenv --no-download $SLURM_TMPDIR/env
source $SLURM_TMPDIR/env/bin/activate
pip install --no-index --upgrade pip
pip install --no-index parasail==1.2.4 biopython==1.83

python parasail-sw.py


3. Soumettez la tâche avec

Question.png
[name@server ~]$ sbatch submit-parasail.sh

4. The output will be in the slurm output file, once the job has run:

Question.png
[name@server ~]$ less slurm-*.out
parasail: 4000
biopython: 4000.0

Available Python packages

Other Python packages that depend on parasail will have their requirement satisfied with the module loaded:

Question.png
[name@server ~]$ pip list | grep parasail
parasail                           1.3.4