2 # See the NOTICE file distributed with this work for additional information
3 # regarding copyright ownership.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
19 Please email comments or questions to the Ensembl help desk
31 # ping Ensembl with default species (Human)
34 # ping Ensembl with user provided species
35 $ ping_ensembl.pl -s
"dog"
37 # ping Ensembl with a different version (Human)
38 $ ping_ensembl.pl -db_version 70
40 # ping the US Ensembl mirror
43 # ping Ensembl Genomes with default species (arabidopsis thaliana)
46 # ping Ensembl Genomes with user provided species
47 $ ping_ensembl.pl -eg -s
"oryza sativa japonica"
51 This script is used to detect
if you can contact the Ensembl database
52 server with your current setup. The program will attempt to print out
53 helpful hints
about how to resolve your problems. If they still persist
54 then please contact http:
63 use File::Temp qw/tempfile/;
68 # Default option values
71 my $host =
'ensembldb.ensembl.org';
72 my $user =
'anonymous';
79 my $ensembl_genomes = 0;
84 # Parse command-line arguments
89 "eg" => \$ensembl_genomes,
90 "species=s" => \$species,
91 "db_version=i" => \$db_version,
92 "verbose" => \$verbose,
95 ($help or !$options_ok) &&
usage();
97 $useast and $ensembl_genomes and
98 die
"Cannot test Ensembl Genomes on the US mirror.\n" .
99 "Options \"ue\" and \"eg\" are mutually exclusive\n";
101 $useast and $host =
"useastdb.ensembl.org";
103 $verbose and $verbose = 1;
105 $grch37 and $port = 3337;
107 if ($ensembl_genomes) {
108 $host =
"mysql-eg-publicsql.ebi.ac.uk";
110 $species =
"arabidopsis thaliana"
111 unless defined $species;
120 require Bio::EnsEMBL::LookUp
if $ensembl_genomes;
122 $db_version = $api_version
if $db_version == -1; #
if it was still -1 then it wasn
't set. Default is current API version
123 Bio::EnsEMBL::Registry->load_registry_from_db(
127 -db_version => $db_version,
128 -verbose => $verbose,
130 $species = "human" unless defined $species;
131 my $species_adaptor = Bio::EnsEMBL::Registry->get_DBAdaptor("$species", 'core
');
132 print "Installation is good. Connection to Ensembl works and you can query the $species core database\n";
136 # If no error found then see if we've got all of our external modules available
140 foreach my $module (qw/Compara Variation Funcgen/) {
141 my $full_module =
"Bio::EnsEMBL::${module}::DBSQL::DBAdaptor";
142 eval
"require $full_module;";
144 $error .=
"\tMissing the checkout $module\n";
150 # Check the current release of datafiles from the FTP site
151 my $ftp_version = -1;
153 my $ftp = Net::FTP->new(
'ftp.ensembl.org', Debug => 0);
154 $ftp->login(
"anonymous",
'-anonymous@');
156 my ($fh, $filename) = tempfile();
158 $ftp->get(
'current_README', $filename);
160 open($fh,
'<', $filename);
162 my $ftp_readme = <$fh>;
164 ($ftp_version) = $ftp_readme =~ /Ensembl Release (\d+) Databases/;
167 # Print all the errors which could have occured
169 print
"ERROR: Error detected when connecting to Ensembl!\n";
171 if($error =~ /Can
't connect to MySQL server on /) {
172 print "\tPlease check if your connection with mysql client works fine. \n";
173 } elsif ($error =~ /Cannot connect to/) {
174 print "\tCannot seem to contact EnsemblDB at '$host
' with the username '$user
'. Try running 'ping $host
' or asking your systems about firewalls against port $port\n";
175 } elsif ($error =~ /DBI/) {
176 print "\tCannot find the DBI perl module. Please install this using your package management system, cpan or cpanm. Please consult http://www.ensembl.org/info/docs/api/api_installation.html\n";
178 if($error =~ /mysql/) {
179 print "\tCannot find the DBD::mysql perl module. Please install this using your package management system, cpan or cpanm. Also install the mysql libs. Please consult http://www.ensembl.org/info/docs/api/api_installation.html\n";
181 if($error =~ /Can't locate
Bio\/E/) {
182 print
"\tLooks like you need to setup your PERL5LIB with the Ensembl API. Please consult http://www.ensembl.org/info/docs/api/api_installation.html\n";
184 if($error =~ /Can
't locate Bio\/Perl/) {
185 print "\tLooks like you need to setup your PERL5LIB with BioPerl. Please consult http://www.ensembl.org/info/docs/api/api_installation.html\n";
188 if($error =~ /internal name/) {
189 print "\tSpecies was not found. You may have accidentally download the HEAD API version (found API release $db_version & public FTP release is $ftp_version). Please consult http://www.ensembl.org/info/docs/api/api_installation.html\n";
191 if($error =~ /Species not defined/) {
192 print "\tSpecies was not found. You may have accidentally download the HEAD API version (told to load release $db_version, API version is $api_version & public FTP release is $ftp_version). Please consult http://www.ensembl.org/info/docs/api/api_installation.html\n";
194 if($error =~ /Missing the checkout/) {
195 print "\tYour core installation was good but supplementary modules cannot be found. If you wish to access these other Ensembl resources add the libraries to your PERL5LIB:\n";
201 print "If the problem persists please send the following error message to helpdesk\@ensembl.org\n";
213 Description : Print script usage string
220 my $prog = `basename $0`; chomp($prog);
222 print "Usage: $prog [OPTIONS]\n\n";
224 print " -ue Ping Ensembl US mirror\n";
225 print " -eg Ping Ensembl Genomes (can't be used together with \
"ue\")\n";
226 print
" -species <species> Use species <species> (use double quotes if species name contains spaces)\n";
227 print
" -db_version <version> Use the specified version of Ensembl not the API version\n";
228 print
" -grch37 Use human assembly GRCh37 rather than the default GRCh38 version\n";
229 print
" -verbose Ping output is more verbose. Not recommended for Ensembl genomes\n";
230 print
" -help Print this message\n";