Archive Ensembl HomeArchive Ensembl Home
SetGenomeDBLocator.pm
Go to the documentation of this file.
00001 #ensembl module for bio::ensembl::compara::production::epoanchors::setgenomedblocator
00002 # you may distribute this module under the same terms as perl itself
00003 #
00004 # POD documentation - main docs before the code
00005 =head1 NAME
00006 
00007 Bio::EnsEMBL::Compara::Production::EPOanchors::HMMerAnchors 
00008 
00009 =head1 SYNOPSIS
00010 
00011 $exonate_anchors->fetch_input();
00012 $exonate_anchors->run();
00013 $exonate_anchors->write_output(); writes to database
00014 
00015 =head1 DESCRIPTION
00016 
00017 Given a database with anchor sequences and a target genome. This modules exonerates 
00018 the anchors against the target genome. The required information (anchor batch size,
00019 target genome file, exonerate parameters are provided by the analysis, analysis_job 
00020 and analysis_data tables  
00021 
00022 =head1 AUTHOR - Stephen Fitzgerald
00023 
00024 This modules is part of the Ensembl project http://www.ensembl.org
00025 
00026 Email compara@ebi.ac.uk
00027 
00028 =head1 CONTACT
00029 
00030 This modules is part of the EnsEMBL project (http://www.ensembl.org)
00031 
00032 Questions can be posted to the ensembl-dev mailing list:
00033 dev@ensembl.org
00034 
00035 
00036 =head1 APPENDIX
00037 
00038 The rest of the documentation details each of the object methods. 
00039 Internal methods are usually preceded with a _
00040 
00041 =cut
00042 #
00043 package Bio::EnsEMBL::Compara::Production::EPOanchors::SetGenomeDBLocator;
00044 
00045 use strict;
00046 use Data::Dumper;
00047 use Bio::EnsEMBL::Registry;
00048 
00049 use base ('Bio::EnsEMBL::Compara::RunnableDB::BaseRunnable');
00050 
00051 
00052 sub fetch_input {
00053     my ($self) = @_;
00054     my $sth = $self->dbc->prepare("SELECT * FROM genome_db");
00055     $sth->execute();
00056         my $genome_dbs = $sth->fetchall_hashref('name');
00057     Bio::EnsEMBL::Registry->load_registry_from_url( $self->param('core_db_url') );
00058     my($user,$host,$port) = $self->param('core_db_url')=~/mysql:\/\/(\w+)@([\w\.\-]+):(\d+)/ or die "no user/host/port for core dbs\n";
00059     foreach my $db_adaptor( @{ Bio::EnsEMBL::Registry->get_all_DBAdaptors } ){
00060         my $dbname = $db_adaptor->dbc->dbname;
00061         next unless $dbname=~/_core_/;
00062         my ($species_name)=$dbname=~/(\w+)_core_/; 
00063         if(exists($genome_dbs->{$species_name})){
00064             $genome_dbs->{$species_name}->{'locator'} = "Bio::EnsEMBL::DBSQL::DBAdaptor/host=" . 
00065             $host . ";port=" . $port . ";user=" . $user . ";dbname=" . $dbname . ";species=" . 
00066             $species_name . ";disconnect_when_inactive=1";
00067         }
00068     } 
00069     my @genome_dbs = values( %$genome_dbs );
00070     $self->param('genome_dbs', \@genome_dbs);
00071 }
00072 
00073 sub write_output {
00074     my ($self) = @_;
00075     return unless $self->param('genome_dbs');
00076     $self->dataflow_output_id( $self->param('genome_dbs'), 2);
00077 }
00078 
00079 1;
00080