Bio::EnsEMBL::Hive DataflowRule
SummaryPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
  Bio::EnsEMBL::Hive::DataflowRule
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::Hive::URLFactory
Bio::EnsEMBL::Utils::Argument
Bio::EnsEMBL::Utils::Exception
Synopsis
Description
  Needed a robust and simpler rule table
where Analyses in the pipeline can robustly define
new analyses and rules. New design has a single table where a 'rule'
is a simple link from one analysis to another.
Extended from design of SimpleRule concept to allow the 'to' analysis to
be specified with a network savy URL like
mysql://ensadmin:<pass>@ecs2:3361/compara_hive_test?analysis.logic_name='blast_NCBI34'
Methods
adaptor
No description
Code
branch_codeDescriptionCode
dbID
No description
Code
from_analysisDescriptionCode
from_analysis_idDescriptionCode
new
No description
Code
print_rule
No description
Code
to_analysisDescriptionCode
to_analysis_urlDescriptionCode
Methods description
branch_codecode    nextTop
  Title   : branch_code
Arg[1] : (optional) int $code
Usage : $self->branch_code($code);
Function: Get/set method for rules branch_code.
Returns : integer
from_analysiscodeprevnextTop
  Title   : from_analysis
Usage : $self->from_analysis($anal);
Function: Get/set method for the condition analysis object of this rule.
Returns : Bio::EnsEMBL::Analysis
Args : Bio::EnsEMBL::Analysis
from_analysis_idcodeprevnextTop
  Title   : from_analysis_id
Arg[1] : (optional) int $dbID
Usage : $self->from_analysis_id($dbID);
Function: Get/set method for the 'from' analysis objects dbID of this rule.
Returns : integer
to_analysiscodeprevnextTop
  Title   : to_analysis
Usage : $self->to_analysis($anal);
Function: Get/set method for the goal analysis object of this rule.
Returns : Bio::EnsEMBL::Analysis
Args : Bio::EnsEMBL::Analysis
to_analysis_urlcodeprevnextTop
  Title   : to_analysis_url
Arg[1] : (optional) string $url
Usage : $self->to_analysis_url($url);
Function: Get/set method for the 'to' analysis objects URL for this rule
Returns : string
Methods code
adaptordescriptionprevnextTop
sub adaptor {
  my ( $self, $adaptor ) = @_;
  $self->{'_adaptor'} = $adaptor if defined $adaptor;
  return $self->{'_adaptor'};
}
branch_codedescriptionprevnextTop
sub branch_code {
  #default branch_code = 1
my( $self, $value ) = @_; $self->{'_branch_code'} = 1 unless(defined($self->{'_branch_code'})); $self->{'_branch_code'} = $value if(defined($value)); return $self->{'_branch_code'};
}
dbIDdescriptionprevnextTop
sub dbID {
  my ( $self, $dbID ) = @_;
  $self->{'_dbID'} = $dbID if defined $dbID;
  return $self->{'_dbID'};
}
from_analysisdescriptionprevnextTop
sub from_analysis {
  my ($self,$analysis) = @_;

  # setter mode
if( defined $analysis ) { unless ($analysis->isa('Bio::EnsEMBL::Analysis')) { throw( "from_analysis arg must be a [Bio::EnsEMBL::Analysis]". "not a [$analysis]"); } $self->{'_from_analysis'} = $analysis; $self->{'_from_analysis_id'} = $analysis->dbID; } # lazy load the analysis object if I can
if(!defined($self->{'_from_analysis'}) and defined($self->from_analysis_id) and defined($self->adaptor)) { $self->{'_from_analysis'} = $self->adaptor->db->get_AnalysisAdaptor->fetch_by_dbID($self->from_analysis_id); } return $self->{'_from_analysis'};
}
from_analysis_iddescriptionprevnextTop
sub from_analysis_id {
  my ($self,$analysis_id) = @_;
  if($analysis_id) {
    $self->{'_from_analysis_id'} = $analysis_id;
    $self->{'_from_analysis'} = undef;
  }
  return $self->{'_from_analysis_id'};
}
newdescriptionprevnextTop
sub new {
  my ($class,@args) = @_;
  my $self = bless {}, $class;

  my ( $dbID, $adaptor, $fromAnalysis, %fromID, $toAnalysis, $toURL ) =
    rearrange( [ qw (DBID ADAPTOR FROM_ANALYSIS FROM_ID TO_ANALYSIS TO_URL) ], @args );
    
  $self->dbID($dbID) if(defined($dbID));
  $self->adaptor($adaptor) if(defined($adaptor));
  $self->from_analysis($fromAnalysis) if(defined($fromAnalysis));
  $self->to_analysis($toAnalysis ) if(defined($toAnalysis));

  return $self;
}
print_ruledescriptionprevnextTop
sub print_rule {
  my $self = shift;
  print("DataflowRule dbID=", $self->dbID,
        "  from_id=", $self->from_analysis_id,
        "  to_url=", $self->to_analysis_url,
        "  branch=", $self->branch_code,
        "\n");
}

1;
}
to_analysisdescriptionprevnextTop
sub to_analysis {
  my ($self,$analysis) = @_;

  if( defined $analysis ) {
    unless ($analysis->isa('Bio::EnsEMBL::Analysis')) {
      throw(
        "to_analysis arg must be a [Bio::EnsEMBL::Analysis]".
        "not a [$analysis]");
    }
    $self->{'_to_analysis'} = $analysis;

    #if the 'from' and 'to' share the same adaptor, then use a simple logic_name
#for the URL rather than a full network distributed URL
if($self->from_analysis and ($self->from_analysis->adaptor == $analysis->adaptor)) { $self->{'_to_analysis_url'} = $analysis->logic_name; } else { $self->{'_to_analysis_url'} = $analysis->url; } } # lazy load the analysis object if I can
if(!defined($self->{'_to_analysis'}) and defined($self->to_analysis_url)) { my $analyis = Bio::EnsEMBL::Hive::URLFactory->fetch($self->to_analysis_url); unless($analysis) { $analysis = $self->adaptor->db->get_AnalysisAdaptor->fetch_by_logic_name($self->to_analysis_url); } $self->{'_to_analysis'} = $analysis; } return $self->{'_to_analysis'};
}
to_analysis_urldescriptionprevnextTop
sub to_analysis_url {
  my ($self,$url) = @_;
  if($url) {
    $self->{'_to_analysis_url'} = $url;
    $self->{'_to_analysis'} = undef;
  }
  return $self->{'_to_analysis_url'};
}
General documentation
CONTACTTop
  Contact Jessica Severin on EnsEMBL::Hive implemetation/design detail: jessica@ebi.ac.uk
Contact Ewan Birney on EnsEMBL in general: birney@sanger.ac.uk
APPENDIXTop
  The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
ConstructorTop
  Title   : new
Usage : ...DataflowRule->new($analysis);
Function: Constructor for DataflowRule object
Returns : Bio::EnsEMBL::Hive::DataflowRule
Args : A Bio::EnsEMBL::Analysis object. Conditions are added later,
adaptor and dbid only used from the adaptor.