安装 perl 模块时出现问题 Bio::Perl

Issues installing perl module Bio::Perl

我在从克隆的 git 存储库安装 Bio-DB-HTS (https://github.com/Ensembl/Bio-DB-HTS) 到 运行 perl 脚本时遇到一些问题。

系统和 Perl 信息

我正在使用 Mac OSx High Sierra v.10.13.6 并使用 perl 5,版本 18,subversion 2 (v5.18.2)。我现在已经在我原来的问题中添加了这些信息。

背景资料

当尝试执行本地安装时,根据 README 说明,我收到错误...

git clone https://github.com/Ensembl/Bio-DB-HTS.git
cd Bio-DB-HTS-2.10
perl INSTALL.pl

lzma.h library header not found in /usr/include 

我尝试安装 LZMA 库,但发现它确实已安装,只是路径 /usr/include 中缺少 lzma.h header 文件。由于 LZMA 已被弃用并被 XZ 取代,我安装了 XZ 库

 brew install xz

快速搜索后,我在...lzma.h header 中找到了

/usr/local/Cellar/xz/5.2.4/include/lzma.h

主要问题

现在这是我不确定如何继续的地方,如果我在尝试解决这个问题时搞砸了一些东西。由于 /usr/include 有一个访问受限的目录,我在 INSTALL.pl 脚本中添加了一行来检查文件在两个位置是否存在(这可能会破坏分析中的下游内容,因为我没有更改任何内容else except the if condition. 但是, 运行 这次在安装的时候 运行 遇到了新的问题。

perl INSTALL.pl

BioPerl does not seem to be installed. Please install it and try again. 
On Debian/Ubuntu systems you can do this with the command:

apt-get install bioperl

On other systems use the CPAN shell:

perl -MCPAN -e 'install Bio::Perl'

这就是我的主要问题所在。当尝试使用 cpan 安装 Bio:Perl 时,测试在各个阶段都失败了,我不确定哪些是必要的。输出的最后一行是

Result: FAIL
Failed 3/325 test programs. 16/19945 subtests failed.
CJFIELDS/BioPerl-1.007002.tar.gz
./Build test -- NOT OK
//hint// to see the cpan-testers results for installing this module, 
try:
reports CJFIELDS/BioPerl-1.007002.tar.gz
Running Build install
make test had returned bad status, won't install without force

我重新配置了 cpan 以按照此处所述自动安装依赖项 How do I tell CPAN to install all dependencies?

perl -MCPAN -Mlocal::lib=~/perl5 -e 'my $c = "CPAN::HandleConfig"; $c->load(doit => 1, autoconfig => 1); $c->edit(prerequisites_policy => "follow"); $c->edit(build_requires_install_policy => "yes"); $c->commit'

并尝试再次强制安装...

perl -f -MCPAN -e 'install Bio::Perl'

但是我得到了同样的错误

Result: FAIL
Failed 3/325 test programs. 16/19945 subtests failed.
CJFIELDS/BioPerl-1.007002.tar.gz
./Build test -- NOT OK
//hint// to see the cpan-testers results for installing this module, 
try:
reports CJFIELDS/BioPerl-1.007002.tar.gz
Running Build install
make test had returned bad status, won't install without force

当我查看已安装的模块时...

cpan -l 
Bio::DB::HTS    2.11
Bio::DB::HTS::ReadIterator  2.11
Bio::DB::HTS::VCF   2.11
Bio::DB::HTS::Faidx 2.11
Bio::DB::HTS::PileupWrapper 2.11
Bio::DB::HTS::Alignment 2.11
Bio::DB::HTS::ConfigData    undef
.
.
.
Bio::DB::HTS::VCF::Iterator 2.11
Bio::DB::HTS::VCF::Row  2.11

我可以看到 Bio-DB-HTS 包中我需要的很多东西都在那里(假设它们是安装 Bio::Perl 时成功的安装之一)但现在提示错误

Can't locate Bio/SeqFeature/Lite.pm in @INC

但是,我从来没有设法真正安装 Bio:Seq 或 Bio::Perl。我确实有一些 perl 知识,但主要是在 python 上工作,所以我对如何继续感到有点迷茫。

额外信息

我的 cpan 安装模块到

/usr/local/perl 

并且我已将路径添加到我的环境变量

export PERL5LIB=/usr/local/perl

编辑信息(失败的测试和错误)作为对 Shawn

的回应

@Shawn,一长串错误、测试失败和推荐安装。我可以 post 前几个错误的一些例子。我也不太确定该看什么。

推荐安装

Checking prerequisites...
recommends:
*  Algorithm::Munkres is not installed
*  Array::Compare is not installed
*  Bio::Phylo is not installed
*  Convert::Binary::C is not installed
*  GD is not installed
*  Graph is not installed
*  GraphViz is not installed
*  HTML::TableExtract is not installed
*  Inline::C (0.53) is installed, but we prefer to have 0.67
*  PostScript::TextBlock is not installed
*  SVG is not installed
*  SVG::Graph is not installed
*  Set::Scalar is not installed
*  Sort::Naturally is not installed
*  Spreadsheet::ParseExcel is not installed
*  XML::DOM is not installed
*  XML::DOM::XPath is not installed
*  XML::Parser::PerlSAX is not installed
*  XML::SAX::Writer is not installed
*  XML::Twig is not installed
*  YAML is not installed


Checking optional features...
EntrezGene............disabled
requires:
! Bio::ASN1::EntrezGene is not installed
MySQL Tests...........disabled
requires:
! DBD::mysql is not installed
Pg Tests..............disabled
requires:
! DBD::Pg is not installed

这是测试总结报告。我没有打印整个失败测试列表,因为它非常长。但是我可以看到 /LocalDB/SeqFeature_BDB.t 是查看详细输出时大多数失败测试的一部分。

Test Summary Report
-------------------
t/LocalDB/Fasta.t                    (Wstat: 1024 Tests: 109 Failed: 4)
Failed tests:  73, 91, 95, 101
Non-zero exit status: 4
t/LocalDB/Index/Index.t              (Wstat: 20224 Tests: 36 Failed: 6)
Failed tests:  12-17
Non-zero exit status: 79
Parse errors: Bad plan.  You planned 73 tests but ran 36.
t/LocalDB/Qual.t                     (Wstat: 1536 Tests: 56 Failed: 6)
Failed tests:  7-9, 49-50, 52
Non-zero exit status: 6
t/LocalDB/SeqFeature_BDB.t           (Wstat: 0 Tests: 38 Failed: 4)
Failed tests:  17-19, 24
Parse errors: Bad plan.  You planned 116 tests but ran 38.
t/Perl.t                             (Wstat: 512 Tests: 47 Failed: 16)
Failed tests:  28, 28, 28, 28-29, 29, 29, 29-30, 30, 30
            30-31, 31, 31, 31
Non-zero exit status: 2
Parse errors: Tests out of sequence.  Found (24) but expected (26)
            Tests out of sequence.  Found (25) but expected (27)
            Tests out of sequence.  Found (26) but expected (28)
            Tests out of sequence.  Found (26) but expected (29)
            Tests out of sequence.  Found (27) but expected (30)
Displayed the first 5 of 23 TAP syntax errors.
Re-run prove with the -p option to see them all.
t/RemoteDB/BioFetch.t                (Wstat: 0 Tests: 83 Failed: 47)
Failed tests:  20-21, 21-22, 22-23, 23-24, 24-25, 25-26
            26-27, 27-28, 28-29, 29-30, 30, 30, 30-31
            31, 31, 31-32, 32, 32, 32-33, 33, 33, 33-34
            34, 34, 34-35, 35, 35, 35-36, 36, 36, 36
Parse errors: Tests out of sequence.  Found (4) but expected (6)
            Tests out of sequence.  Found (6) but expected (7)
            Tests out of sequence.  Found (7) but expected (8)
            Tests out of sequence.  Found (5) but expected (9)
            Tests out of sequence.  Found (6) but expected (10)
Displayed the first 5 of 79 TAP syntax errors.
Re-run prove with the -p option to see them all.
t/RemoteDB/GenBank.t                 (Wstat: 0 Tests: 658 Failed: 614)
Failed tests:  10-11, 11, 11-12, 12, 12-13, 13, 13-14
            14, 14-15, 15, 15-16, 16, 16-17, 17, 17-18
            18, 18-19, 19, 19, 19, 19, 19, 19-20, 20
            20, 20, 20, 20, 20-21, 21, 21, 21, 21, 21
            21-22, 22, 22, 22, 22, 22, 22-23, 23, 23

感谢大家的帮助,我终于弄明白了。我会在这里从头到尾解释这个过程,以防其他人遇到同样的问题。

我发布的问题是解决如何使用 CPAN 安装 Bio::Perl,因为我遇到了测试失败的问题。虽然我在安装 Bio-DB-HTS 时遇到了一些问题(我在发布之前解决了),但我也会解释我是如何设法安装它的,以防有人遇到同样的问题。

Mac 用户似乎对缺少 lzma.h header 存在疑问。在安装Bio-DB-HTS的情况下。我不得不修改 Bio-DB-HTS/INSTALL.pl 文件中检查 lzma.h 文件是否存在的一行。有关说明,请参阅下面的 "Installing Bio-DB-HTS on Mac OSx"。

解决安装Bio::Perl

基本上我通过 reinstalling/reconfiguring 我的 CPAN 安装解决了它。虽然我认为问题最终是由于我没有设置的一些环境变量造成的,因为我选择手动整理我的 CPAN 目录结构,但我建议让 CPAN 使用 local:lib 选项为你做这件事,因为它会设置或告诉你如何在安装结束时设置环境变量。

我只设置了以下环境变量之一 (PERL5LIB),这可能是我出错的原因。笔记!您在下面看到的路径是我的系统特有的。

PATH="/Users/sjamal/perl5/bin${PATH:+:${PATH}}"; export PATH; PERL5LIB="/Users/sjamal/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; PERL_LOCAL_LIB_ROOT="/Users/sjamal/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; PERL_MB_OPT="--install_base \"/Users/sjamal/perl5\""; export PERL_MB_OPT; PERL_MM_OPT="INSTALL_BASE=/Users/sjamal/perl5"; export PERL_MM_OPT;

如果您已经像我一样进行了配置,但是要从头开始,您需要删除在安装 cpan 的用户上创建的 CPAN 文件夹。

/Users/<USERNAME>/.cpan
rm -rf /Users/<USERNAME>/.cpan

现在您应该能够 运行 cpan 命令,就像在第一个实例中完成的那样,系统会提示您提出许多关于如何设置安装的问题,您可以在这里选择 'local:lib'(如果您能够访问 sudo,您也可以选择 'sudo' 选项)。我根据多个建议安装了 cpanm,而且因为它提示的问题明显较少,然后安装了 Bio::Perl。虽然我应该提到安装​​确实没有通过测试并且拒绝安装所以我不得不 运行 force 命令来构建 Bio::Perl.

cpan -i App:cpanminus
cpanm --force Bio::Perl

您现在应该已经安装了 Bio::Perl。

正在 Mac 安装 Bio-DB-HTS OSx

lzma 库已在 Mac OSx 上弃用,但已被 XZ 库替换,因此如果您也缺少该文件,可以使用 brew 安装 XZ。如果你没有安装 brew,你可以在这里找到如何安装它 https://brew.sh/

brew install xz

您现在将在使用 brew 安装 XZ 的位置有一个 lzma.h header 文件,在我的例子中是 /usr/local/Cellar/xz/5.2.4/include/lzma.h。

git clone https://github.com/Ensembl/Bio-DB-HTS.git
cd Bio-DB-HTS-2.10
vim Bio-DB-HTS/INSTALL.pl

所以,我使用 vim...

更改了行
-e '/usr/include/lzma.h' or die <<END; 

-e '/usr/include/lzma.h' **|| '/usr/local/Cellar/xz/5.2.4/include/lzma.h'** or die <<END;

注意!您必须将 '/usr/local/Cellar/xz/5.2.4/include/lzma.h' 路径更改为刚刚使用 brew 安装的 XZ 包中的 lzma.h 路径。但是,我想澄清一下,除了告诉脚本该文件确实存在之外,这并没有解决任何问题。安装脚本将无法使用该文件(如果这是它需要做的),因为安装脚本中没有其他任何更改。

您现在应该可以安装 Bio-DB-HTS 只需 运行 如下所示的 perl 脚本

cd Bio-DB-HTS-2.10
perl INSTALL.pl

希望对您有所帮助!

萨布里