#
# package Bio::EnsEMBL::Pipeline::Config::ExonerateTranscript
# 
# Cared for by EnsEMBL (ensembl-dev@ebi.ac.uk)
#
# Copyright GRL & EBI
#
# You may distribute this module under the same terms as perl itself

# POD documentation - main docs before the code

=head1 NAME

Bio::EnsEMBL::Pipeline::Config::Affy::Exonerate2Affy

=head1 SYNOPSIS

    use Bio::EnsEMBL::Pipeline::Config::Exonerate2Genes;

=head1 DESCRIPTION

This contains the configuration for step 1 of the 
process which maps Affymetric probes to the Genome.

The layout of the configuration is a set of hashes,
each one keyed by logic name. There is also a DEFAULT hash,
which is used as the default for all logic names (this
was the configuration pattern stolen from Exonerate2Genes,
although in this case it's very unlikely you will need to have
different configs by logic name).

=head1 CONTACT

=cut


package Bio::EnsEMBL::Analysis::Config::CollapseAffyProbes;

use strict;
use vars qw( %Config );

# Hash containing config info
# -- one hashnode per logic name, with a 'DEFAULT' logic name provided
#

%Config = (
  AFFY_CONFIG => {
    DEFAULT => {
      # All input probes must be kept in one huge (possibly redundant) fasta file
      QUERYSEQS            => '/ecs2/work3/vvi/osgb/affy/data/all_probes.fa',
      # The output of this module writes a set of affy probes into the OUTDB.affy_probe table,
      # and also writes the nonredundant probes into this fasta file,
      # with the fasta headers keyed with the affy probes' internal id. 
      NON_REDUNDANT_PROBE_SEQS => '/ecs2/work3/vvi/osgb/affy/data/all_nr_probes.fa',
      # DB containing all affy_arrays, affy_probes and (next step) affy_features
      OUTDB => {
        -dbname => 'vivek_homo_sapiens_test_26_35',
        -host => 'ecs2',
        -port => '3362',
        -user => 'ensadmin',
        -pass => 'xxxxx',
        },
    },
  }
);

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 everything
  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;
