#
# package Bio::EnsEMBL::Pipeline::Config::WGA2Genes
# 
# 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::Analysis::Config::WGA2Genes;

=head1 SYNOPSIS

use Bio::EnsEMBL::Analysis::Config::WGA2Genes

=head1 DESCRIPTION

It imports and sets a number of standard global variables into the
calling package, which are used in many scripts in the human sequence
analysis system.  The variables are first declared using "use vars",
so that it can be used when "use strict" is in use in the calling
script.  Without arguments all the standard variables are set, and
with a list, only those variables whose names are provided are set.

=head1 CONTACT

=cut


package Bio::EnsEMBL::Analysis::Config::WGA2Genes;

use strict;
use vars qw( %Config );

# Hash containing config info
%Config = (
           WGA2GENES_CONFIG_BY_LOGIC => {
             DEFAULT => {

               TARGET_CORE_DB => 'TARGET_CORE_DB',
               QUERY_CORE_DB => 'QUERY_CORE_DB',
               COMPARA_DB => 'COMPARA_DB',

               # reference (TARGET) species external db
               TARGET_SPECIES_EXTERNAL_DBNAME => 'Ens_Hs_translation', # or Ens_Mm_translation

               INPUT_METHOD_LINK_TYPE => 'CONTIG_AWARE_NET',

               ########################
               # Source gene filtering
               ########################

               # file of genes/transcripts to ignore during the process
               KILL_LIST => '',

               # if the following is set, only the longest
               # non-killed transcripts is projected for each gene
               LONGEST_SOURCE_TRANSCRIPT => 1,


               ##################
               # Chain filtering
               ##################

               # do not consider chains that have a block overlap with
               # the annotation of less then this amount
               MIN_CHAIN_ANNOTATION_OVERLAP  => 10,

               # When forming a Net and rejecting "inconsistent" chains,
               # if less that this proportion of the candidate chain is not
               # unique (unique -> does not overlap in the query with retained 
               # blocks so far), then we reject it. 
               OVERLAP_CHAIN_FILTER => 0.7,

               #############################
               # Transcript construction and filtering
               #############################
               
               # The maximum modulo-3 distance that will be "read-through"
               # when a single query exon aligns in two pieces to the 
               # target
               MAX_EXON_READTHROUGH_DIST => 15,

               # The maximum number of in-frame stops that will be "edited
               # out" (by introning over them) of the transcript for
               # "primary" (first level) gene scaffold
               MAX_EDITABLE_STOPS_PRIMARY => 100,

               # The maximum number of in-frame stops that will be "edited
               # out" (by introning over them) of the transcript for
               # "non-primary" (second, third etc. level) gene scaffolds
               MAX_EDITABLE_STOPS_NON_PRIMARY => 0,

               # If the following is non-zero, exons that appear to be
               # missing from alignment to due a sequence gap will be
               # placed in that gap (if circumstances allow)
               FULLY_GAP_EXONS => 1,

               # If the following is non-zero, exons with partial alignment
               # cover to du an apparent sequence gap will be extended into
               # that gap (if circumstances allow) 
               PARTIAL_GAP_EXONS => 1,


               # Minimum coverage of source transcript
               MIN_COVERAGE => 50.0,

               # Minimum proportion of result transcript that is not gap
               MIN_NON_GAP  => 50.0,

               # Output directory for the output files
               OUTPUT_DIR => undef,

             },
             WGA2Genes => {
               # Directory for WGA2Genes specific output files
               OUTPUT_DIR => '',
             },
           },
);

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;
