无法在Mac OS X上安装bioperl

时间:2022-02-27 10:39:36

I'm trying to get biotools working on my Mac so that I can run some Perl5 code that uses Bio::DB::Sam, but am stymied.

我正在尝试让生物工具在我的Mac上工作,这样我就可以运行一些使用Bio: DB::Sam的Perl5代码,但是受到了阻碍。

  • Mac OS X 10.10.4

    Mac OS X 10.10.4

  • perl 5.18.2

    perl 5.18.2

  • upgraded CPAN as per INSTALL instructions

    根据安装说明升级CPAN

  • 'brew install expat' tells me that expat-2.1.0_1 is already installed

    “brew install expat”告诉我,expat-2.1.0_1已经安装

  • 'sudo perl -MCPAN -e shell'

    'sudo perl -MCPAN -e shell'

  • 'install CJFIELDS/BioPerl-1.6.924.tar.gz'

    “安装CJFIELDS / BioPerl-1.6.924.tar.gz”

  • 'Do you want to run the Bio::DB::GFF or Bio::DB::SeqFeature::Store live database tests?' => 'n'

    您是否想运行Bio::DB::GFF或Bio::DB::SeqFeature::存储实时数据库测试?' = > ' n '

  • Install all

    安装所有

  • 'Do you want to run tests that require connection to servers across the internet' => 'n'

    '您想要运行需要连接到internet上的服务器的测试' => 'n'吗'

Eventually get (with some lines deleted):

最终得到(删除一些行):

Running Build test
t/Align/AlignStats.t ................... ok     
t/Align/AlignUtil.t .................... ok     
t/Align/Graphics.t ..................... skipped: The optional module GD (or dependencies thereof) was not installed
...
t/AlignIO/msf.t ........................ ok   
t/AlignIO/nexml.t ...................... skipped: The optional module Bio::Phylo (or dependencies thereof) was not installed
t/AlignIO/nexus.t ...................... ok     
...
t/Assembly/ContigSpectrum.t ............ ok       
t/Assembly/IO/bowtie.t ................. skipped: The optional module Bio::DB::Sam (or dependencies thereof) was not installed
t/Assembly/IO/sam.t .................... skipped: The optional module Bio::DB::Sam (or dependencies thereof) was not installed
t/Assembly/core.t ...................... ok       
t/Cluster/UniGene.t .................... ok   

Afterwards, I test with:

后来,我测试:

perl -e "use Bio::DB::Sam;"

and get:

并获得:

Can't locate Bio/DB/Sam.pm in @INC (you may need to install the Bio::DB::Sam module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

