00001 00002 =head1 LICENSE 00003 00004 Copyright [2009-2016] EMBL-European Bioinformatics Institute 00005 00006 Licensed under the Apache License, Version 2.0 (the "License"); 00007 you may not use this file except in compliance with the License. 00008 You may obtain a copy of the License at 00009 00010 http://www.apache.org/licenses/LICENSE-2.0 00011 00012 Unless required by applicable law or agreed to in writing, software 00013 distributed under the License is distributed on an "AS IS" BASIS, 00014 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 See the License for the specific language governing permissions and 00016 limitations under the License. 00017 00018 =head1 CONTACT 00019 00020 Please email comments or questions to the public Ensembl 00021 developers list at <dev@ensembl.org>. 00022 00023 Questions may also be sent to the Ensembl help desk at 00024 <helpdesk@ensembl.org>. 00025 00026 =head1 NAME 00027 00028 Bio::EnsEMBL::MetaData::Pipeline::ProcessCompara 00029 00030 =head1 DESCRIPTION 00031 00032 Runnable to process a compara database 00033 00034 =head1 AUTHOR 00035 00036 Dan Staines 00037 00038 =cut 00039 00040 use warnings; 00041 use strict; 00042 00043 package Bio::EnsEMBL::MetaData::Pipeline::ProcessCompara; 00044 00045 use base ('Bio::EnsEMBL::Production::Pipeline::Base'); 00046 00047 use Bio::EnsEMBL::MetaData::MetaDataProcessor; 00048 use Bio::EnsEMBL::MetaData::AnnotationAnalyzer; 00049 use Bio::EnsEMBL::MetaData::DBSQL::MetaDataDBAdaptor; 00050 00051 use Carp; 00052 use Data::Dumper; 00053 use Log::Log4perl qw(:easy); 00054 Log::Log4perl->easy_init($INFO); 00055 my $log = get_logger(); 00056 00057 sub param_defaults { 00058 my ($self) = @_; 00059 return {}; 00060 } 00061 00062 sub fetch_input { 00063 my ($self) = @_; 00064 return; 00065 } 00066 00067 sub run { 00068 my ($self) = @_; 00069 my $dbas = {}; 00070 my $compara_name = $self->param_required('species'); 00071 $log->info("Processing compara $compara_name"); 00072 00073 # TODO 00074 my $compara_dba = $self->get_DBAdaptor("compara"); 00075 00076 $log->info("Connecting to info database"); 00077 my $dba = 00078 Bio::EnsEMBL::MetaData::DBSQL::MetaDataDBAdaptor->new( 00079 -USER =>, 00080 $self->param('info_user'), 00081 -PASS =>, 00082 $self->param('info_pass'), 00083 -HOST =>, 00084 $self->param('info_host'), 00085 -PORT =>, 00086 $self->param('info_port'), 00087 -DBNAME =>, 00088 $self->param('info_dbname') 00089 ); 00090 my $gdba = $dba->get_GenomeInfoAdaptor(); 00091 my $cdba = $dba->get_GenomeComparaInfoAdaptor(); 00092 00093 # set the release to use when storing genomes 00094 my $rdba = $dba->get_DataReleaseInfoAdaptor(); 00095 my $release; 00096 if ( defined $self->param('eg_release') ) { 00097 $release = 00098 $rdba->fetch_by_ensembl_genomes_release( 00099 $self->param('eg_release') ); 00100 } 00101 else { 00102 $release = 00103 $rdba->fetch_by_ensembl_release( $self->param('release') ); 00104 } 00105 $gdba->data_release($release); 00106 #$cdba->data_release($release); 00107 00108 my $upd = $self->param('force_update') || 0; 00109 00110 my $opts = { -INFO_ADAPTOR => $gdba, 00111 -ANNOTATION_ANALYZER => 00112 Bio::EnsEMBL::MetaData::AnnotationAnalyzer->new(), 00113 -COMPARA => 0, 00114 -CONTIGS => 0, 00115 -FORCE_UPDATE => $upd, 00116 -VARIATION => 0 }; 00117 $log->info("Processing $compara_name"); 00118 my $processor = 00119 Bio::EnsEMBL::MetaData::MetaDataProcessor->new(%$opts); 00120 my $compara_infos = $processor->process_compara( $compara_dba, {} ); 00121 00122 for my $compara_info (@$compara_infos) { 00123 my $nom = $compara_info->method() . "/" . $compara_info->set_name(); 00124 if ( defined $compara_info->dbID() ) { 00125 $log->info( "Updating compara info for " . $nom ); 00126 $cdba->update($compara_info); 00127 } 00128 else { 00129 $log->info( "Storing compara info for " . $nom ); 00130 $cdba->store($compara_info); 00131 } 00132 } 00133 00134 $log->info("Completed processing compara $compara_name"); 00135 return; 00136 } ## end sub run 00137 00138 sub write_output { 00139 my ($self) = @_; 00140 return; 00141 } 00142 00143 1; 00144