Bowtie2

Description

According to the Bowtie2 page, Bowtie2 is an ultrafast and memory-efficient tool for aligning sequencing reads to long reference sequences. It is particularly good at aligning reads of about 50 to 1000 characters, and particularly good at aligning to relatively long genomes (e.g., mammalian).

Available Versions

  • bowtie2/2.3.5.1

Job Submission

submit_bowtie2.sh
#!/bin/bash
#SBATCH -J bowtie2
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 24:00:00
#SBATCH --mem=16G

export INPUT="reference.fa reads.fq"
export OUTPUT="aligned.sam"

module load bowtie2/2.3.5.1

# Build index
bowtie2-build reference.fa reference_index

# Align reads
job-nanny bowtie2 -x reference_index -U reads.fq -S aligned.sam -p $SLURM_CPUS_PER_TASK

Paired-end Alignment

submit_bowtie2_paired.sh
#!/bin/bash
#SBATCH -J bowtie2_paired
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 24:00:00
#SBATCH --mem=16G

export INPUT="reference.fa reads_1.fq reads_2.fq"
export OUTPUT="aligned.sam"

module load bowtie2/2.3.5.1

# Build index
bowtie2-build reference.fa reference_index

# Align paired-end reads
job-nanny bowtie2 -x reference_index -1 reads_1.fq -2 reads_2.fq -S aligned.sam -p $SLURM_CPUS_PER_TASK

Script Processing

run_bowtie2.sh
#!/bin/bash
#SBATCH -J bowtie2_script
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 24:00:00
#SBATCH --mem=16G

export INPUT="reference.fa reads/ run.sh"
export OUTPUT="results/"

module load bowtie2/2.3.5.1
job-nanny ./run.sh
run.sh
#!/bin/bash

echo "====================[ Building index ]===================="
bowtie2-build reference/lambda_virus.fa lambda_virus

echo "====================[ Aligning ]===================="
bowtie2 -x lambda_virus -U reads/reads_1.fq -S eg1.sam -p 8

echo "====================[ Processing SAM ]===================="
samtools view -bS eg1.sam > eg1.bam
samtools sort eg1.bam -o eg1.sorted.bam
samtools index eg1.sorted.bam

mkdir -p results
mv eg1.* results/

Important Options

Bowtie2 Options

Option

Description

-x <bt2-idx>

Reference index (prefix)

-1 <m1>

Paired-end file 1

-2 <m2>

Paired-end file 2

-U <r>

Single-end file

-S <sam>

Output SAM file

-p <int>

Number of threads

--very-sensitive

More sensitive mode (slower)

--fast

Faster mode (less sensitive)

-q

Input is FASTQ

-f

Input is FASTA

References

See also