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

S.J*_*mal 5 perl bioperl

我在安装 Bio-DB-HTS ( https://github.com/Ensembl/Bio-DB-HTS ) 时遇到一些问题,需要从克隆的 git 存储库运行 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 
Run Code Online (Sandbox Code Playgroud)

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

 brew install xz
Run Code Online (Sandbox Code Playgroud)

经过快速搜索后,我发现了 lzma.h 标头......

/usr/local/Cellar/xz/5.2.4/include/lzma.h
Run Code Online (Sandbox Code Playgroud)

主要问题

现在,我不确定如何继续,以及我在尝试解决这个问题时是否搞砸了一些事情。由于 /usr/include 有一个访问受限的目录,所以我在 INSTALL.pl 脚本中添加了一行来检查两个位置中是否存在该文件(这可能会破坏分析中下游的某些内容,因为除了但是,这次运行安装时遇到了新问题。

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'
Run Code Online (Sandbox Code Playgroud)

这就是我的主要问题所在。当尝试使用 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
Run Code Online (Sandbox Code Playgroud)

我重新配置了 cpan 以自动安装依赖项,如此处所述How do I告诉 CPAN 安装所有依赖项?

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'
Run Code Online (Sandbox Code Playgroud)

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

perl -f -MCPAN -e 'install Bio::Perl'
Run Code Online (Sandbox Code Playgroud)

但我只是得到同样的错误

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
Run Code Online (Sandbox Code Playgroud)

当我查看已使用哪些模块安装时...

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
Run Code Online (Sandbox Code Playgroud)

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

Can't locate Bio/SeqFeature/Lite.pm in @INC
Run Code Online (Sandbox Code Playgroud)

然而,我从未真正安装过 Bio:Seq 或 Bio::Perl。我确实有一些 Perl 知识,但主要是在 Python 上工作,所以我感觉有点不知道如何继续。

额外的信息

我的 cpan 安装模块

/usr/local/perl 
Run Code Online (Sandbox Code Playgroud)

我已经将路径添加到我的环境变量中

export PERL5LIB=/usr/local/perl
Run Code Online (Sandbox Code Playgroud)

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

@Shawn,这是一长串错误、测试失败和推荐安装的列表。我可以发布前几个错误的一些示例。我也不知道该看什么。

推荐安装

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
Run Code Online (Sandbox Code Playgroud)

这是测试总结报告。我没有打印失败测试的完整列表,因为它非常长。但在查看详细输出时,我可以看到 /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
Run Code Online (Sandbox Code Playgroud)

S.J*_*mal 2

感谢所有提供帮助的人,我最终成功解决了这个问题。我将从头到尾解释这个过程,以防其他人遇到同样的问题。

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

Mac 用户似乎经常遇到缺少 lzma.h 标头的问题。安装Bio-DB-HTS时。我必须修改 Bio-DB-HTS/INSTALL.pl 文件中检查 lzma.h 文件是否存在的一行。有关说明,请参阅下面的“在 Mac OSx 上安装 Bio-DB-HTS”。

解决 Bio::Perl 安装问题

本质上,我通过重新安装/重新配置我的 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
Run Code Online (Sandbox Code Playgroud)

现在,您应该能够像第一次一样运行 cpan 命令,并收到许多有关如何设置安装的问题的提示,您可以在此处选择“local:lib”(如果您能够访问 sudo,您也可以选择“sudo”选项)。我根据多个建议安装了 cpanm,而且因为它显然提示的问题较少,然后安装了 Bio::Perl。尽管我应该提到安装​​确实未通过测试并拒绝安装,所以我必须运行强制命令来构建 Bio::Perl。

cpan -i App:cpanminus
cpanm --force Bio::Perl
Run Code Online (Sandbox Code Playgroud)

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

在 Mac OSx 上安装 Bio-DB-HTS

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

brew install xz
Run Code Online (Sandbox Code Playgroud)

现在,您将在使用brew安装XZ的位置有一个lzma.h头文件,在我的例子中是/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
Run Code Online (Sandbox Code Playgroud)

所以,我使用 vim 更改了行...

-e '/usr/include/lzma.h' or die <<END; 
Run Code Online (Sandbox Code Playgroud)

-e '/usr/include/lzma.h' **|| '/usr/local/Cellar/xz/5.2.4/include/lzma.h'** or die <<END;
Run Code Online (Sandbox Code Playgroud)

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

您现在应该能够通过简单地运行 perl 脚本来安装 Bio-DB-HTS,如下所示

cd Bio-DB-HTS-2.10
perl INSTALL.pl
Run Code Online (Sandbox Code Playgroud)

希望有帮助!

萨布里