How to Install RNAmmer in Prokka
Published:
Ribosomal RNA gene prediction in Prokka
Prokka is one of my favorite (bacterial) genome annotation tools. It is quite easy to install and to use. Nevertheless, there are many parameters and configurations there that might be a bit tricky to set up.
By default, Prokka will use Barnapp to predict ribosomal RNA genes in genomes. It does come with some caveats. The more accurate alternative is to use RNAmmer which has an academic license to use it. Amazingly, the software is quite old and installing it can be quite tricky for newcomers like me even though there is already guide out there: https://blog.karinlag.no.
In this post, I will share my experience setting up RNAmmer to use in Prokka.
Installing Prokka
As most of other bioinformatics program, use Linux based environment to avoid unnecessary hassle. I work mostly with Conda to manage my packages, and I recommend installing Mamba for a faster deployment.
Before we begin, you should move to where you want to keep these softwares in your system. Then, the first thing we do is to create a conda environment.
conda create --name prokka
conda activate prokka
mamba install -c conda-forge -c bioconda -c defaults prokka
Installing HMMER 2.3.2
RNAmmer requires HMMER 2.3.2, but Prokka will use a more recent version of HMMER. Therefore, we need to install HMMER 2.3.2 separately. You can find previous version of HMMER in http://hmmer.org.
mamba install -c bioconda perl-xml-simple
wget http://eddylab.org/software/hmmer/hmmer-2.3.2.tar.gz
tar -xf hmmer-2.3.2.tar.gz
cd hmmer-2.3.2
./configure
make
Installing RNAmmer
Downloading the Source
Unlike other open source software available in conda, RNAmmer have an academic license for use. Therefore, to get the source, we need to fill this form here
After you fill the form, the download link and license will be sent to your email. It look something like: https://services.healthtech.dtu.dk/download/abe87345-77de-4556-9a22-3d1c4e56b5a9
. If you open the link, there will be two files that can be downloaded
cd ..
mkdir rnammer-1.2 && cd rnammer-1.2
wget https://services.healthtech.dtu.dk/download/{your-hash}/rnammer-1.2.src.tar.gz
wget https://services.healthtech.dtu.dk/download/{your-hash}/rnammer-1.2_license.txt
tar -xf rnammer-1.2.src.tar.gz
Tweaking Path Variables
To make the software work, we need to tweak some PATH variables to find (1) where RNAmmer is located, (2) where is HMMER-2.3.2, and (3) where is perl.
Find your variable locations:
pwd
# /home/matinnu/prokka/rnammer-1.2
(cd ../hmmer-2.3.2/src && ls -d $PWD/hmmsearch)
# /home/matinnu/prokka/hmmer-2.3.2/src/hmmsearch
ls $CONDA_PREFIX/bin/perl
# /home/matinnu/anaconda3/envs/prokka/bin/perl
uname
# Linux
This will give the value for these variables:
$INSTALL_PATH
:/home/matinnu/prokka/rnammer-1.2
$HMMSEARCH_BINARY
:/home/matinnu/prokka/hmmer-2.3.2
$PERL
:/home/matinnu/anaconda3/envs/prokka/bin/perl
And make sure the output of uname
is Linux.
Now, you want to open the file called rnammer
, and go to line 35 to make change from this:
# the path of the program
my $INSTALL_PATH = "/usr/cbs/bio/src/rnammer-1.2";
to this:
# the path of the program
my $INSTALL_PATH = "/home/matinnu/prokka/rnammer-1.2";
Then go on to change line 50-51 and 53-54, from these:
if ( $uname eq "Linux" ) {
$HMMSEARCH_BINARY = "/usr/cbs/bio/bin/linux64/hmmsearch";
$PERL = "/usr/bin/perl";
} elsif ( $uname eq "IRIX64" ) {
$HMMSEARCH_BINARY = "/usr/cbs/bio/bin/irix64/hmmsearch";
$PERL = "/usr/sbin/perl";
to these:
if ( $uname eq "Linux" ) {
$HMMSEARCH_BINARY = "/home/matinnu/prokka/hmmer-2.3.2/src/hmmsearch";
$PERL = "/home/matinnu/anaconda3/envs/prokka/bin/perl";
} elsif ( $uname eq "IRIX64" ) {
$HMMSEARCH_BINARY = "/home/matinnu/prokka/hmmer-2.3.2/src/hmmsearch";
$PERL = "/home/matinnu/anaconda3/envs/prokka/bin/perl";
Cleaning up Errors
Now, if you run this command:
perl rnammer -S bac -m lsu,ssu,tsu -gff - example/ecoli.fsa
You’ll probably got this error message:
FATAL: POSIX threads support is not compiled into HMMER; --cpu doesn't have any effect
To fix that, open the file core-rnammer
and remove –cpu 1
(not the whole sentence, just “–cpu 1”) from line 114 and 187.
From these:
system sprintf('%s --cpu 1 --compat %s %s "%s" > "%s.hmmsearchresult"',$CONFIG{hmmsearch},join(' ',@OPTIONS),$CONFIG{spottermodel},$fname,$fname);
To these:
system sprintf('%s --compat %s %s "%s" > "%s.hmmsearchresult"',$CONFIG{hmmsearch},join(' ',@OPTIONS),$CONFIG{spottermodel},$fname,$fname);
Now, if you run this command again:
perl rnammer -S bac -m lsu,ssu,tsu -gff - example/ecoli.fsa
You should get this output:
##gff-version2
##source-version RNAmmer-1.2
##date 2022-01-03
##Type DNA
# seqname source feature start end score +/- frame attribute
# ---------------------------------------------------------------------------------------------------------
ecoli_section RNAmmer-1.2 rRNA 18068 20969 3754.0 + . 23s_rRNA
ecoli_section RNAmmer-1.2 rRNA 21067 21181 86.3 + . 5s_rRNA
ecoli_section RNAmmer-1.2 rRNA 16177 17706 1950.6 + . 16s_rRNA
# ---------------------------------------------------------------------------------------------------------
Install RNAmmer to the Conda Environment Path
A simple trick would be to create a symlink to the conda environment where we have installed Prokka.
ln -s $PWD/rnammer $CONDA_PREFIX/bin/rnammer
You can check if RNAmmer is working through conda by running the test:
rnammer -S bac -m lsu,ssu,tsu -gff - example/ecoli.fsa
Hope you find it running!