Archive Ensembl HomeArchive Ensembl Home
TreefamXrefMapper.pm
Go to the documentation of this file.
00001 
00002 =pod 
00003 
00004 =head1 NAME
00005 
00006     Bio::EnsEMBL::Compara::RunnableDB::TreefamXrefMapper
00007 
00008 =cut
00009 
00010 =head1 SYNOPSIS
00011 
00012         # compute and store the mapping between TreeFam v.7 and ProteinTrees of rel.64:
00013 
00014     time standaloneJob.pl Bio::EnsEMBL::Compara::RunnableDB::TreefamXrefMapper \
00015         -compara_db "mysql://ensadmin:${ENSADMIN_PSW}@compara3/mm14_compara_homology_64" -release 64 -tf_release 7 -tag_prefix ''
00016 
00017 
00018         # compute and store the mapping between TreeFam v.8 and ProteinTrees of rel.64:
00019 
00020     time standaloneJob.pl Bio::EnsEMBL::Compara::RunnableDB::TreefamXrefMapper \
00021         -compara_db "mysql://ensadmin:${ENSADMIN_PSW}@compara3/mm14_compara_homology_64" -release 64 -tf_release 8 -tag_prefix 'dev_'
00022 
00023 =cut
00024 
00025 =head1 DESCRIPTION
00026 
00027 This RunnableDB computes and stores mapping between TreeFams and ProteinTrees in ProteinTree tags.
00028 
00029 =cut
00030 
00031 =head1 CONTACT
00032 
00033 Contact anybody in Compara.
00034 
00035 =cut
00036 
00037 
00038 package Bio::EnsEMBL::Compara::RunnableDB::TreefamXrefMapper;
00039 
00040 use strict;
00041 use Bio::EnsEMBL::Compara::StableId::Adaptor;
00042 use Bio::EnsEMBL::Compara::StableId::NamedClusterSetLink;
00043 
00044 use base ('Bio::EnsEMBL::Compara::RunnableDB::BaseRunnable');
00045 
00046 sub fetch_input {
00047     my $self = shift @_;
00048 
00049     my $release    = $self->param('release')    || die "'release' is an obligatory numeric parameter, please set it in the input_id hashref";
00050     my $tf_release = $self->param('tf_release') || die "'tf_release' is an obligatory numeric parameter, please set it in the input_id hashref";
00051     my $tf_type    = $self->param('tf_type')    || 'c';     # 'c' means 'CLEAN', 'w' means 'FULL'
00052 
00053     unless(defined($self->param('tag_prefix'))) {  # we prefer to check this parameter now, not after everything has been computed.
00054         die "'tag_prefix' is an obligatory parameter, even if set to empty string; plase set it in the input_id hashref";
00055     }
00056 
00057     my $adaptor = Bio::EnsEMBL::Compara::StableId::Adaptor->new();
00058 
00059     my $from_ncs = $adaptor->fetch_ncs($tf_release, $tf_type);
00060     my $to_ncs   = $adaptor->fetch_ncs($release,    't',     $self->compara_dba->dbc);
00061     my $ncsl     = Bio::EnsEMBL::Compara::StableId::NamedClusterSetLink->new(-FROM => $from_ncs, -TO => $to_ncs);
00062 
00063     $self->compara_dba->dbc->disconnect_when_inactive(1);
00064 
00065     $self->param('adaptor', $adaptor);
00066     $self->param('ncsl', $ncsl);
00067 
00068     return 1;
00069 }
00070 
00071 sub run {
00072     my $self = shift @_;
00073 
00074     my $ncsl = $self->param('ncsl');
00075     my $accu = $ncsl->mnr_lite();
00076 
00077     $self->param('accu', $accu);
00078 
00079     return 1;
00080 }
00081 
00082 sub write_output {
00083     my $self = shift @_;
00084 
00085     my $adaptor    = $self->param('adaptor');
00086     my $accu       = $self->param('accu');
00087     my $tag_prefix = $self->param('tag_prefix');
00088 
00089     $adaptor->store_tags($accu, $self->compara_dba->dbc, $tag_prefix);
00090 
00091     return 1;
00092 }
00093 
00094 1;
00095