Commit 0656dc9e authored by Leo Gordon's avatar Leo Gordon
Browse files

be more flexible and allow input format variations for rules

parent 048df0fb
......@@ -53,6 +53,7 @@ Summary:
* LongMult examples have been patched to work with the new dataflow_output_id() method.
* init_pipeline.pl is now more flexible and can understand simplified syntax for dataflow/control rules
22 March, 2010 : Leo Gordon
......
......@@ -143,6 +143,9 @@ sub main {
my $analysis = $analysis_adaptor->fetch_by_logic_name($logic_name);
$wait_for ||= [];
$wait_for = [ $wait_for ] unless(ref($wait_for) eq 'ARRAY'); # force scalar into an arrayref
# create control rules:
foreach my $condition_logic_name (@$wait_for) {
if(my $condition_analysis = $analysis_adaptor->fetch_by_logic_name($condition_logic_name)) {
......@@ -153,23 +156,14 @@ sub main {
}
}
if(ref($flow_into) eq 'HASH') { # branched format:
foreach my $branch_code (sort {$a <=> $b} keys %$flow_into) {
foreach my $heir_logic_name (@{$flow_into->{$branch_code}}) {
if(my $heir_analysis = $analysis_adaptor->fetch_by_logic_name($heir_logic_name)) {
$dataflow_rule_adaptor->create_rule( $analysis, $heir_analysis, $branch_code);
warn "Created DataFlow rule: [$branch_code] $logic_name -> $heir_logic_name\n";
} else {
die "Could not fetch analysis '$heir_logic_name' to create a dataflow rule";
}
}
}
} elsif(ref($flow_into) eq 'ARRAY') { # array format (deprecated)
$flow_into ||= {};
$flow_into = { 1 => $flow_into } unless(ref($flow_into) eq 'HASH'); # force non-hash into a hash
foreach my $heir (@$flow_into) {
my ($heir_logic_name, $branch_code) = (ref($heir) eq 'ARRAY') ? (@$heir, 1) : ($heir, 1);
foreach my $branch_code (sort {$a <=> $b} keys %$flow_into) {
my $heir_logic_names = $flow_into->{$branch_code};
$heir_logic_names = [ $heir_logic_names ] unless(ref($heir_logic_names) eq 'ARRAY'); # force scalar into an arrayref
foreach my $heir_logic_name (@$heir_logic_names) {
if(my $heir_analysis = $analysis_adaptor->fetch_by_logic_name($heir_logic_name)) {
$dataflow_rule_adaptor->create_rule( $analysis, $heir_analysis, $branch_code);
warn "Created DataFlow rule: [$branch_code] $logic_name -> $heir_logic_name\n";
......
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