, ,

BioPerl is a nice collection of Perl modules designed for bioinformatics analysis. Making a good use of BioPerl can greatly facilitate our research. The current version of BioPerl is 1.6.901. The steps are as follows>>

Rather than using the default Perl from the cluster server, I would like to have Perl installed locally on my SUG@R $HOME directory, which will make the downstream procedures much easier. So this is the first thing I need to do. The installing steps are generally the same as I installed Python 2.7 before (See this post).

1) Under my SUG@R $HOME directory, download the current version of Perl and decompress it. ActivePerl is a good choice and can be downloaded from here.

> tar -xzvf ActivePerl-

A new directory named ActivePerl- will be created now.

2) Enter this directory and run the shell script “./install.sh”. The installation script will prompt you a few questions. The first two questions are about license agreements, the default answer is [no]. We need to answer yes or simply y for proceeding installation. The third question is about the target installation directory. The default directory is [/opt/ActivePerl-5.14], I changed it into “/users/NetID/local/ActivePerl-5.14”. The following two question will be ask you whether want to install HTML documentation and whether want to confirm installation. The default value is [Yes]. So just press enter will be OK. Now, Perl-5.14 is successfully installed under our specified directory.

3) the next step will be set the PATH environment variable to the installation directory’s bin/ subdirectory. Since I want our installed Perl-5.14 to permanently override the default version of Perl on SUG@R, I will just edit the .bash_profile file under my $HOME directory and add the following lines.

# User specific environment and startup programs

4) Just re-login and type “which perl” and see what we’ve got :)

> which perl
> ~/local/ActivePerl-5.14/bin/perl

5) Before installing BioPerl, we need to do some preparation. Let’s upgrade CPAN first.

> perl -MCPAN -e 'install Bundle::CPAN'

6) Then install/upgrade Module::Build, and make it our preferred installer:

> perl -MCPAN -e shell
cpan> install Module::Build
cpan> o conf prefer_installer MB
cpan> o conf commit
cpan> q

7) Install the “expat” library which is essential for processing xml files.

> wget http://sourceforge.net/projects/expat/files/latest/download
> tar -xvzf expat-2.1.0.tar.gz
> cd expat-2.1.0
> ./configure --prefix=/users/NetID/local
> make
> make install

Tell CPAN about our installation path of expat:

> perl -MCPAN -e shell
cpan> o conf makepl_arg "EXPATLIBPATH=/users/NetID/local/lib EXPATINCPATH=/users/NetID/local/include"
cpan> o conf commit
cpan> q

8) Now we are finally ready to install BioPerl using CPAN.Invoke CPAN shell first.

> perl -MCPAN -e shell

Then find the name of the most recent Bioperl version:

cpan> d /bioperl/

Then install the most recent version, for me it is BioPerl-1.6.901.tar.gz.

cpan> install CJFIELDS/BioPerl-1.6.901.tar.gz

Wait after the installation process to finish and exit CPAN shell by typing ‘q’ command.

9) Now BioPerl should already be successfully installed on SUG@R. Let’s write a small script to test it, for example the following one which I found from here.

use Bio::Perl;
# this script will only work if you have an internet connection on the
# computer you're using, the databases you can get sequences from
# are 'swiss', 'genbank', 'genpept', 'embl', and 'refseq'
$seq_object = get_sequence('embl',"AI129902");

Then run it to see if our installed BioPerl really works. If everything is fine, we should see a file named “roa1.fasta” is generated, which includes the header information and nucleotide sequence in FASTA format. Hooray, it works for me!