Bio::EnsEMBL::Hive
DataflowRule
Toolbar
Summary
Bio::EnsEMBL::Hive::DataflowRule
Package variables
No package variables defined.
Included modules
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
Methods description
Title : branch_code Arg[1] : (optional) int $code Usage : $self->branch_code($code); Function: Get/set method for rules branch_code. Returns : integer |
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 |
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 |
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 |
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
sub adaptor
{ my ( $self, $adaptor ) = @_;
$self->{'_adaptor'} = $adaptor if defined $adaptor;
return $self->{'_adaptor'}; } |
sub branch_code
{ my( $self, $value ) = @_;
$self->{'_branch_code'} = 1 unless(defined($self->{'_branch_code'}));
$self->{'_branch_code'} = $value if(defined($value));
return $self->{'_branch_code'}; } |
sub dbID
{ my ( $self, $dbID ) = @_;
$self->{'_dbID'} = $dbID if defined $dbID;
return $self->{'_dbID'}; } |
sub from_analysis
{ my ($self,$analysis) = @_;
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;
}
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'}; } |
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'}; } |
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; } |
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; } |
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($self->from_analysis and ($self->from_analysis->adaptor == $analysis->adaptor)) {
$self->{'_to_analysis_url'} = $analysis->logic_name;
} else {
$self->{'_to_analysis_url'} = $analysis->url;
}
}
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'}; } |
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
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
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.