# Ensembl module for Bio::EnsEMBL::Analysis::Config::Funcgen::SWEmbl
#
# Copyright (c) 2008 Ensembl
#

=head1 NAME

  Bio::EnsEMBL::Analysis::Config::Funcgen::SWEmbl

=head1 SYNOPSIS

  use Bio::EnsEMBL::Analysis::Config::Funcgen::SWEmbl;
  
  use Bio::EnsEMBL::Analysis::Config::Funcgen::SWEmbl qw(CONFIG);

=head1 DESCRIPTION

This is a module needed to provide configuration for the
SWEmbl RunnableDBs.

CONFIG is an hash of hashes which contains analysis specific
settings and is keyed on logic_name

=head1 LICENCE

This code is distributed under an Apache style licence. Please see
http://www.ensembl.org/info/about/code_licence.html for details.

=head1 AUTHOR

Stefan Graf, Ensembl Functional Genomics - http://www.ensembl.org/

=head1 CONTACT

Post questions to the Ensembl development list: ensembl-dev@ebi.ac.uk

=cut

package Bio::EnsEMBL::Analysis::Config::Funcgen::SWEmbl;
use Bio::EnsEMBL::Funcgen::DBSQL::DBAdaptor;
use strict;
use vars qw(%Config);

%Config = 
    (
     CONFIG => {
         DEFAULT => {
             DNADB => {
                 -dbname => $ENV{'CORE_DBNAME'},
                 -host => $ENV{'CORE_HOST'},
                 -port => $ENV{'CORE_PORT'} || 3306,
                 -species => $ENV{'SPECIES'},
                 -user => $ENV{'CORE_USER'},
             },
             EFGDB => {
                 -dbname => $ENV{'EFG_DBNAME'},
                 -host => $ENV{'EFG_HOST'},
                 -port => $ENV{'EFG_PORT'} || 3306,
                 -species => $ENV{'SPECIES'},
                 -user => $ENV{'EFG_WRITE_USER'},
                 -pass => $ENV{'PASS'},
             },
             MODULE            => 'SWEmbl',
             PROGRAM           => 'SWEmbl',
             PROGRAM_FILE      => 'SWEmbl',
			 	 DISPLAY_LABEL     => 'SWEmbl',
					 #DESCRIPTION       => '';
             VERSION           => '2008-08-03',
             #PARAMETERS        => "-f 150 -m 8 -p 0.04 -P 0.5 -d 70",
             NORM_METHOD       => $ENV{'NORM_METHOD'},
             RESULT_SET_REGEXP => '_IMPORT',
             ANALYSIS_WORK_DIR => "$ENV{ANALYSIS_WORK_DIR}/",
         },
         'SWEmbl_default' => {
             PARAMETERS        => "-f 150 -m 8 -p 0.04 -P 0.5 -d 70",

			          },
     });

sub import {
    my ($callpack) = caller(0); # Name of the calling package
    my $pack = shift; # Need to move package off @_
    
    # Get list of variables supplied, or else all
    my @vars = @_ ? @_ : keys(%Config);
    return unless @vars;
    
    # Predeclare global variables in calling package
    eval "package $callpack; use vars qw("
        . join(' ', map { '$'.$_ } @vars) . ")";
    die $@ if $@;
    
    
    foreach (@vars) {
        if (defined $Config{ $_ }) {
            no strict 'refs';
            # Exporter does a similar job to the following
            # statement, but for function names, not
            # scalar variables:
            *{"${callpack}::$_"} = \$Config{ $_ };
        } else {
            die "Error: Config: $_ not known\n";
        }
    }
}

1;
