perl - 安装 perl 模块 Bio::Perl 的问题

标签 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 

我尝试安装 LZMA 库,但发现它实际上已安装,并且路径/usr/include 中根本缺少 lzma.h 头文件。由于 LZMA 已弃用并替换为 XZ 我安装了 XZ 库
 brew install xz

快速搜索后,我在...中找到了 lzma.h header
/usr/local/Cellar/xz/5.2.4/include/lzma.h

主要问题

现在这是我不确定如何进行的地方,如果我在试图解决这个问题时搞砸了一些事情。由于/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'

这就是我的主要问题所在。当尝试使用 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,它有一长串错误、测试失败和推荐的安装。我可以发布前几个错误的一些示例。我也不确定该看什么。

推荐安装
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 文件是否存在的一行。有关说明,请参阅下面的“在 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

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

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

在 Mac OSx 上安装 Bio-DB-HTS

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

现在,您将在使用 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

所以,我用 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 的路径。但是,我想澄清一下,除了告诉脚本文件确实存在之外,这并不能解决任何问题。安装脚本将无法使用该文件(如果这是它需要做的),因为安装脚本中没有任何其他更改。

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

希望有帮助!

萨布里

关于perl - 安装 perl 模块 Bio::Perl 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52468476/

相关文章:

html - Perl解析html后出现未初始化值错误

perl - 如何使用替换矩阵修改 Smith-Waterman 算法以比对 Perl 中的蛋白质?

regex - URL 正则表达式不起作用

regex - 使用 Perl 匹配两个重叠模式

linux - 如何用file2中的相同编号替换file1中的相同编号

perl - 安装 Bio::DB::Sam perl 模块

xml - 安装 XML::DOM::XPath 时出错

regex - 如何使用 perl 的正则表达式迭代多行字符串

linux - 如何找出并控制 Perl 模块在本地存储的位置?

perl - 我如何告诉 WWW::Mechanize 忽略安全 cookie?