From a7e0f2def85edf3032a116873e09c2fcd29089a0 Mon Sep 17 00:00:00 2001
From: Leo Gordon <lg4@ebi.ac.uk>
Date: Fri, 25 Nov 2011 10:22:02 +0000
Subject: [PATCH] allow more than one input_id_template per analysis

---
 .../EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm   | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm b/modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
index 44d3f274e..b155aa5ae 100644
--- a/modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
+++ b/modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
@@ -448,14 +448,19 @@ sub run {
 
                 $heirs = { map { ($_ => undef) } @$heirs } if(ref($heirs) eq 'ARRAY'); # now force it into a hash if it wasn't
 
-                while(my ($heir_url, $input_id_template) = each %$heirs) {
+                while(my ($heir_url, $input_id_template_list) = each %$heirs) {
+                    
+                    $input_id_template_list = [ $input_id_template_list ] unless(ref($input_id_template_list) eq 'ARRAY');  # allow for more than one template per analysis
 
-                    my $heir_analysis = $analysis_adaptor->fetch_by_logic_name_or_url($heir_url);
+                    foreach my $input_id_template (@$input_id_template_list) {
 
-                    $dataflow_rule_adaptor->create_rule( $analysis, $heir_analysis || $heir_url, $branch_name_or_code, $input_id_template, $funnel_branch_name_or_code);
+                        my $heir_analysis = $analysis_adaptor->fetch_by_logic_name_or_url($heir_url);
 
-                    warn "DataFlow rule: [$branch_tag] $logic_name -> $heir_url"
-                        .($input_id_template ? ' WITH TEMPLATE: '.stringify($input_id_template) : '')."\n";
+                        $dataflow_rule_adaptor->create_rule( $analysis, $heir_analysis || $heir_url, $branch_name_or_code, $input_id_template, $funnel_branch_name_or_code);
+
+                        warn "DataFlow rule: [$branch_tag] $logic_name -> $heir_url"
+                            .($input_id_template ? ' WITH TEMPLATE: '.stringify($input_id_template) : '')."\n";
+                    }
                 }
             }
         }
-- 
GitLab