X BOL wishing you a very and Happy New year

Alternative content

Installing Perl environment on Linux

By using plenv, you can easily install and switch among different version of Perl. This will be installed under your home directory in~/.plenv.

Install latest Perl (with supporting multithreading) and CPANMinus.

 $ cd
 $ git clone git://github.com/tokuhirom/plenv.git ~/.plenv
 $ git clone git://github.com/tokuhirom/Perl-Build.git ~/.plenv/plugins/perl-build/
 $ echo 'export PATH="$HOME/.plenv/bin:$PATH"' >> ~/.bashrc
 $ echo 'eval "$(plenv init -)"' >> ~/.bashrc
 $ source ~/.bashrc
 $ plenv install 5.18.1 -Dusethreads
 $ plenv rehash
 $ plenv global 5.18.1
 $ plenv install-cpanm
  • git is a distributed revision control and source code management software which can help you to download files from GitHub server.
  • echo means "print".
  • >> means adding the output into the end of the file, while > means adding the output by overwriting the whole file. Please use> with additional cares.
  • In Linux system, there are two types of outputs when you execute a command. One is called standard output (or sometimes STDOUT for short), and the other is a standard error (STDERR). 1> is for STDOUT only, 2> is for STDERR only, and &>means for both. In default > is the same to 1>.
  • exec is execution.
  • Remember to install Perl in supporting multithreading (with option -Dusethreads), which is important for many NGS analysis packages (e.g. Trinity). In this setting, you can use multiple CPU for Perl software.
  • Install the CPAN (Comprehensive Perl Archive Network) manager software, CPANMinus, by install-cpanm.

You can use plenv global and plenv local to change the different version of Perl to fulfil different needs of your Perl software.

For example, if the specific version of Perl is not compatible with your script, you can switch to the different version by:

 $ plenv local 
  • It is similar to set the local version of your script language when you use pyenv and rbenv as the following.

Put the following path into ~/.bashrc file.

export PERL5LIB="$HOME/.plenv/build/perl-5.18.1/lib"

Install BioPerl and PerlIO::gzip

CPANMinus is a very good Perl module manager, use cpanm to install BioPerl can save you a lot of time. Here are some useful modules:

$ cpanm Bio::Perl
$ cpanm Bio::SearchIO
$ cpanm PerlIO::gzip

For more information, please visit: https://github.com/tokuhirom/plenv

 

