バイオインフォマティクス初心者の日常

バイオインフォマティクス関連の研究・勉強などなど

cpanmを利用したperlモジュールインストール

perlのモジュールインストールに関するメモ

perlでは非常に多くのモジュール(プログラムの部品)が作られてきており、それらはCPANからダウンロードすることができます。
CPAN : Comprehensive Perl Archive Network

ただし、他人が作ったプログラムを使うには、ある程度perlの知識(オブジェクト指向とか)が必要になるので、ある程度perlの理解が進んでからCPANで公開されているモジュールを見たり、利用するといいと思います。
バイオインフォマティクスの世界では、"BioPerl" という解析パッケージが有名で、自分もBioPerlのいくつかの機能を研究用プログラムに組み込むことがあります。

perlのモジュールインストールには、"cpanm" というプログラムを利用するのがモダンなスタイルでおすすめなようです。下記の参考サイトにcpanmのインストール方法や詳しい解説が書いてあります。
参考サイト: perlモジュールのinstallにcpanmを使う

cpanmでBioPerlをインストール

cpanmを利用してBioPerlをインストールする際には、

$ cpanm BioPerl

というコマンドを実行することで、cpanmのデフォルト設定ではホームディレクトリ内にBioPerlモジュールがローカルインストールされます。

またルートディレクトリ下にインストールしたい場合には、

$ cpanm --sudo BioPerl

上記のように--sudoのオプション付きでコマンドを実行し、実行中にパスワードを入力することでルートディレクトリにインストールされます。

cpanmは下記のように色々オプション設定があるので、これから利用しながら使い方をちゃんと覚えていかないとなー

Options:
  -v,--verbose              Turns on chatty output
  -q,--quiet                Turns off the most output
  --interactive             Turns on interactive configure (required for Task:: modules)
  -f,--force                force install
  -n,--notest               Do not run unit tests
  --test-only               Run tests only, do not install
  -S,--sudo                 sudo to run install commands
  --installdeps             Only install dependencies
  --showdeps                Only display direct dependencies
  --reinstall               Reinstall the distribution even if you already have the latest version installed
  --mirror                  Specify the base URL for the mirror (e.g. http://cpan.cpantesters.org/)
  --mirror-only             Use the mirror's index file instead of the CPAN Meta DB
  --prompt                  Prompt when configure/build/test fails
  -l,--local-lib            Specify the install base to install modules
  -L,--local-lib-contained  Specify the install base to install all non-core modules
  --self-contained          Install all non-core modules, even if they're already installed.
  --auto-cleanup            Number of days that cpanm's work directories expire in. Defaults to 7

Commands:
  --self-upgrade            upgrades itself
  --info                    Displays distribution info on CPAN
  --look                    Opens the distribution with your SHELL
  -U,--uninstall            Uninstalls the modules (EXPERIMENTAL)
  -V,--version              Displays software version