#
# 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 2 of the 
process which maps Affymetric probes to the Genome. This step
is an alignment of probes (dna) against a genome (dna)
using exonerate. So this config looks very similar to that
of any other exonerate-driving config.

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::AlignAffyProbes;

use strict;
use vars qw( %Config );

%Config = (
  AFFY_CONFIG => {
    DEFAULT => {

      # path to softmasked, dusted sequence on the farm 
      # 
      
      GENOMICSEQS         => '/data/blastdb/Ensembl/Human/NCBI35/softmasked_dusted/', #allowed to be a dir.
      QUERYTYPE           => 'dna',

      # must be a single file containing all (non-redundant) probes indexed by affy_probe_id
      # QUERYSEQS refers to the value of the parameter NON_REDUNDANT_PROBE_SEQS
      # in the config-file ensembl-analysis/Config/CollapseAffyProbes.pm

      QUERYSEQS           => '/ecs2/work3/vvi/osgb/affy/data/all_nr_probes.fa',

      # must supply one, since the queryseqs MUST be a single file 
      IIDREGEXP           => '(\d+):(\d+)',
      DNADB => {
        -dbname => 'vivek_homo_sapiens_test_26_35',
        -host => 'ecs2',
        -port => '3362',
        -user => 'ensadmin',
        -pass => 'ensembl',
        },
      OUTDB => {
        -dbname => 'vivek_homo_sapiens_test_26_35',
        -host => 'ecs2',
        -port => '3362',
        -user => 'ensadmin',
        -pass => 'xxxxx',
        },
      OPTIONS             => ' --bestn 100 --dnahspthreshold 116 --fsmmemory 256 --dnawordlen 25 --dnawordthreshold 11 ',

      # if the number of hits reaches or exceeds the figure below, we reject 
      # all hits to that probe
      HIT_SATURATION_LEVEL => 100,
    },
  }
);

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;