Comments

  • Jit 2358 days ago
    curl -L http://cpanmin.us | perl - --sudo App::cpanminus

    The above is installing the "zero configuration CPAN modules installer" called cpanm. (Can take several minutes to install - don't break the process)

    and after - simply:

    cpanm Foo
    cpanm Module::One
    cpanm Another::Module
  • Jit 2358 days ago

    If Conda is installed 

     

    ➜ parallelLastz git:(master) ✗ conda create -n myLocalPerl perl perl-app-cpanminus
    Solving environment: done

    ## Package Plan ##

    environment location: /home/urbe/anaconda3/envs/myLocalPerl

    added / updated specs:
    - perl
    - perl-app-cpanminus


    The following packages will be downloaded:

    package | build
    ---------------------------|-----------------
    perl-threaded-5.22.0 | 10 11.2 MB bioconda
    perl-app-cpanminus-1.7039 | 2 220 KB bioconda
    ------------------------------------------------------------
    Total: 11.4 MB

    The following NEW packages will be INSTALLED:

    libgcc: 7.2.0-h69d50b8_2
    libgcc-ng: 7.2.0-hdf63c60_3
    libstdcxx-ng: 7.2.0-hdf63c60_3
    perl: 5.26.2-h470a237_0 conda-forge
    perl-app-cpanminus: 1.7039-2 bioconda
    perl-threaded: 5.22.0-10 bioconda

    Proceed ([y]/n)? Y


    Downloading and Extracting Packages
    perl-threaded-5.22.0 | 11.2 MB | ############################################### | 100%
    perl-app-cpanminus-1 | 220 KB | ############################################### | 100%
    Preparing transaction: done
    Verifying transaction: done
    Executing transaction: done
    #
    # To activate this environment, use:
    # > source activate myLocalPerl
    #
    # To deactivate an active environment, use:
    # > source deactivate
    #

    ➜ parallelLastz git:(master) ✗ source activate myLocalPerl
    (myLocalPerl) ➜ parallelLastz git:(master) ✗ cpanm Parallel::ForkManager
    --> Working on Parallel::ForkManager
    Fetching http://www.cpan.org/authors/id/Y/YA/YANICK/Parallel-ForkManager-1.19.tar.gz ... OK
    Configuring Parallel-ForkManager-1.19 ... OK
    ==> Found dependencies: Test::Warn
    --> Working on Test::Warn
    Fetching http://www.cpan.org/authors/id/B/BI/BIGJ/Test-Warn-0.36.tar.gz ... OK
    Configuring Test-Warn-0.36 ... OK
    ==> Found dependencies: Sub::Uplevel
    --> Working on Sub::Uplevel
    Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/Sub-Uplevel-0.2800.tar.gz ... OK
    Configuring Sub-Uplevel-0.2800 ... OK
    Building and testing Sub-Uplevel-0.2800 ... OK
    Successfully installed Sub-Uplevel-0.2800
    Building and testing Test-Warn-0.36 ... OK
    Successfully installed Test-Warn-0.36
    Building and testing Parallel-ForkManager-1.19 ... OK
    Successfully installed Parallel-ForkManager-1.19
    3 distributions installed
    (myLocalPerl) ➜ parallelLastz git:(master) ✗ perl parallelLastz.pl
    Can't locate Bio/SeqIO.pm in @INC (you may need to install the Bio::SeqIO module) (@INC contains: /home/urbe/perl5 /home/urbe/anaconda3/envs/myLocalPerl/lib/site_perl/5.26.2/x86_64-linux-thread-multi /home/urbe/anaconda3/envs/myLocalPerl/lib/site_perl/5.26.2 /home/urbe/anaconda3/envs/myLocalPerl/lib/5.26.2/x86_64-linux-thread-multi /home/urbe/anaconda3/envs/myLocalPerl/lib/5.26.2 .) at parallelLastz.pl line 10.
    BEGIN failed--compilation aborted at parallelLastz.pl line 10.
    (myLocalPerl) ➜ parallelLastz git:(master) ✗ cpanm Bio::SeqIO
    --> Working on Bio::SeqIO
    Fetching http://www.cpan.org/authors/id/C/CJ/CJFIELDS/BioPerl-1.007002.tar.gz ... OK
    ==> Found dependencies: Module::Build
    --> Working on Module::Build
    Fetching http://www.cpan.org/authors/id/L/LE/LEONT/Module-Build-0.4224.tar.gz ... OK
    Configuring Module-Build-0.4224 ... OK
    Building Module-Build-0.4224 ... OK
    Successfully installed Module-Build-0.4224
    Configuring BioPerl-1.007002 ... OK
    ==> Found dependencies: Data::Stag, URI::Escape, IO::String, Test::Most
    --> Working on Data::Stag
    Fetching http://www.cpan.org/authors/id/C/CM/CMUNGALL/Data-Stag-0.14.tar.gz ... OK
    Configuring Data-Stag-0.14 ... OK
    ==> Found dependencies: IO::String
    --> Working on IO::String
    Fetching http://www.cpan.org/authors/id/G/GA/GAAS/IO-String-1.08.tar.gz ... OK
    Configuring IO-String-1.08 ... OK
    Building and testing IO-String-1.08 ... OK
    Successfully installed IO-String-1.08
    Building and testing Data-Stag-0.14 ... OK
    Successfully installed Data-Stag-0.14
    --> Working on URI::Escape
    Fetching http://www.cpan.org/authors/id/E/ET/ETHER/URI-1.74.tar.gz ... OK
    Configuring URI-1.74 ... OK
    ==> Found dependencies: Test::Needs
    --> Working on Test::Needs
    Fetching http://www.cpan.org/authors/id/H/HA/HAARG/Test-Needs-0.002005.tar.gz ... OK
    Configuring Test-Needs-0.002005 ... OK
    Building and testing Test-Needs-0.002005 ... OK
    Successfully installed Test-Needs-0.002005
    Building and testing URI-1.74 ... OK
    Successfully installed URI-1.74
    --> Working on Test::Most
    Fetching http://www.cpan.org/authors/id/O/OV/OVID/Test-Most-0.35.tar.gz ... OK
    Configuring Test-Most-0.35 ... OK
    ==> Found dependencies: Test::Deep, Exception::Class, Test::Exception, Test::Differences
    --> Working on Test::Deep
    Fetching http://www.cpan.org/authors/id/R/RJ/RJBS/Test-Deep-1.128.tar.gz ... OK
    Configuring Test-Deep-1.128 ... OK
    Building and testing Test-Deep-1.128 ... OK
    Successfully installed Test-Deep-1.128
    --> Working on Exception::Class
    Fetching http://www.cpan.org/authors/id/D/DR/DROLSKY/Exception-Class-1.44.tar.gz ... OK
    Configuring Exception-Class-1.44 ... OK
    ==> Found dependencies: Devel::StackTrace, Class::Data::Inheritable
    --> Working on Devel::StackTrace
    Fetching http://www.cpan.org/authors/id/D/DR/DROLSKY/Devel-StackTrace-2.03.tar.gz ... OK
    Configuring Devel-StackTrace-2.03 ... OK
    Building and testing Devel-StackTrace-2.03 ... OK
    Successfully installed Devel-StackTrace-2.03
    --> Working on Class::Data::Inheritable
    Fetching http://www.cpan.org/authors/id/T/TM/TMTM/Class-Data-Inheritable-0.08.tar.gz ... OK
    Configuring Class-Data-Inheritable-0.08 ... OK
    Building and testing Class-Data-Inheritable-0.08 ... OK
    Successfully installed Class-Data-Inheritable-0.08
    Building and testing Exception-Class-1.44 ... OK
    Successfully installed Exception-Class-1.44
    --> Working on Test::Exception
    Fetching http://www.cpan.org/authors/id/E/EX/EXODIST/Test-Exception-0.43.tar.gz ... OK
    Configuring Test-Exception-0.43 ... OK
    Building and testing Test-Exception-0.43 ... OK
    Successfully installed Test-Exception-0.43
    --> Working on Test::Differences
    Fetching http://www.cpan.org/authors/id/D/DC/DCANTRELL/Test-Differences-0.64.tar.gz ... OK
    Configuring Test-Differences-0.64 ... OK
    ==> Found dependencies: Capture::Tiny, Text::Diff
    --> Working on Capture::Tiny
    Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/Capture-Tiny-0.48.tar.gz ... OK
    Configuring Capture-Tiny-0.48 ... OK
    Building and testing Capture-Tiny-0.48 ... OK
    Successfully installed Capture-Tiny-0.48
    --> Working on Text::Diff
    Fetching http://www.cpan.org/authors/id/N/NE/NEILB/Text-Diff-1.45.tar.gz ... OK
    Configuring Text-Diff-1.45 ... OK
    ==> Found dependencies: Algorithm::Diff
    --> Working on Algorithm::Diff
    Fetching http://www.cpan.org/authors/id/T/TY/TYEMQ/Algorithm-Diff-1.1903.tar.gz ... OK
    Configuring Algorithm-Diff-1.1903 ... OK
    Building and testing Algorithm-Diff-1.1903 ... OK
    Successfully installed Algorithm-Diff-1.1903
    Building and testing Text-Diff-1.45 ... OK
    Successfully installed Text-Diff-1.45
    Building and testing Test-Differences-0.64 ... OK
    Successfully installed Test-Differences-0.64
    Building and testing Test-Most-0.35 ... OK
    Successfully installed Test-Most-0.35
    Building and testing BioPerl-1.007002 ... OK
    Successfully installed BioPerl-1.007002
    16 distributions installed

  • Jit 2358 days ago

    You migth need to install this 

     sudo conda install -c bioconda perl-app-cpanminus