# Bio::EnsEMBL::Analysis::Config::GeneBuild::Solexa2Genes;
# 
# 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


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

use strict;
use vars qw( %Config );

# Hash containing config info
%Config = (

SOLEXA2GENES_CONFIG_BY_LOGIC => 
     {
      DEFAULT => {
                  # databases are defined as hash keys from Bio::EnsEMBL::Analysis::Config::Databases
                  OUTPUT_DB    => '',
		  # can use alignments from more than one database if needed
	          ALIGNMENT_DB => [''],
		  
		  
                  # logic_names for dna_align_features to be fetched out of ALIGNMENT_DB(s)
                  LOGIC_NAMES  => [],

                  # options for filtering out small gene models
                  MIN_LENGTH => 100,
                  MIN_EXONS  =>   1,
		  
		  # genes with a span < MIN_SPAN will also be considered single exon
		  MIN_SINGLE_EXON_LENGTH => 1000,
		  
                  # 'span' = genomic extent / cdna length
                  MIN_SPAN   =>   1.5,
		  
                  # number of read pairs needed to confirm an end exon
		  END_EXON_COVERAGE => 2,
		  
                  # exclude exons where the coverage is lower than 
		  # *percentage* of the *average* exon coverage for the transcript
		  # ie a value of 10 means remove all exon pairings where the
		  # coverage is < 10% of the average 
		  EXCLUDE_EXONS => 2,
		  
		  # Merge genes that are seperated by a gap of max length X
		  # Where the gap is 100% covered by a repeat
		  MERGE_GENES  => 1000,
		  
		  # min length for a pair to be considered
		  # spanning an intron
		  INTRON_PAIR  => 400,
                  },
     }
);

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;
