0

我正在尝试使用以下 Perl 代码连接到 Ensembl API:

    #!/bin/perl

    use Bio::EnsEMBL::Registry;
    use DBI qw(:sql_types);


    my $registry = 'Bio::EnsEMBL::Registry';

    $registry->load_registry_from_db(
        -host => 'ensembldb.ensembl.org', # alternatively 'useastdb.ensembl.org'
        -user => 'anonymous'
    );

    my @db_adaptors = @{ $registry->get_all_DBAdaptors() };

    foreach my $db_adaptor (@db_adaptors) {
        my $db_connection = $db_adaptor->dbc();

        printf(
            "species/group\t%s/%s\ndatabase\t%s\nhost:port\t%s:%s\n\n",
            $db_adaptor->species(),   $db_adaptor->group(),
            $db_connection->dbname(), $db_connection->host(),
            $db_connection->port()
        );
    }

Bioperl 和 CPAN 都是使用 Ensembl API 所必需的,我很确定它们已正确安装在我的 Ubuntu 上。我还将所需的模块添加到 PERL5LIB 环境变量中。尽管如此,我还是收到以下错误消息:

    Bareword "SQL_INTEGER" not allowed while "strict subs" in use at /home/src/ensembl/modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm line 299.
    Compilation failed in require at /home/src/ensembl/modules/Bio/EnsEMBL/DBSQL/BaseFeatureAdaptor.pm line 45.
    BEGIN failed--compilation aborted at /home/src/ensembl/modules/Bio/EnsEMBL/DBSQL/BaseFeatureAdaptor.pm line 45.
    Compilation failed in require at /home/src/ensembl/modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm line 60.
    BEGIN failed--compilation aborted at /home/src/ensembl/modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm line 60.
    Compilation failed in require at /home/src/ensembl/modules/Bio/EnsEMBL/Registry.pm line 127.
    BEGIN failed--compilation aborted at /home/src/ensembl/modules/Bio/EnsEMBL/Registry.pm line 127.

这是脚本用于连接 Ensembl 数据库的注册表文件:

    Bio::EnsEMBL::Registry->load_registry_from_db(
        -host    => 'ensembldb.ensembl.org',
        -user    => 'anonymous',
        -verbose => '1'
    );

    use strict;
    use Bio::EnsEMBL::Utils::ConfigRegistry;
    use Bio::EnsEMBL::DBSQL::DBAdaptor;


    new Bio::EnsEMBL::DBSQL::DBAdaptor(
        -host    => 'ensembldb.ensembl.org',
        -user    => 'anonymous',
        -port    => '3306',
        -species => 'homo_sapiens',
        -group   => 'core',
        -dbname  => 'homo_sapiens_core_70_37'
    );

    my @aliases = ( 'H_Sapiens', 'Homo sapiens', 'human' );

    Bio::EnsEMBL::Utils::ConfigRegistry->add_alias(
        -species => 'homo_sapiens',
        -alias   => \@aliases
    );
    1
4

1 回答 1

0

文件 /home/src/ensembl/modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm 是否有第use DBI qw(:sql_types);299 行之前的行?不?也许你有旧版本的 Bio::EnsEMBL::DBSQL::BaseAdaptor。

也许您的 DBI 不是应有的样子。什么perldoc -l DBI说的是DBI的位置?这是对的吗?你是如何安装 DBI 的?您不只是复制“.pm”文件,对吗?

于 2013-10-24T18:31:00.203 回答