ClustalW

Description

ClustalW is a multiple sequence alignment program for DNA or proteins. Clustal Omega is a newer version offering significantly greater scalability, allowing alignment of hundreds of thousands of sequences in a few hours.

Available Versions

  • clustalw/2.1 (default)

  • clustalw-mpi/0.13 (default)

Serial Job Submission

submit_clustalw_serial.sh
#!/bin/bash
#SBATCH -J clustalw
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 02:00:00
#SBATCH --mem=4G

export INPUT="sequences.fasta"
export OUTPUT="alignment.aln"

module load clustalw/2.1
job-nanny clustalw2 -infile=sequences.fasta -outfile=alignment.aln

MPI Job Submission

submit_clustalw_mpi.sh
#!/bin/bash
#SBATCH -J clustalw_mpi
#SBATCH -N 2
#SBATCH --ntasks-per-node=28
#SBATCH -t 04:00:00
#SBATCH --mem-per-cpu=2G

export INPUT="sequences.fasta"
export OUTPUT="alignment.aln"

module load clustalw-mpi
job-nanny srun -n $SLURM_NTASKS clustalw-mpi -infile=sequences.fasta -outfile=alignment.aln

Important Options

ClustalW Options

Option

Description

-infile=<file>

Input file with sequences

-outfile=<file>

Output file with alignment

-type=<DNA|PROTEIN>

Sequence type

-output=<clustal|fasta|gcg|phylip|nexus>

Output format

-align

Perform alignment

-tree

Calculate phylogenetic tree

-bootstrap=<n>

Number of bootstraps

Alignment with Specific Parameters

submit_clustalw_params.sh
#!/bin/bash
#SBATCH -J clustalw_params
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 02:00:00
#SBATCH --mem=4G

export INPUT="sequences.fasta"
export OUTPUT="alignment.phy"

module load clustalw/2.1

job-nanny clustalw2 -infile=sequences.fasta \
                    -outfile=alignment.phy \
                    -output=phylip \
                    -type=PROTEIN \
                    -gapopen=10 \
                    -gapext=0.2 \
                    -pwgapext=0.1 \
                    -pwdnamatrix=iub

ClustalW with Profiles

To align sequences against an existing profile:

submit_clustalw_profile.sh
#!/bin/bash
#SBATCH -J clustalw_profile
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 02:00:00
#SBATCH --mem=4G

export INPUT="new_sequences.fasta existing_profile.aln"
export OUTPUT="profile_alignment.aln"

module load clustalw/2.1

job-nanny clustalw2 -infile=new_sequences.fasta \
                    -profile1=existing_profile.aln \
                    -outfile=profile_alignment.aln

Job Array for Multiple Alignments

submit_clustalw_array.sh
#!/bin/bash
#SBATCH -J clustalw_array
#SBATCH --array=1-10
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 02:00:00
#SBATCH --mem=4G

FILES=(
    "gene1.fasta"
    "gene2.fasta"
    "gene3.fasta"
    "gene4.fasta"
    "gene5.fasta"
    "gene6.fasta"
    "gene7.fasta"
    "gene8.fasta"
    "gene9.fasta"
    "gene10.fasta"
)

INPUT_FILE=${FILES[$SLURM_ARRAY_TASK_ID-1]}
OUTPUT_FILE="aln_${INPUT_FILE%.fasta}.aln"

export INPUT="$INPUT_FILE"
export OUTPUT="$OUTPUT_FILE"

module load clustalw/2.1
job-nanny clustalw2 -infile=$INPUT_FILE -outfile=$OUTPUT_FILE

References

See also