Jan 7, 2016

Using bcl2fastq 1.8.4 on Ubuntu 14.04 LTS

When executing bcl2fastq 1.8.4 on Ubuntu 14.04 LTS, you get the following error messages:

"my" variable $value masks earlier declaration in same statement at .../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment/Config.pm line 760.
syntax error at .../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment/Config.pm line 747, near "$variable qw(ELAND_FASTQ_FILES_PER_PROCESS)"
Global symbol "$variable" requires explicit package name at .../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment/Config.pm line 749.
syntax error at .../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment/Config.pm line 751, near "$directory qw(ELAND_GENOME)"
Global symbol "$self" requires explicit package name at .../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment/Config.pm line 753.
Global symbol "$directory" requires explicit package name at .../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment/Config.pm line 753.
Global symbol "$project" requires explicit package name at .../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment/Config.pm line 753.
Global symbol "$sample" requires explicit package name at .../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment/Config.pm line 753.
Global symbol "$lane" requires explicit package name at .../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment/Config.pm line 753.
Global symbol "$barcode" requires explicit package name at .../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment/Config.pm line 753.
Global symbol "$reference" requires explicit package name at .../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment/Config.pm line 753.
syntax error at .../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment/Config.pm line 761, near "}"
.../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment/Config.pm has too many errors.
Compilation failed in require at .../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment.pm line 61.
BEGIN failed--compilation aborted at .../bcl2fastq_1.8.4/lib/bcl2fastq-1.8.4/perl/Casava/Alignment.pm line 61.
Compilation failed in require at .../bcl2fastq_1.8.4/bin/configureBclToFastq.pl line 250.
BEGIN failed--compilation aborted at .../bcl2fastq_1.8.4/bin/configureBclToFastq.pl line 250.

The reason for the errors is that bcl2fastq is not compatible with the default perl 5.18 of Ubuntu 14.04. You need to install an older perl version to execute the script.

Use the following commands to install, e.g. 5.14, to path/perlbrew/:
cd path/perlbrew/
wget http://install.perlbrew.pl -O install_perlbrew.sh
export PERLBREW_ROOT=path/perlbrew/ && bash install_perlbrew.sh
source ./etc/bashrc
perlbrew install perl-5.14.4
perlbrew switch perl-5.14.4
perlbrew install-cpanm
cpanm XML/Simple.pm

Now you can call the perl version using:
source path/perlbrew/etc/bashrc
path/perlbrew/perls/perl-5.14.4/bin/perl