HMMER
In this section:
Description
According to the HMMER page, HMMER is used for searching sequence databases for sequence homologs and for making sequence alignments. It implements methods using probabilistic models called profile hidden Markov models (profile HMMs).
Available Versions
hmmer/3.1b2 (default)
Serial Job Submission
#!/bin/bash
#SBATCH -J hmmer_serial
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 03:00:00
#SBATCH --mem=4G
export INPUT="globins4.hmm globins4.sto"
export OUTPUT="*.out *.hmm"
module load hmmer
job-nanny hmmbuild globins4.hmm globins4.sto
OpenMP Job Submission
#!/bin/bash
#SBATCH -J hmmer_omp
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 06:00:00
#SBATCH --mem=16G
export INPUT="query.fasta database.fasta"
export OUTPUT="results.out"
module load hmmer
# Build HMM
job-nanny hmmbuild --cpu $SLURM_CPUS_PER_TASK query.hmm query.fasta
# Search in database
job-nanny hmmsearch --cpu $SLURM_CPUS_PER_TASK query.hmm database.fasta > results.out
Main HMMER Commands
Command |
Description |
|---|---|
|
Builds a profile HMM from a multiple alignment |
|
Searches sequences in a database using a profile HMM |
|
Searches a profile HMM in a domain database using a sequence |
|
Aligns sequences to an existing HMM profile |
|
Converts HMM file formats |
|
Prepares an HMM database for searching |
Full Example: Domain Analysis
#!/bin/bash
#SBATCH -J hmmer_analysis
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 12:00:00
#SBATCH --mem=32G
export INPUT="proteins.fasta pfam.hmm"
export OUTPUT="pfam_results/"
module load hmmer
mkdir -p pfam_results
cd pfam_results
# Prepare Pfam database (if not ready)
# hmmpress /path/to/Pfam-A.hmm
# Search Pfam domains in proteins
job-nanny hmmscan --cpu $SLURM_CPUS_PER_TASK \
--domtblout pfam_domains.tbl \
--tblout pfam_hits.tbl \
/path/to/Pfam-A.hmm ../proteins.fasta > pfam_scan.log
# Extract significant hits (E-value < 1e-5)
awk '$7 < 1e-5' pfam_domains.tbl > significant_hits.tbl
# Generate report
echo "Total number of hits: $(wc -l < pfam_hits.tbl)" > report.txt
echo "Significant hits: $(wc -l < significant_hits.tbl)" >> report.txt
Alignment with HMM
#!/bin/bash
#SBATCH -J hmmalign
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 02:00:00
#SBATCH --mem=4G
export INPUT="profile.hmm sequences.fasta"
export OUTPUT="aligned.sto"
module load hmmer
job-nanny hmmalign -o aligned.sto profile.hmm sequences.fasta
Building Profile from Alignment
#!/bin/bash
#SBATCH -J hmmbuild
#SBATCH -N 1
#SBATCH -c 8
#SBATCH -t 04:00:00
#SBATCH --mem=8G
export INPUT="alignment.sto"
export OUTPUT="profile.hmm"
module load hmmer
job-nanny hmmbuild --cpu $SLURM_CPUS_PER_TASK profile.hmm alignment.sto
Job Array for Multiple Searches
#!/bin/bash
#SBATCH -J hmmer_array
#SBATCH --array=1-10
#SBATCH -N 1
#SBATCH -c 4
#SBATCH -t 08:00:00
#SBATCH --mem=8G
QUERIES=(
"kinase.hmm"
"protease.hmm"
"receptor.hmm"
"transporter.hmm"
"channel.hmm"
"factor.hmm"
"binding.hmm"
"enzyme.hmm"
"regulator.hmm"
"structural.hmm"
)
QUERY=${QUERIES[$SLURM_ARRAY_TASK_ID-1]}
export INPUT="$QUERY proteome.fasta"
export OUTPUT="results_${QUERY%.hmm}/"
module load hmmer
mkdir -p results_${QUERY%.hmm}
cd results_${QUERY%.hmm}
job-nanny hmmsearch --cpu $SLURM_CPUS_PER_TASK \
--tblout hits.txt \
../$QUERY ../proteome.fasta > search.log
Results Analysis
#!/bin/bash
#SBATCH -J analyze_hmmer
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 01:00:00
#SBATCH --mem=4G
module load hmmer
# Extract statistics from results
for tbl in results_*/hits.txt; do
DIR=$(dirname $tbl)
HITS=$(grep -v "^#" $tbl | wc -l)
echo "$DIR: $HITS hits" >> summary.txt
done
# Calculate E-value distribution
cat results_*/hits.txt | grep -v "^#" | awk '{print $5}' > evalues.txt
# Generate histogram with Python
cat > plot.py << 'EOF'
import numpy as np
import matplotlib.pyplot as plt
evalues = np.loadtxt('evalues.txt')
plt.figure()
plt.hist(np.log10(evalues), bins=50)
plt.xlabel('log10(E-value)')
plt.ylabel('Frequency')
plt.title('E-value distribution')
plt.savefig('evalue_distribution.png')
EOF
python plot.py
References
Documentation: http://hmmer.org/documentation.html
Tutorial: http://hmmer.org/tutorial.html
User Guide: ftp://selab.janelia.org/pub/software/hmmer/3.1b2/Userguide.pdf
See also
BLAST - Alternative for sequence search
ClustalW - Multiple sequence alignment
Running Simulations - How to submit jobs