Bio::EnsEMBL::Pipeline Rule
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::Pipeline::Rule
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::Utils::Argument qw ( rearrange )
Bio::EnsEMBL::Utils::Exception qw ( verbose throw warning info )
Inherit
Unavailable
Synopsis
Description
Methods
adaptor
No description
Code
add_conditionDescriptionCode
check_for_analysisDescriptionCode
dbID
No description
Code
goalAnalysisDescriptionCode
has_condition_of_input_id_type
No description
Code
list_conditionsDescriptionCode
new
No description
Code
Methods description
add_conditioncode    nextTop
  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.
check_for_analysiscodeprevnextTop
 -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
goalAnalysiscodeprevnextTop
  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
list_conditionscodeprevnextTop
  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
adaptordescriptionprevnextTop
sub adaptor {
  my ( $self, $adaptor ) = @_;
  ( defined $adaptor ) &&
    ( $self->{'_adaptor'} = $adaptor );
  $self->{'_adaptor'};
}

1;
}
add_conditiondescriptionprevnextTop
sub add_condition {
  my $self = shift;
  my $condition = shift;

  push( @{$self->{'_conditions'}}, $condition );
}
check_for_analysisdescriptionprevnextTop
sub check_for_analysis {
  my $self = shift;
  my ($analist, $input_id_type, $completed_accumulator_href, $verbose) = @_;
  my %anaHash;
  my $return = 0;

  # reimplement with proper identity check!
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); #This id isn't of the right type so doesn't satify goal
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) { # already done
print $goal_anal->logic_name." already done\n" if ($verbose); $return += 2; } } #the completed_accumulator_href contains input_id_type ACCUMULATOR anals that have completed
print " Checking conditions:\n" if ($verbose); for my $cond ( @{$self->{'_conditions'}} ) { # remove any trailing whitespace because the matches won't happen if there is whitespace in, eg. your rule_conditions table.
$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;
}
dbIDdescriptionprevnextTop
sub dbID {
  my ( $self, $dbID ) = @_;
  ( defined $dbID ) &&
    ( $self->{'_dbID'} = $dbID );
  $self->{'_dbID'};
}
goalAnalysisdescriptionprevnextTop
sub goalAnalysis {
  my ($self,$arg) = @_;

  ( defined $arg ) &&
    ( $self->{'_goal'} = $arg );
  $self->{'_goal'};
}
has_condition_of_input_id_typedescriptionprevnextTop
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) {
          #print " Condition of " . $cond_anal->logic_name . " is of type $id_type\n";
$self->{'_condition_type_cache'}{$id_type} = 1; return 1; } } return 0;
}
list_conditionsdescriptionprevnextTop
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;
}
newdescriptionprevnextTop
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
CONTACTTop
    Contact Arne Stabenau on implemetation/design detail: stabenau@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 : ...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.