# Cared for by Ensembl
#
# 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::Analysis::Config::GeneBuild::BestTargetted

=head1 SYNOPSIS

    Bio::EnsEMBL::Analysis::Config::GeneBuild::BestTargetted ; 
    Bio::EnsEMBL::Analysis::Config::GeneBuild::BestTargetted qw () ; 

=head1 DESCRIPTION


BestTargetted-Configuration 

This is the configuration file for BestTargetted, a perl module which 
takes two sets of genes from different Targetted runs and generates a 
new set containing the best genes from the two input sets.

BestTargetted fetches the gene sets by analysis, the logic names are defined
in this configuration file. Pairs of overlapping genes are compared and
where different structures have been built from the same evidence the 
translations are compared. The protein index file which was used in 
the targetted run should be specified in this configuraion along with 
the path to the seqfetcher object.

If neither translation gives the same sequence as the evidence it was 
built from, Exonerate is used to assign a score to the alignment of
each translation to the evidence. The Exonerate program can be 
specified below othewise the default will be take from 
 - modules/Bio/EnsEMBL/Analysis/Runnable/BaseExonerate.pm
 
The parameters to connect to the databases are defined in 
  - Bio/EnsEMBL/Analysis/Config/GeneBuild/Databases.pm 
If no OUT_DB_NAME is given the output will be written to DB_NAME.

The general function of this config file is to import  a number of 
standard global variables into the calling package. Without arguments 
all the standard variables are set, and with a list, only those variables 
whose names are provided are set.  The module will die if a variable 
which doesn\'t appear in its C<%Config> hash is asked to be set.

The variables can also be references to arrays or hashes.

Edit C<%Config> to add or alter variables.

All the variables are in capitals, so that they resemble environment
variables.




=head1 CONTACT

B<ensembl-dev@ebi.ac.uk>

=cut

package Bio::EnsEMBL::Analysis::Config::GeneBuild::BestTargetted;

use strict;
use vars qw(%Config);


%Config= 
 (
  BEST_TARGETTED_CONFIG => {
  
    DEFAULT => {
  
      VERBOSE => 1 , 

      # If you list more than 2 biotypes (below), and only one biotype builds  
      # a transcript from a particular protein at a particuar position, do
      # you want to keep this transcript or throw is away? Can you trust it? 
      # Set KEEP_SINGLE_ANALYSIS to 1 if you want to keep the transcript.
      KEEP_SINGLE_ANALYSIS => 1,

      # Location of your protein index (fasta file of all proteins)
      SEQFETCHER_DIR => '/data/blastdb/Ensembl/Human/human_proteins_Jan07/protein_index',

      # You need an earlier version of BioPerl for this
      SEQFETCHER_OBJECT =>  'Bio::EnsEMBL::Pipeline::SeqFetcher::OBDAIndexSeqFetcher',

      # add the logic names of your targetted genes here. 
      # Note that you'll have to add to your protein index all protein_seqs for any 
      # transcripts made from cdna2genome  

      # fetch genes of differnt biotypes from different databases. use the key out of 
      # Databases.pm to define the databases you like to fetch data from. 
      # if you don't fetch data from i.e. EST_CDNA_DB jsut delete the key and no 
      # connection to the db is made. 
      INPUT_DATA_FROM_DBS  => {
                         GENEWISE_DB => ['targetted'] ,
                         EST_CDNA_DB => ['cdna2genome'] ,
                     }  ,

      # db that we write genes to
      OUT_DB_NAME                        => 'GENEWISE_DB',

      # version of exonerate used
      EXONERATE_PROGRAM                  => '/usr/local/ensembl/bin/exonerate-0.9.0',

      # cluster using only translateable exons
      # set to '0' if you'd like to cluster using all exons (incl. UTR)
      CLUSTER_ON_CODING_EXONS    => 1,
    },
    #BESTTARGETTED => {},
  }

 );


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;
