Commit dd033120 authored by Leo Gordon's avatar Leo Gordon
Browse files

bugfix: make sure foreign analyses are only added once (to avoid duplicated dataflow from them)

parent 84ddfc4f
......@@ -58,6 +58,17 @@ sub list {
}
sub present {
my $self = shift @_;
my $candidate = shift @_;
foreach my $element (@{ $self->listref }) {
return 1 if($element == $candidate);
}
return 0;
}
sub add {
my $self = shift @_;
......@@ -65,6 +76,16 @@ sub add {
}
sub add_once {
my $self = shift @_;
my $candidate = shift @_;
unless( $self->present( $candidate ) ) {
$self->add( $candidate );
}
}
sub find_one_by {
my ($self, %method_to_filter_value) = @_;
......
......@@ -182,7 +182,7 @@ sub build {
or die "Could not fetch a target object for url='".$df_rule->to_analysis_url."', please check your database for consistency.\n";
if( UNIVERSAL::isa($target_object, 'Bio::EnsEMBL::Hive::Analysis') ) { # dataflow target is a foreign Analysis
$pipeline->collection_of('Analysis')->add( $target_object ); # add it to the collection
$pipeline->collection_of('Analysis')->add_once( $target_object ); # add it to the collection
} elsif( UNIVERSAL::isa($target_object, 'Bio::EnsEMBL::Hive::NakedTable') ) {
} elsif( UNIVERSAL::isa($target_object, 'Bio::EnsEMBL::Hive::Accumulator') ) {
} else {
......@@ -198,7 +198,7 @@ sub build {
foreach my $c_rule ( $pipeline->collection_of('AnalysisCtrlRule')->list ) { # control rule's condition is a foreign Analysis
unless( $pipeline->collection_of('Analysis')->find_one_by('logic_name', $c_rule->condition_analysis_url )) {
my $condition_analysis = $c_rule->condition_analysis();
$pipeline->collection_of('Analysis')->add( $condition_analysis ); # add it to the collection
$pipeline->collection_of('Analysis')->add_once( $condition_analysis ); # add it to the collection
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment