Parasail/fr: Difference between revisions
(Created page with "Parasail") |
(Created page with "= Utilisation =") |
||
Line 11: | Line 11: | ||
</div> | </div> | ||
= Utilisation = | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> |
Revision as of 16:29, 26 June 2024
parasail is a SIMD C (C99) library containing implementations of the Smith-Waterman (local), Needleman-Wunsch (global), and various semi-global pairwise sequence alignment algorithms.
Utilisation
parasail_aligner Example
When using the binary parasail_aligner it is important to set the number of threads according to the number of cores allocated in our job. We can set it with
parasail_aligner -t ${SLURM_CPUS_PER_TASK:-1} ...}}
Python extension
The module contains bindings for multiple Python versions. To discover which are the compatible Python versions, run
[name@server ~]$ module spider parasail/1.3.4
Usage
1. Load the required modules.
[name@server ~]$ module load parasail/2.6.2 python/3.11 scipy-stack/2023b
If the command displays nothing, the import was successful.
Example
Run a quick local alignment score comparison between BioPython and parasail.
1. Write the python script:
import parasail
from Bio.Align import PairwiseAligner
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
A = "ACGT" * 1000
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
# parasail
matrix = parasail.matrix_create("ACGT", 1, 0)
parasail_score = parasail.sw(A, A, 1, 1, matrix).score
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
# biopython
bio_score = PairwiseAligner().align(A, A)[0].score
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
print('parasail:', parasail_score)
print('biopython:', bio_score)
2. And the job submission script:
#!/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>
<div lang="en" dir="ltr" class="mw-content-ltr">
module load parasail/2.6.2 python/3.11 scipy-stack/2023b
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
# 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
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
python parasail-sw.py
2.1. Identify available wheels first :
[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:
#!/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>
<div lang="en" dir="ltr" class="mw-content-ltr">
module load StdEnv/2020 gcc parasail/2.5 python/3.10
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
# 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
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
python parasail-sw.py
4. The output will be in the slurm output file, once the job has run:
[name@server ~]$ less slurm-*.out
parasail: 4000
biopython: 4000.0