Installing Bioperl for Unix

From DrugPedia: A Wikipedia for Drug discovery

Revision as of 10:16, 8 September 2008 by Harinder (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Contents

[edit] BIOPERL INSTALLATION

Bioperl has been installed on many forms of Unix, Win9X/NT/2000/XP, and on Mac OS X (see the PLATFORMS file for more details). Following are instructions for installing Bioperl for Unix/Linux/Mac OS X; Windows installation instructions can be found here. For installing Bioperl for Mac OS X using Fink, see Getting BioPerl via fink and on Fedora via yum, see Getting BioPerl via Fedora

[edit] SYSTEM REQUIREMENTS

  • Perl 5.6.1 or later; version 5.8 or greater is recommended.
  • External modules: Bioperl uses functionality provided in other Perl modules. Some of these are included in the standard perl package but some need to be obtained from the CPAN site. The list of external modules is given here.

[edit] OPTIONAL

[edit] ADDITIONAL INSTALLATION INFORMATION

[edit] THE BIOPERL BUNDLE

Users of previous versions of Bioperl may remember Bundle::BioPerl. You no longer need to install Bundle::BioPerl. Instead, the normal installation process will ask you if you'd like to install the optional external module dependencies of BioPerl.

A full list of BioPerl dependencies can be found here.

[edit] PRELIMINARY PREPARATION

This is optional, but regardless of your subsequent choice of installation method, it will help to carry out the following steps. They will increase the likelyhood of installation success (especially of optional dependencies).

  • Upgrade CPAN:
>perl -MCPAN -e shell
cpan>install Bundle::CPAN
cpan>q
  • Install/upgrade Module::Build, and make it your preferred installer:
>cpan
cpan>install Module::Build
cpan>o conf prefer_installer MB
cpan>o conf commit
cpan>q
  • Install the expat and libgd libraries by whatever method is appropriate for your system. If you install libgd in a non-standard location, that is fine: when installing the perl module that needs it you will be asked where you installed it.
  • If your expat library is installed in a non-standard location, tell CPAN about it:
>cpan
cpan>o conf makepl_arg "EXPATLIBPATH=/non-standard/lib EXPATINCPATH=/non-standard/include"
cpan>o conf commit

[edit] INSTALLING BIOPERL THE EASY WAY USING CPAN

You can use the CPAN shell to install Bioperl. For example:

>perl -MCPAN -e shell

Or you might have the cpan alias installed:

>cpan

Then find the name of the Bioperl version you want:

cpan>d /bioperl/
CPAN: Storable loaded ok
Going to read /home/bosborne/.cpan/Metadata
Database was generated on Mon, 20 Nov 2006 05:24:36 GMT
Distribution B/BI/BIRNEY/bioperl-1.2.tar.gz
Distribution B/BI/BIRNEY/bioperl-1.4.tar.gz

(only stable versions appear in that list; alternatively you may know the name of an unstable version you want)

Now install:

cpan>install S/SE/SENDU/bioperl-1.5.2_102.tar.gz

If you've installed everything perfectly and all the network connections are working then you may pass all the tests run in the './Build test' phase. It's also possible that you may fail some tests. Possible explanations: problems with local Perl installation, network problems, previously undetected bug in Bioperl, flawed test script, problems with CGI script used for sequence retrieval at public database, and so on. Remember that there are over 800 modules in Bioperl and the test suite is running more than 12000 individual tests, a few failed tests may not affect your usage of Bioperl.

If you decide that the failed tests will not affect how you intend to use Bioperl and you'd like to install anyway do:

cpan>force install S/SE/SENDU/bioperl-1.5.2_102.tar.gz

This is what most experienced Bioperl users would do. However, if you're concerned about a failed test and need assistance or advice then contact [email protected].

[edit] INSTALLING BIOPERL THE EASY WAY USING 'Build.PL'

The advantage of this approach is it's stepwise, so it's easy to stop and analyze in case of any problem.

Download, then unpack the appropriate package. For example:

>gunzip bioperl-1.5.2_102.tar.gz
>tar xvf bioperl-1.5.2_102.tar
>cd bioperl-1.5.2_102

Now issue the build commands:

>perl Build.PL
>./Build test

If you've installed everything perfectly and all the network connections are working then you may pass all the tests run in the './Build test' phase. It's also possible that you may fail some tests. Possible explanations: problems with local Perl installation, network problems, previously undetected bug in Bioperl, flawed test script, problems with CGI script using for sequence retrieval at public database, and so on. Remember that there are over 800 modules in Bioperl and the test suite is running more than 12000 individual tests, a few failed tests may not affect your usage of Bioperl.

If you decide that the failed tests will not affect how you intend to use Bioperl and you'd like to install anyway, or if all tests were fine, do:

>./Build install

This is what most experienced Bioperl users would do. However, if you're concerned about a failed test and need assistance or advice then contact [email protected].

To './Build install' you need write permission in the perl5/site_perl/source area (or similar, depending on your environment). Usually this will require you becoming root, so you will want to talk to your systems manager if you don't have the necessary privileges.

It is also straightforward to install the package outside of the this standard Perl5 location. See INSTALLING BIOPERL IN A PERSONAL MODULE AREA, below.

[edit] WHERE ARE THE MAN PAGES?

When using Makefile.PL (no longer covered in this documentation), we had to disable the automatic creation of man pages because this step was triggering a "line too long" error on some OSs due to shell constraints. If you want man pages installed use the Build.PL installation process discussed above.

[edit] EXTERNAL PROGRAMS

Bioperl can interface with some external programs for executing analyses. These include clustalw and t_coffee for Multiple Sequence Alignment (Template:PM and Template:PM) and blastall, blastpgp, and bl2seq for BLAST analyses (Template:PM), and to all the programs in the EMBOSS suite (Template:PM).

[edit] Environment Variables

Some modules which run external programs need certain environment variables set. If you do not have a local copy of the specific executable you do not need to set these variables. Additionally the modules will attempt to locate the specific applications in your runtime PATH variable. You may also need to set an environment variable to tell BioPerl about your network configuration if your site uses a firewall.

Setting environment variables on unix means adding lines like the following to your shell *rc file.

For bash or sh:

export BLASTDIR=/data1/blast

For csh or tcsh:

setenv BLASTDIR /data1/blast

Some environment variables include:

Env. Variable Description
BLASTDIR Specifies where the NCBI blastall, blastpgp, bl2seq, etc.. are located. A 'data' directory could also be present in this directory as well, you could put your blastable databases here.
BLASTDATADIR or BLASTDB If one does not want to locate the data dir within the same dir as where the BLASTDIR variable points, a BLASTDATADIR or BLASTDB variable can be set to point to a dir where BLAST database indexes are located.
BLASTMAT The directory containing the substitution matrices such as BLOSUM62.
CLUSTALDIR The directory where the clustalw executable is located.
TCOFFEEDIR The directory where the t_coffee executable is located.
http_proxy If you access the internet via a proxy server then you can tell the Bioperl modules which require network access about this by using the http_proxy environment variable. The value set includes the proxy address and port, with optional username/password for authenticating proxies. e.g. http://USERNAME:[email protected]:8080

[edit] INSTALLING BIOPERL SCRIPTS

Bioperl comes with a set of production-quality scripts that are kept in the scripts/ directory. You can install these scripts if you'd like: simply answer the questions during 'perl Build.PL'. The installation directory can be specified by

perl Build.PL
./Build install --install_path script=/foo/scripts

By default they install to /usr/bin or similar, depending on platform.

[edit] INSTALLING BIOPERL IN A PERSONAL MODULE AREA

If you lack permission to install perl modules into the standard site_perl/ system area you can configure Bioperl to install itself anywhere you choose. Ideally this would be a personal perl directory or standard place where you plan to put all your 'local' or personal perl modules.

Simply pass a parameter to perl as it builds your system specific makefile.

Example:

>perl Build.PL --prefix /home/users/dag
>./Build test
>./Build install

This tells perl to install all the various parts of bioperl in the desired place, e.g. creating:

  /home/users/dag/lib/perl5/Bio/Perl.pm

Then in your Bioperl script you would write:

use lib "/home/users/dag/lib/perl5/";
use Bio::Perl;

For more information on these sorts of custom installs see the documentation for Module::Build.

Also, see Module::Build::Cookbook documentation for installing in the same location as ExtUtils::MakeMaker

You can also use CPAN to install modules in your local directory. First enter the CPAN shell, then set the arguments for the commands "perl Makefile.PL" and "./Build install", like this:

>perl -e shell -MCPAN
cpan>o conf makepl_arg PREFIX=/home/users/dag/My_Local_Perl_Modules
cpan>o conf mbuildpl_arg "--prefix /home/users/dag/My_Local_Perl_Modules"
cpan>o conf commit

If you have problems starting a CPAN shell, you likely need to set up a local MyConfig.pm file. This article describes how to do this, though you will need to modify the PERL5LIB for your perl version and configuration (32- vs 64-bit, for instance). Further notes can also be found in the 'Configuration' section of the Template:CPAN POD.

[edit] INSTALLING BIOPERL MODULES THE HARD WAY

As a last resort, you can simply copy all files in Bio/ to any directory in which you have write privileges. This is generally NOT recommended since some modules may require special configuration (currently none do, but don't rely on this).

You will need to set "use lib '/path/to/my/bioperl/modules';" in your perl scripts so that you can access these modules if they are not installed in the standard site_perl/ location. See above for an example.

To get manpage documentation to work correctly you will have to configure man so that it looks in the proper directory. On most systems this will just involve adding an additional directory to your $MANPATH environment variable.

The installation of the Compile directory can be similarly redirected, but execute the make commands from the Compile/SW directory.

If all else fails or are unable to access the perl distribution directories, ask your system administrator to place the files there for you. You can always execute perl scripts in the same directory as the location of the modules (Bio/ in the distribution) since perl always checks the current working directory when looking for modules.

[edit] USING MODULES NOT INSTALLED IN THE STANDARD LOCATION

You can explicitly tell perl where to look for modules by using the Template:CPAN module which comes standard with Perl.

Example:

#!/usr/bin/perl
use lib "/home/users/dag/My_Local_Perl_Modules/";
use Bio::Perl;
# <...insert whizzy perl code here...>

Or, you can set the environmental variable PERL5LIB:

csh or tcsh:

setenv PERL5LIB /home/users/dag/My_Local_Perl_Modules/

bash or sh:

export PERL5LIB=/home/users/dag/My_Local_Perl_Modules/

[edit] THE TEST SYSTEM

The Bioperl test system is located in the t/ directory and is automatically run whenever you execute the './Build test' command (having previously run 'Perl Build.PL'; if you have already installed Bioperl answer 'no' to script installation to get nicer test output later). Alternatively if you want to investigate the behavior of a specific test such as the Seq test you would type:

>./Build test --test_files t/Seq.t --verbose

The ./ ensures you are using the Build script in the current directory to make sure you are testing the modules in this directory not ones installed elsewhere. The --test_files arguement can be used multiple times to try a set of test scripts in one go. The --verbose arguement outputs the detailed test results, instead of just the summary you see during './Build test'.

If you are trying to learn how to use a module, often the test suite is a good place to look. All good extreme programmers try and write a test BEFORE they write the module to insure that their module behaves the way they expect. You'll notice some 'ok' and 'skip' commands in a test, this is part of the Perl test suite that signifies a passed test with an 'ok N', where N is the test number. Alternatively you can tell Perl to skip tests. This is useful when, for example, your test detects that the network is not present and thus should skip, not fail, any tests that require a network connection.

[edit] BUILDING THE OPTIONAL bioperl-ext PACKAGE

The bioperl-ext package contains C code and XS extensions for various alignment and trace file modules (Template:PM for DNA Smith-Waterman, Template:PM for protein Smith-Waterman, Template:PM for EVD fitting of extreme value, Template:PM).

This Installation works out-of-the box for all platforms except BSD and Solaris boxes. For other platforms skip this next paragraph.

[edit] CONFIGURING for BSD and Solaris boxes

You should add the line -fPIC to the CFLAGS line in Compile/SW/libs/makefile. This makes the compile generate position independent code, which is required for these architectures. In addition, on some Solaris boxes, the generated Makefile does not make the correct -fPIC/-fpic flags for the C compiler that is used. This requires manual editing of the generated Makefile to switch case. Try it out once, and if you get errors, try editing the -fpic line

[edit] INSTALLATION

Move to the directory bioperl-ext. This Ext package is available as a separate package released from ftp://bioperl.org/pub/bioperl/DIST. This is where the C code and XS extension for the bp_sw module is held and execute these commands: (possibly after making the change for BSD and Solaris, as detailed above)

perl Makefile.PL   # makes the system specific makefile  
make          # builds all the libaries
make test     # runs a short test
make install  # installs the package correctly.

This should install the compiled extension. The Template:PM module will work cleanly now.