Bio::EnsEMBL::Pipeline
Rule
Toolbar
Summary
Bio::EnsEMBL::Pipeline::Rule
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
Description
Methods
Methods description
Title : add_condition Usage : $self->add_conditon($logic_name); Function: Add method for conditions for the rule. Returns : nothing Args : a string describing a testable condition on an object For now a logic_name of an analysis. |
-args: [analysis list], 'input id type', {completed accumulators}, verbose -returns: Either bits for status if nothing can be done; 1 - Failed Input_Id_Type Check. 2 - Failed Already Complete Check [so is complete]. 4 - Failed Condition Check. Or; $goalAnalysis if it should be done |
Title : goalAnalysis Usage : $self->goalAnalysis($anal); Function: Get/set method for the goal analysis object of this rule. Returns : Bio::EnsEMBL::Analysis Args : Bio::EnsEMBL::Analysis |
Title : list_conditions Usage : $self->list_conditions(); Function: Give a list of all conditions you have to fulfill to make this Rule evaluate to true. Returns : a list of strings which are probably logic_names Args : - |
Methods code
sub adaptor
{ my ( $self, $adaptor ) = @_;
( defined $adaptor ) &&
( $self->{'_adaptor'} = $adaptor );
$self->{'_adaptor'};
}
1; } |
sub add_condition
{ my $self = shift;
my $condition = shift;
push( @{$self->{'_conditions'}}, $condition ); } |
sub check_for_analysis
{ my $self = shift;
my ($analist, $input_id_type, $completed_accumulator_href, $verbose) = @_;
my %anaHash;
my $return = 0;
my $goal_anal = $self->goalAnalysis;
my $goal = $goal_anal->dbID;
my $goal_id_type = $goal_anal->input_id_type;
print "\nHave goal type ".$goal_id_type." and input id type ".$input_id_type."\n" if($verbose);
if ($goal_id_type ne 'ACCUMULATOR' &&
$goal_id_type ne $input_id_type) {
print "In check_for_analysis failed input_id_type check as goal input_id type ".
"isn't the same as the input_id type\n" if ($verbose);
$return += 1;
}
print " My goal is " . $goal_anal->logic_name . "\n" if($verbose);
print " Completed anals on this id:\n" if ($verbose);
for my $analysis ( @$analist ) {
print " Analysis " . $analysis->logic_name . " " . $analysis->dbID . "\n" if($verbose);
$anaHash{$analysis->logic_name} = $analysis;
if ($goal == $analysis->dbID) {
print $goal_anal->logic_name." already done\n" if ($verbose);
$return += 2;
}
}
print " Checking conditions:\n" if ($verbose);
for my $cond ( @{$self->{'_conditions'}} ) {
$cond =~ s/\s+//g;
if ( ! exists $anaHash{$cond} && ! exists $completed_accumulator_href->{$cond}) {
print " failed condition check for $cond\n" if ($verbose);
$return += 4;
}
}
if ($return < 4) {
print " All conditions satisfied\n" if ($verbose);
}
return $return if $return;
return $goal_anal; } |
sub dbID
{ my ( $self, $dbID ) = @_;
( defined $dbID ) &&
( $self->{'_dbID'} = $dbID );
$self->{'_dbID'}; } |
sub goalAnalysis
{ my ($self,$arg) = @_;
( defined $arg ) &&
( $self->{'_goal'} = $arg );
$self->{'_goal'}; } |
sub has_condition_of_input_id_type
{ my $self = shift;
my $id_type = shift;
my $ana_adaptor = $self->goalAnalysis->adaptor;
if (!scalar (@{$self->{'_conditions'}})) {
throw("No conditions found for this Rule");
}
return 1 if (exists($self->{'_condition_type_cache'}{$id_type}));
foreach my $cond (@{$self->{'_conditions'}}) {
my $cond_anal = $ana_adaptor->fetch_by_logic_name($cond);
if ($cond_anal->input_id_type eq $id_type) {
$self->{'_condition_type_cache'}{$id_type} = 1;
return 1;
}
}
return 0; } |
sub list_conditions
{ my $self = shift;
my @conditions;
if ($self->{'_conditions'}) {
@conditions = @{$self->{'_conditions'}};
}
if (! scalar (@conditions) ) {
throw("No conditions found for this Rule");
}
return\@ conditions; } |
sub new
{ my ($class,@args) = @_;
my $self = bless {},$class;
my ( $goal, $adaptor, $dbID ) =
rearrange( [ qw ( GOALANALYSIS
ADAPTOR
DBID
) ], @args );
if ( $goal ) {
throw( "Wrong parameter" ) unless
$goal->isa( "Bio::EnsEMBL::Analysis" );
}
$self->dbID( $dbID );
$self->goalAnalysis( $goal );
$self->adaptor( $adaptor );
$self->{'_condition_type_cache'} = {};
return $self; } |
General documentation
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
Title : new
Usage : ...Rule->new($analysis);
Function: Constructor for Rule object
Returns : Bio::EnsEMBL::Pipeline::Rule
Args : A Bio::EnsEMBL::Analysis object. Conditions are added later,
adaptor and dbid only used from the adaptor.