# Ensembl module for Bio::EnsEMBL::Analysis::Config::Funcgen::TileMap
#
# Copyright (c) 2007 Ensembl
#

=head1 NAME

  Bio::EnsEMBL::Analysis::Config::Funcgen::TileMap

=head1 SYNOPSIS

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

=head1 DESCRIPTION

This is a module needed to provide configuration for the
TileMap 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::TileMap;

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            => 'TileMap',
             PROGRAM           => 'TileMap',
             PROGRAM_FILE      => 'tilemap',
             VERSION           => '1.0',
             TEMPLATE_FILE 
                 => "$ENV{HOME}/src/tilemap/readme/NCMLS_TileMap_arg.txt",
             NORM_METHOD       => $ENV{NORM_METHOD}, 
             RESULT_SET_REGEXP => 'BR._TR.', 
             ANALYSIS_WORK_DIR => $ENV{'ANALYSIS_WORK_DIR'},
         },
#         TileMap_g0100_p95 => {
#             # Method to combine neighboring probes (0:HMM, 1:MA)
#             METHOD => 0,
#             # Posterior probability > val (default: 0.5)
#             POSTPROB => 0.95,
#             # Maximal gap allowed (1000: default)
#             MAXGAP => 100,
#             # Expected hybridization length (28: default)
#             HYBLENGTH => 50,
#         },
#         TileMap_g0200_p95 => {
#             # Method to combine neighboring probes (0:HMM, 1:MA)
#             METHOD => 0,
#             # Posterior probability > val (default: 0.5)
#             POSTPROB => 0.95,
#             # Maximal gap allowed (1000: default)
#             MAXGAP => 200,
#             # Expected hybridization length (28: default)
#             HYBLENGTH => 50,
#         },

     });

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;