I get the same results when cloning bioperl-live from GitHub (sync'd to revision 73c446c69a77) and trying to install that way.

当我从GitHub克隆bioperl-live(同步到修订73c446c69a77)并尝试以这种方式安装时,我得到了同样的结果。

Note that I have installed samtools 0.1.18 (to match the version on our cluster) by:

注意,我已经安装了samtools 0.1.18(以匹配我们集群上的版本):

  • downloading the .tar.gz

    下载gz

  • running 'make'

    运行“使”

  • copying 'samtools', 'bcftools/bcftools', and 'misc/*.pl' to ~/debarcer-packages/bin, which is on my path

    复制“samtools”、“bcftools/bcftools”和“misc/*”。在我的路径上

Afterward, I get this:

后来,我试着这样做:

$ which samtools
/Users/gvwilson/debarcer-packages/bin/samtools

This build did not produce a '.so' file, even though there is a rule in the samtools-0.1.18 Makefile that looks like it (maybe?) ought to produce one.

这个建筑没有产生a '。因此,' file,即使samtools-0.1.18 Makefile中有一条规则(可能?)应该生成一个。

2 个解决方案

#1


2  

You need to install an additional (optional) module to use samtools. That's the The optional module Bio::DB::Sam message is about. You don't need it for the rest of BioPerl, so it's not a hard dependency.

您需要安装一个额外的(可选的)模块来使用samtools。这是可选的模块Bio::DB::Sam消息是关于。BioPerl的其余部分不需要它,所以它不是一个硬依赖项。

For Bio::DB::Sam, you need samtools-0.1.17 (the latest version the module works with according to its docs). I downloaded the source and ran make. There were some warnings, but it appears to work. From your question, I don't think you had a problem here.

对于Bio:::DB::Sam,您需要samtools-0.1.17(根据它的文档,该模块使用的最新版本)。我下载了源代码并运行。虽然有一些警告,但似乎是有效的。从你的问题来看,我不认为你有什么问题。

I then installed Bio::DB::Sam:

然后我安装生物:DB:山姆:

 $ cpan Bio::DB::Sam

There were some compiler warnings, but the module passed its tests and installed. The cpan command took care of dependencies too, so it also installed BioPerl for me.

有一些编译器警告,但是模块通过了测试并安装了。cpan命令也处理依赖项,所以它也为我安装了BioPerl。

If you need some environment variables, you can set them for a one-off run of the command:

如果您需要一些环境变量,可以将它们设置为一次性运行命令:

$ CFLAGS=... SAMTOOLS=... cpan Bio::DB::Sam

Note that installing Bio::DB::Sam prompted me for the location of samtools. I pointed it at the build directory:

注意,安装Bio::DB::Sam提示我输入samtools的位置。我将它指向构建目录:

$ cpan5.22.0 Bio::DB::Sam
Running install for module 'Bio::DB::Sam'
Configuring L/LD/LDS/Bio-SamTools-1.43.tar.gz with Build.PL
This module requires samtools 0.1.10 or higher (samtools.sourceforge.net).
Please enter the location of the bam.h and compiled libbam.a files: /Users/brian/Downloads/samtools-0.1.17

I'm betting there's not something complicated like the answer SES gave. You just need an optional module. The README for Bio::DB::Sam notes some problems that people might have and offers so workarounds, but I didn't run into these problems and my setup is close to yours.

我打赌没有什么比SES给出的答案更复杂的了。您只需要一个可选模块。简介:::DB::Sam指出了人们可能遇到的一些问题,并提供了一些解决方案,但是我没有遇到这些问题,我的设置与您的很接近。

Note that Alien::SamTools is a Perl package that installs the non-Perl samtools, but it says it installs 0.1.19. Maybe that works too, but that's not what Bio::DB::Sam says on the tin.

注意Alien: SamTools是一个安装非Perl SamTools的Perl包,但是它说安装的是0.1.19。也许这也行得通,但这不是Bio: DB: Sam在罐头上说的。

#2


2  

The module Bio::DB::Sam provides bindings to an older version of samtools that did not rely htslib. This is an important point because you may run into issues using SAM/BAM files generated with samtools or other aligners because most tools use htslib these days.

模块Bio:::DB::Sam为不依赖htslib的旧版本samtools提供绑定。这一点很重要,因为您可能会在使用samtools或其他对齐器生成的SAM/BAM文件时遇到问题,因为现在大多数工具都使用htslib。

For building the module, you are on the right track with the version you are using but it is difficult to build if you do not know the correct flags. I previously provided a solution to do this and I'll show a better way here (just use a package manager for the Perl module).

对于构建模块,您使用的版本是正确的,但是如果不知道正确的标志,则很难构建。我之前提供了一个解决方案,我将在这里展示一种更好的方法(只需为Perl模块使用包管理器)。

wget http://sourceforge.net/projects/samtools/files/samtools/0.1.18/samtools-0.1.18.tar.bz2
tar xjf samtools-0.1.18.tar.bz2 && cd samtools-0.1.18
make CFLAGS=-fPIC
export SAMTOOLS=`pwd`

The last command will allow you to install the Perl module without looking for the PATH to samtools and being prompted for it. Note, the extra CFLAGS argument may not be needed on your Mac, so try without it first. It is required on Linux, and since the module uses so much memory you will likely only be using this on a Linux machine. Now, install the Perl module.

最后一个命令将允许您安装Perl模块,而无需查找samtools的路径并提示它。注意,额外的CFLAGS参数在你的Mac上可能不需要,所以先尝试不使用它。这在Linux上是必需的,而且由于该模块使用了大量内存,所以您可能只会在Linux机器上使用它。现在,安装Perl模块。

cpanm Bio::DB::Sam

or cpan if you prefer. That should get you a working Bio::DB::Sam. I don't know what you are trying to do but I will mention that the fine folks over at EBI have developed bindings to htslib called Bio::DB::HTS based on Lincoln Stein's XS code in the Bio::DB::Sam module. This is really what you should be using because the version of SAMtools mentioned above is really old and not being developed. That is my opinion and a word of caution though, nothing wrong with Bio::DB::Sam.

或者cpan,如果你喜欢的话。那应该会给你带来一个工作履历::::山姆。我不知道您想要做什么,但是我要提到的是EBI的优秀人员已经开发了一个名为Bio::DB::HTS的绑定,基于Lincoln Stein的XS代码在Bio::::Sam模块。这正是您应该使用的,因为上面提到的SAMtools的版本非常旧,而且还没有开发。这是我的观点,但我还是要小心一点,Bio:::::Sam。

edit:

编辑:

You find it easier to manage Perl without using the "system" Perl, and here is one solution. Other people may have their preferred method, but perlbrew (combined with cpanminus) will make this type of work fun and much less of a pain (and they are popular choices). That would be my first step: set up perlbrew, install Perl 5.22, then install cpanminus. That might sound challenging but it is just a few commands. Something along the lines of:

您发现在不使用“系统”Perl的情况下更容易管理Perl,这里有一个解决方案。其他人可能有他们喜欢的方法,但是perlbrew(与cpan负号结合)将使这种类型的工作更有趣,更少的痛苦(他们是流行的选择)。这将是我的第一步:设置perlbrew,安装Perl 5.22,然后安装cpan负号。这听起来可能很有挑战性,但这只是几个命令而已。一些类似的东西:

curl -L http://install.perlbrew.pl | bash
source ~/perl5/perlbrew/etc/bashrc
perlbrew install perl-5.22.1
perlbrew switch perl-5.22.1
perlbrew install-cpanm

should do the trick. That will give you a kick-ass Perl with some nice features not available with your "system" Perl. This is a good idea because using /usr/bin/perl requires sudo, it involves messing with the system libraries which might cause an issue, and the recent Apple changes mean that working with root directories/libraries is completely unstable.

应该足够了。这将为您提供一个强大的Perl,其中包含您的“系统”Perl所不能提供的一些优秀特性。这是一个好主意,因为使用/usr/bin/perl需要sudo,它涉及到系统库的混乱,这可能导致问题,而且最近的Apple更改意味着使用根目录/库是完全不稳定的。

#1


2  

You need to install an additional (optional) module to use samtools. That's the The optional module Bio::DB::Sam message is about. You don't need it for the rest of BioPerl, so it's not a hard dependency.

您需要安装一个额外的(可选的)模块来使用samtools。这是可选的模块Bio::DB::Sam消息是关于。BioPerl的其余部分不需要它,所以它不是一个硬依赖项。

For Bio::DB::Sam, you need samtools-0.1.17 (the latest version the module works with according to its docs). I downloaded the source and ran make. There were some warnings, but it appears to work. From your question, I don't think you had a problem here.

对于Bio:::DB::Sam,您需要samtools-0.1.17(根据它的文档,该模块使用的最新版本)。我下载了源代码并运行。虽然有一些警告,但似乎是有效的。从你的问题来看,我不认为你有什么问题。

I then installed Bio::DB::Sam:

然后我安装生物:DB:山姆:

 $ cpan Bio::DB::Sam

There were some compiler warnings, but the module passed its tests and installed. The cpan command took care of dependencies too, so it also installed BioPerl for me.

有一些编译器警告,但是模块通过了测试并安装了。cpan命令也处理依赖项,所以它也为我安装了BioPerl。

If you need some environment variables, you can set them for a one-off run of the command:

如果您需要一些环境变量,可以将它们设置为一次性运行命令:

$ CFLAGS=... SAMTOOLS=... cpan Bio::DB::Sam

Note that installing Bio::DB::Sam prompted me for the location of samtools. I pointed it at the build directory:

注意,安装Bio::DB::Sam提示我输入samtools的位置。我将它指向构建目录:

$ cpan5.22.0 Bio::DB::Sam
Running install for module 'Bio::DB::Sam'
Configuring L/LD/LDS/Bio-SamTools-1.43.tar.gz with Build.PL
This module requires samtools 0.1.10 or higher (samtools.sourceforge.net).
Please enter the location of the bam.h and compiled libbam.a files: /Users/brian/Downloads/samtools-0.1.17

I'm betting there's not something complicated like the answer SES gave. You just need an optional module. The README for Bio::DB::Sam notes some problems that people might have and offers so workarounds, but I didn't run into these problems and my setup is close to yours.

我打赌没有什么比SES给出的答案更复杂的了。您只需要一个可选模块。简介:::DB::Sam指出了人们可能遇到的一些问题,并提供了一些解决方案,但是我没有遇到这些问题,我的设置与您的很接近。

Note that Alien::SamTools is a Perl package that installs the non-Perl samtools, but it says it installs 0.1.19. Maybe that works too, but that's not what Bio::DB::Sam says on the tin.

注意Alien: SamTools是一个安装非Perl SamTools的Perl包,但是它说安装的是0.1.19。也许这也行得通,但这不是Bio: DB: Sam在罐头上说的。

#2


2  

The module Bio::DB::Sam provides bindings to an older version of samtools that did not rely htslib. This is an important point because you may run into issues using SAM/BAM files generated with samtools or other aligners because most tools use htslib these days.

模块Bio:::DB::Sam为不依赖htslib的旧版本samtools提供绑定。这一点很重要,因为您可能会在使用samtools或其他对齐器生成的SAM/BAM文件时遇到问题,因为现在大多数工具都使用htslib。

For building the module, you are on the right track with the version you are using but it is difficult to build if you do not know the correct flags. I previously provided a solution to do this and I'll show a better way here (just use a package manager for the Perl module).

对于构建模块,您使用的版本是正确的,但是如果不知道正确的标志,则很难构建。我之前提供了一个解决方案,我将在这里展示一种更好的方法(只需为Perl模块使用包管理器)。

wget http://sourceforge.net/projects/samtools/files/samtools/0.1.18/samtools-0.1.18.tar.bz2
tar xjf samtools-0.1.18.tar.bz2 && cd samtools-0.1.18
make CFLAGS=-fPIC
export SAMTOOLS=`pwd`

The last command will allow you to install the Perl module without looking for the PATH to samtools and being prompted for it. Note, the extra CFLAGS argument may not be needed on your Mac, so try without it first. It is required on Linux, and since the module uses so much memory you will likely only be using this on a Linux machine. Now, install the Perl module.

最后一个命令将允许您安装Perl模块,而无需查找samtools的路径并提示它。注意,额外的CFLAGS参数在你的Mac上可能不需要,所以先尝试不使用它。这在Linux上是必需的,而且由于该模块使用了大量内存,所以您可能只会在Linux机器上使用它。现在,安装Perl模块。

cpanm Bio::DB::Sam

or cpan if you prefer. That should get you a working Bio::DB::Sam. I don't know what you are trying to do but I will mention that the fine folks over at EBI have developed bindings to htslib called Bio::DB::HTS based on Lincoln Stein's XS code in the Bio::DB::Sam module. This is really what you should be using because the version of SAMtools mentioned above is really old and not being developed. That is my opinion and a word of caution though, nothing wrong with Bio::DB::Sam.

或者cpan,如果你喜欢的话。那应该会给你带来一个工作履历::::山姆。我不知道您想要做什么,但是我要提到的是EBI的优秀人员已经开发了一个名为Bio::DB::HTS的绑定,基于Lincoln Stein的XS代码在Bio::::Sam模块。这正是您应该使用的,因为上面提到的SAMtools的版本非常旧,而且还没有开发。这是我的观点,但我还是要小心一点,Bio:::::Sam。

edit:

编辑:

You find it easier to manage Perl without using the "system" Perl, and here is one solution. Other people may have their preferred method, but perlbrew (combined with cpanminus) will make this type of work fun and much less of a pain (and they are popular choices). That would be my first step: set up perlbrew, install Perl 5.22, then install cpanminus. That might sound challenging but it is just a few commands. Something along the lines of:

您发现在不使用“系统”Perl的情况下更容易管理Perl,这里有一个解决方案。其他人可能有他们喜欢的方法,但是perlbrew(与cpan负号结合)将使这种类型的工作更有趣,更少的痛苦(他们是流行的选择)。这将是我的第一步:设置perlbrew,安装Perl 5.22,然后安装cpan负号。这听起来可能很有挑战性,但这只是几个命令而已。一些类似的东西:

curl -L http://install.perlbrew.pl | bash
source ~/perl5/perlbrew/etc/bashrc
perlbrew install perl-5.22.1
perlbrew switch perl-5.22.1
perlbrew install-cpanm

should do the trick. That will give you a kick-ass Perl with some nice features not available with your "system" Perl. This is a good idea because using /usr/bin/perl requires sudo, it involves messing with the system libraries which might cause an issue, and the recent Apple changes mean that working with root directories/libraries is completely unstable.

应该足够了。这将为您提供一个强大的Perl,其中包含您的“系统”Perl所不能提供的一些优秀特性。这是一个好主意,因为使用/usr/bin/perl需要sudo,它涉及到系统库的混乱,这可能导致问题,而且最近的Apple更改意味着使用根目录/库是完全不稳定的。