我正在尝试使用以下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
答案 0 :(得分:0)
文件/home/src/ensembl/modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm在第299行之前是否有行use DBI qw(:sql_types);
?没有?也许您有旧版本的Bio :: EnsEMBL :: DBSQL :: BaseAdaptor。
也许你的DBI不是它应该是的。 perldoc -l DBI
说的是DBI的位置?这是对的吗?你是如何安装DBI的?你不只是复制“.pm”文件,是吗?