#
# Ensembl configuration file used in 
#
# Bio::EnsEMBL::Analysis::RunnableDB::OrthologueEvaluator
#
# Copyright (c) 2006 Ensembl
#


=head1 NAME

Bio::EnsEMBL::Analysis::Config::GeneBuild::OrthologueEvaluator

=head1 SYNOPSIS

    Bio::EnsEMBL::Analysis::Config::GeneBuild::OrthologueEvaluator

=head1 DESCRIPTION


OrthologueEvaluator - Configuration 

This is the main configuration file for OrthologueEvaluator, a perl 
module which uses information from an Ensembl Compara database to 
compare and assess gene predictions. 

The parameters to connect to various databases are defiend in 

  - modules/Bio/EnsEMBL/Analysis/Config/Databases.pm 
  - modules/Bio/EnsEMBL/Analysis/Config/OrthologueEvaluator.pm 

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

use strict;
use vars qw(%Config);

%Config= 
 (

###################################################################################    
#
# 
# This is because the output-database as well as the directory where the sequences 
# will be dumped is defined in the Exonerte2Genes-configuration   
#  
# The value of EXONERATE_2_GENES_LOGIC_NAME has to point to a hashkey in Exonerate2Genes.pm 
# 
   
MAIN_CONFIG =>  
{ 
           LOCATION_OF_COMPARA_REGISTRY_FILE =>  '/nfs/acari/jhv/fsk_compara_reg.reg' , 

           SEQUENCE_DUMP_BASE_DIR => "/lustre/work1/ensembl/jhv/project_orth_analysis/seq_dump_cow" ,  

           # decide which analyses you like to run 
       
           RUN_FIND_MISSING_ORTHOLOGUES => 1,   
           RUN_FIND_PARTIAL_GENES       => 1, 
           RUN_FIND_SPLIT_GENES         => 1,
           RUN_FIND_FALSE_INTRONS       => 1,  

       # ONLY use the species name used for the compara run 
       # which is also stored in the genome_db table of the compara database  

           QUERY_SPECIES => 'Bis taurus',    

}, # // MAIN_CONFIG-end 




                  
###################################################################################    
#
# The following section configures the MissingOrthologue  run : 
#
# input_id-format  :  
#
#       ANALYSIS_SET{$key}:chromosome:BROADD2:1:22222:99999:1 
# e.g. logic_name:chromosome:BROADD2:1:22222:99999:1 
#  
#  

FIND_MISSING_ORTHOLOGUES=>  
{ 
        
         # 
         # the Runnable will identify one2one orthologues in trusted set 
         # and check if there's any known one2one orth between new_species 
         # and one of the members of the trusted set    
         # 
         
           DEFAULT_GENE_BIOTYPES => ['protein_coding'] ,   
          
         #
         # Define a 'trusted' species pair to find one2one orthologues between this pair.
         # The analysis than checks if this one2one relation also exists in the first species
         # of the set and the QUERY_SPECIES. 
         # 
         # These species should be not too dependend (i.e. don't use rat and mus as a 
         # trusted set ) and the 2 species in the set should also be not too distant........ 
         #
         # Example :  Trusted set :  ['Homo sapiens','Mus musculus']   
         #            QUERY_SPECIES ='Bis taurus_new_build'  
         # The analysis gets all genes in Homos sapiens, identifies the ones which have a 
         # one2one homologue in Mus musculus and than checks if your compara-run identified a 
         # one2one gene betweeen Homo sapiens and your QUERY_SPECIES ( as defined in the MAIN_CONFIG part). 
         # If no such 'Homo sapiens-QUERY_SPECIES relation is found the protein sequence of the 
         # Homo sapiens protein is dumped out and later on exonerated against the genome of 
         # QUERY_SPECIES.  
         # It does really not make sense to use your QUERY_SPECIES in the trusted set. 


         # If you want to re-align all one2one_orthologs between your 2 trusted species, no matter 
         # if an ortholog is computed or not, set this option to '1' ( for example for pre-sites ...) 
         #
         # For identifing only missing orthologs set this option to '0'   ( default ) 
         #  

           RE_EXONERATE_ALL_ONE2ONE_ORTHOLOGS => 0, 




          
           ANALYSIS_SETS => 
           {          
                      #    
                      # WARNING !          
                      #
                      # ONLY use the species name used for the compara run 
                      # which is also stored in the genome_db table of the compara database  
                      # (e.g. 'Canis familiaris' , 'Bos taurus_newbuild' .... ) 
                      # 
                        hum_mus_one2one     => ['Homo sapiens', 'Mus musculus'], 
                        hum_old_dog_one2one => ['Homo sapiens', 'Canis familiaris'], 
                        hum_old_cow_one2one => ['Homo sapiens', 'Bos taurus'],  
                        my_name_is_not_important => ['Mus musculus', 'Homo sapiens'],
           } ,  

},  # // FIND_MISSING_ORTHOLOGUES section-end
   





 
###################################################################################    
#
# The following section configures the FindPartialGenes-Runnable  
#
# input_id-format :
# 
#       ANALYSIS_SET{KEY}:chromosome:BROADD2:chromosome:1:222222:333333:1  
# e.g.  find_paritals:chromosome:BROADD2:chromosome:1:222222:333333:1  
#
# input-id is created by setup script 
# setup script creates post-analysis (find_partials) 
# if you like to add new post_analysis 

FIND_PARTIAL_GENES => 
{   
         # biotype of genes to fetch out of the db which was used 
         # for the compara run in registry file   
           DEFAULT_GENE_BIOTYPES => ['protein_coding'] ,   
                           

          # analysis_sets consist of logic_name and members. First, we 
          # find orthologues between the QUERY SPECIES (your new build ) 
          # and MAIN_ORTH ( a species with a trustable set of gene predcitions which 
          # is also close to QUERY SPECIES ).  
          #
          # - the length of these two genes is noted. 
          # than we find orthologues between MAIN_ORTH and TEST_SPEC_1 
          # and MAIN_ORTH and TEST_SPEC_2 and calculates the ratio between 
          # these pairs . If the length difference is significant between the 
          # gene predictions in the other species and query-main, we've found partials.
          #
          #
           ANALYSIS_SETS => 
           {   

                      find_partials =>
                      { 
                     
                         # WARNING !
                         # ONLY use the species name which is also stored in the genome_db 
                         # table of the compara-database you're using (and in the reg-file of course!)
                         # 
                         # well-annoteted spec which have a bit of dist. as well as conserverd genes   

                           'MAIN_ORTH'   => 'Homo sapiens',          
                           'TEST_SPEC_1' => 'Mus musculus',    
                           'TEST_SPEC_2' => 'Canis familiaris',
                           'IGNORE_ORTHOLOGUES_ON_MT_REGIONS' => 1 ,  
                           'RATIO_MAIN_vs_QUERY' =>        0.75,
                           'RATIO_MAIN_vs_SPEC_1_LOW' =>   0.9,
                           'RATIO_MAIN_vs_SPEC_1_HIGH' =>  1.1,
                           'RATIO_MAIN_vs_SPEC_2_LOW' =>   0.9, 
                           'RATIO_MAIN_vs_SPEC_2_HIGH' =>  1.1,

                        },  
                        #
                        # if you like you can test other sets as well : 
                        #
                        # whatever_new_logic_name => 
                        # {
                        #   MAIN_ORTH   => "Mus musculus", 
                        #   TEST_SPEC_1 => "Canis familiaris", 
                        #   TEST_SPEC_2 => ".....", 
                        #   IGNORE_ORTHOLOGUES_ON_MT_REGIONS => 1 ,  
                        #   RATIO_MAIN_vs_QUERY =>        0.75,
                        #   RATIO_MAIN_vs_SPEC_1_LOW =>   0.9,
                        #   RATIO_MAIN_vs_SPEC_1_HIGH =>  1.1,
                        #   RATIO_MAIN_vs_SPEC_2_LOW =>   0.9, 
                        #   RATIO_MAIN_vs_SPEC_2_HIG' =>  1.1,
                        # }
           },
},  # // FIND_PARTIAL_GENES section-end




###################################################################################    
# 
# This section configures the FindSplitGene.pm RunnableDB 
# You can define new sets as well, the names like 'hum_dog_split' can be 
# changed to whatever you like (foo_bla_bar etc.) - they are only used 
# as hash-keys so the runnableDB will loop over all keys of the ANALYSIS_SETS -hash
# 
# FindSplitGenes is running on the whole genome , you can use any dummy-string
# as input_id 
#
FIND_SPLIT_GENES =>
{    


           ANALYSIS_SETS => 
           {   
                                   hum_dog_split=>
                                   { 
                                     'INFORMANT' => 'Homo sapiens',          
                                     'INFORMANT_PERC_COV' => 20,  

                                     'TARGETTED' => 'Canis familiaris', 
                                     'TARGETTED_PERC_COV' => 70,
                                    }, 

                                   hum_mus_split=>
                                   { 
                                     'INFORMANT' => 'Homo sapiens',          
                                     'INFORMANT_PERC_COV' => 20,  

                                     'TARGETTED' => 'Mus musculus', 
                                     'TARGETTED_PERC_COV' => 70,
                                    },
           }, 


}, # // FIND_SPLIT_GENES-section-end




###################################################################################    
# 
# This section configures the FindFalseIntrons.pm-RunnableDB-run. 
# The analysis will check all gene-structures of a certain biotype of the 
# QUERY_SPECIES which you configured in the MAIN_CONFIG section in this file.  
#
# The introns of the QUERY_SPECIES are aligned with exonerate against the 
# homologue gene structure of the PRIMARY_ORTH and/ or SECONDARY_ORTH. 
#
# If the intron aligns to the sequence of the orth. gene structure it shows that 
# the intron is wrongly predicted and should be recoverd. 
# 


FIND_FALSE_INTRONS => 
{ 

           DEFAULT_GENE_BIOTYPES => ['protein_coding'] ,    

           ANALYSIS_SETS =>
           {
            FindFalseIntrons   =>  [  'Homo sapiens', 'Mus musculus' ], 
           },





}, # // FIND_FALSE_INTRONS-section-end





  );




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;
