From c0cf3a6bc4eb21be041b8c381c1dd0f46d13d03f Mon Sep 17 00:00:00 2001
From: Leo Gordon <lg4@ebi.ac.uk>
Date: Fri, 27 Jun 2014 11:55:56 +0100
Subject: [PATCH] bugfix: make sure "foreign" stats are cached as objects

---
 modules/Bio/EnsEMBL/Hive/Utils/Graph.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/Bio/EnsEMBL/Hive/Utils/Graph.pm b/modules/Bio/EnsEMBL/Hive/Utils/Graph.pm
index 2c7978136..f6abc89d3 100644
--- a/modules/Bio/EnsEMBL/Hive/Utils/Graph.pm
+++ b/modules/Bio/EnsEMBL/Hive/Utils/Graph.pm
@@ -189,6 +189,8 @@ sub build {
             $target_object = $df_rule->to_analysis();
             $target_object->{'_foreign'}=1;
             Bio::EnsEMBL::Hive::Analysis->collection()->add( $target_object );  # add it to the collection
+            my $foreign_stats = $target_object->stats or die "Could not fetch foreign stats for ".$target_object->display_name( $self->hive_dba );
+            Bio::EnsEMBL::Hive::AnalysisStats->collection()->add( $foreign_stats ); # add it to the collection
         }
 
         if( my $funnel_dataflow_rule  = $df_rule->funnel_dataflow_rule ) {
@@ -201,6 +203,8 @@ sub build {
             my $condition_analysis = $c_rule->condition_analysis();
             $condition_analysis->{'_foreign'}=1;
             Bio::EnsEMBL::Hive::Analysis->collection()->add( $condition_analysis ); # add it to the collection
+            my $foreign_stats = $condition_analysis->stats or die "Could not fetch foreign stats for ".$condition_analysis->display_name( $self->hive_dba );
+            Bio::EnsEMBL::Hive::AnalysisStats->collection()->add( $foreign_stats ); # add it to the collection
         }
     }
 
-- 
GitLab