printSTDERR"I am sorry, I was unable to find the DBI (database interface) for Perl\n";
printSTDERR"You need to install a SQL database and the DBI interface, for example, MySQL\n";
printSTDERR"and MySQL DBI. The DBI interfaces are kept on CPAN (not the MySQL site)\n";
exit(0);
}
printSTDERR"... DBI checks out\n";
#
# See if we can load the bioperl root object and AnnSeq object
# AnnSeq is 0.6 or later...
#
eval{
requireBio::Root::Object;
requireBio::AnnSeq;
};
if($@){
printSTDERR"I am sorry, I was unable to find the bioperl root object\n";
printSTDERR"You need to have a bioperl 0.6 release installed\n";
printSTDERR"You can one from ftp://ftp.sanger.ac.uk/pub/ensembl/software\n";
exit(0);
}
printSTDERR"... bioperl checks out\n";
#
# See if we can load ensembl root object
#
eval{
requireBio::EnsEMBL::DBSQL::Obj;
};
if($@){
printSTDERR"I am sorry, I was unable to load the Ensembl root object\n";
printSTDERR"You might be running this somewhere other than the ensembl software\n";
printSTDERR"distribution, in which case, please make sure your Perl include path has\n";
printSTDERR"ensembl modules in it\n\n";
printSTDERR"Another possibility is that you have an old version of bioperl\n";
printSTDERR"You need to have a bioperl 0.6 release installed\n";
printSTDERR"You can one from ftp://ftp.sanger.ac.uk/pub/ensembl/software\n";
printSTDERR"\n\nActual exception $@\n";
exit(0);
}
printSTDERR"... ensembl checks out\n";
#
# Tell our user that he/she is looking good
#
printSTDERR"The ensembl software looks ready to run!\n\n";
printSTDERR"Looking at your DBI installation. I'll need some details about this to establish a connection\n\n";
printSTDERR"What is the name of the ensembl database [ensdev]\n\n(If you haven't created a database, no worries\nSimply Cntr-C out of this and go\nmysqladmin -u username create ensdev\nYou may need to talk to whoever install mysql to get permissions to create ensdev)\n\nWhat is the name of the ensembl database [ensdev]";
my$db=<STDIN>;
chomp$db;
if($db=~/^\s*$/){
$db='ensdev';
}
#
# Ask whether it is ok to use a MySQL driver?
#
printSTDERR"What username shall I try to connect to the MySQL db [root]?\n";
my$user=<STDIN>;
chomp$user;
if($user=~/^\s*$/){
$user='root';
}
printSTDERR"What password shall I try to connect to the MySQL db []?\n";
my$pass=<STDIN>;
chomp$pass;
if($pass=~/^\s*$/){
$pass=undef;
}
printSTDERR"What host shall I try to connect to the MySQL db [localhost]?\n";
my$host=<STDIN>;
chomp$host;
if($host=~/^\s*$/){
$host='localhost';
}
my$dsn;
my$dbh;
eval{
$dsn="DBI:mysql:database=$db;host=$host;";
$dbh=DBI->connect("$dsn","$user",$pass);
};
if($@||!defined$dbh){
printSTDERR"Well. That did not work. I cannot connect with DBI to the mysql database\n";
printSTDERR"I was using the following connection string [$dsn]\nThe exception thrown was\n$@\n\n";
printSTDERR"I'm afraid you need to debug this before continuing\n";
exit(0);
}
$dbh->disconnect();
$dbh=0;
#
# Find the DNA and table data
#
my$table_file;
if(-e"../data/ensembl.sql"){
$table_file="../data/ensembl.sql";
}
printSTDERR"Can you locate the ensembl.sql file [$table_file]?";
do{
my$fname=<STDIN>;
chomp$fname;
if($fname=~/^\s*$/&&defined$table_file){
last;
}
if(!-e$fname){
printSTDERR"Cannot open $fname\n";
}else{
$table_file=$fname;
}
}while(!defined$table_file);
my$dna_file;
#
# Sanity checks
#
if(!-e"../sql/table.sql"||!-e$table_file){
printSTDERR"Cannot find one of table.seq, dna file or table data file. Sorry.\n\n";
exit(0);
}
#
# Ok. Reinitialise the db?
#
printSTDERR"I am now going to intialize the database.\n";
printSTDERR"and then reload it with new data\n\n";
printSTDERR"This will trash any current data in ensdev\n";
printSTDERR"Please answer yes or no to this reintialisation\n";