# package Bio::EnsEMBL::Analysis::Config::ExonerateTags
#
# Copyright EMBL-EBI/Sanger center 2006
#
# You may distribute this module under the same terms as perl itself
#
# Cared for by EnsEMBL (ensembl-dev@ebi.ac.uk)

# POD documentation - main docs before the code

=head1 NAME

Bio::EnsEMBL::Analysis::Config::Ditag

=head1 SYNOPSIS

    use Bio::EnsEMBL::Analysis::Config::ExonerateTags;

=head1 DESCRIPTION

This contains the configuration for the  alignment of ditag
sequences (dna) against a genome (dna) using exonerate in the
analysis Bio::EnsEMBL::Analysis::Runnable::ExonerateTags.pm.
The ditags are created by CAGE/GIS/GSC experiments.

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.

=head1 CONTACT

=cut

package Bio::EnsEMBL::Analysis::Config::ExonerateTags;
use strict;
use vars qw( %Config );

%Config = (
      DITAG_CONFIG => {

        DEFAULT => {

        ## GENERAL SECTION ##

          #use masked or unmasked genome, e.g. /data/blastdb/Ensembl/Mouse/NCBIM36/genome/toplevel.fa
          GENOMICSEQS         => '',

          #Batchsize: ~1000 for masked, ~500 for unmasked
          BATCHSIZE           => 500,
          MAXDISTANCE         => 600000,
          #max allowed number of repeated bases
          REPEATNUMBER        => 6,
          TMPDIR              => '/tmp',
          PROGRAM             => '/usr/local/ensembl/bin/exonerate-1.0.0',
          #adjust "softmasktarget" to masking choice
          OPTIONS             => " -M 256 --softmasktarget FALSE --showsugar false --showvulgar false --showalignment false --forwardcoordinates true --bestn 100 --ryo \"RESULT: %S %pi %ql %tl %g %V\\n\" --saturatethreshold 100 ",
       },

        ## SPECIFIC DITAG TYPES ##

       EXONERATETAGS => {

       #GSC
	  #regex for the (fasta) header
          IIDREGEXP           => '^>\S{4}(\S+)\|(\S+)\|\S+\|\S+\|\S+\|\S+\|\S+',
	  #additional exonerate options, required!
          SPECOPTIONS         => "--dnahspthreshold 80 --score 80",
	  #does the input seq need to be split into 2 parts?
          SPLITSEQS           => 1,
          #min & max allowed length of the raw ditag sequences
          MINSEQLENGTH        => 34,
          MAXSEQLENGTH        => 40,
	  #number of allowed mismatches
          MAXMISMATCH         => 3,
	  #for split seqs: is the right part really the 5' seq? If they align the other way around they will be filtered out.
          KEEPORDER           => 0,
	  #remove the last X bases
          CHOPLAST            => undef,
	  #remove the first X bases
          CHOPFIRST           => undef,
	  #is there a initial number of hits givem in the header of the tag file that can be parsed out?
	  TAGCOUNT            => 0,
	  #input files with the tag seqs
	  QUERYFILES  => {
		   ZZ11        => 'ditag/tags/archive/GSC/gsc-ZZ11.fa',
		   ZZ12        => 'ditag/tags/archive/GSC/gsc-ZZ12.fa',
		   ZZ13        => 'ditag/tags/archive/GSC/gsc-ZZ13.fa',
		   ZZ14        => 'ditag/tags/archive/GSC/gsc-ZZ14.fa',
          }

        },

      }
);


sub import {
  my ($callpack) = caller(0);
  my $pack = shift;
  my @vars = @_ ? @_ : keys(%Config);
  return unless @vars;
  eval "package $callpack; use vars qw(".
       join(' ', map { '$'.$_ } @vars) . ")";
  die $@ if $@;
  foreach (@vars) {
    if (defined $Config{ $_ }) {
      no strict 'refs';
      *{"${callpack}::$_"} = \$Config{ $_ };
    }else {
      die "Error: Config: $_ not known\n";
    }
  }
}

1;
