2012年3月11日 星期日

BioPerl

Link1



link2 6steps

The strategy I used to install BioPerl was as follows:

1. Use MacPorts to install Perl.
2. Use CPAN to install BioPerl.

Here are the nitty gritty details. You need a live internet connection, as both MacPorts and CPAN expect to be able to download packages.

Step One: XCode Tools

Before MacPorts can be installed, XCode Tools needs to be installed. This is free from Apple and can be installed from the original OS X 10.6 DVD or downloaded from Apple's developer site.

You can tell that XCode Tools is installed by looking for a Developer directory at the root of your hard drive.

Step Two: MacPorts

I simply downloaded the MacPorts Package Installer from the MacPorts site.

Step Three: Install Perl

sudo port install perl5.12

Step Four: Install GraphViz

This is a prerequisite of BioPerl and the BioPerl build will fail if it is not installed. It will download a ton of prequisites first. After typing the following, get a coffee and a sandwich.

sudo port install graphviz

Step Five: Configure CPAN

CPAN likes to have YAML installed. So:

sudo cpan YAML

At this point cpan will realize it's being run for the first time and ask you some questions like

Would you like me to configure as much as possible automatically? [yes]

Selecting the defaults worked fine.

It's nice to have LWP too.

To install LWP, first get to the cpan command prompt:

sudo cpan

Then install it:

install Bundle::LWP

Step Six: Build BioPerl

To install BioPerl, first get to the cpan command prompt:

sudo cpan

At the command prompt, tell CPAN that you want it to automatically get and install any prerequisites it comes across (this saves you hours of choosing "Yes"):

cpan[1]> o conf prerequisites_policy follow

And now, at the cpan prompt, install BioPerl:

install C/CJ/CJFIELDS/BioPerl-1.6.1.tar.gz

It will stop several times along the way. Except for the following question where my selection was to install all optional external modules, the defaults were fine.

Install [a]ll optional external modules, [n]one, or choose [i]nteractively? [n] a

During the tests that BioPerl runs, I saw the following:

Replacement list is longer than search list at Bio/Range.pm line 251.

According to this post, The above are warnings from perl 5.12 that can be ignored (they have been fixed in bioperl-live on github).

For a quick test of BioPerl, put the following into a file named test.pl:

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");
write_sequence(">roa1.fasta",'fasta',$seq_object);

Then run it:

perl test.pl

and sure enough, a file named roa1.fasta gets written. Yay!

If you are installing BioPerl on a Mac that has multiple user accounts, you'll need to make sure that the following exists in each user's .profile file (at /Users/john/.profile, for example):

# MacPorts Installer addition on 2010-10-04_at_15:32:08: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.

This makes it so that when you type perl the Mac will find and use the Perl from MacPorts instead of the system Perl. Also, be aware of scripts that say #!/usr/bin/perl at the top.

沒有留言: