From 2a4c7df784897dfaff344adc47dc712bc5eda6c2 Mon Sep 17 00:00:00 2001
From: Abel Ureta-Vidal <abel@ebi.ac.uk>
Date: Mon, 27 Feb 2006 18:23:41 +0000
Subject: [PATCH] Committed Kathryn changes. Added runnable and output
 subroutine. These should make the coding of
 Bio::EnsEMBL::Analysis::RunnableDB and Bio::EnsEMBL::Hive::Process more
 alike.

---
 modules/Bio/EnsEMBL/Hive/Process.pm | 75 +++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/modules/Bio/EnsEMBL/Hive/Process.pm b/modules/Bio/EnsEMBL/Hive/Process.pm
index d59c8aab1..5c28662fe 100755
--- a/modules/Bio/EnsEMBL/Hive/Process.pm
+++ b/modules/Bio/EnsEMBL/Hive/Process.pm
@@ -428,6 +428,81 @@ sub parameters {
 }
 
 
+#FIXME kfb 11.01.2006 added runnable method from Pipeline/RunnableDB. Required by 
+#PairAligner. 
+
+=head2 runnable
+
+    Title   :   runnable
+    Usage   :   $self->runnable($arg)
+    Function:   Sets a runnable for this RunnableDB
+    Returns :   Bio::EnsEMBL::Analysis::Runnable
+    Args    :   Bio::EnsEMBL::Analysis::Runnable
+
+=cut
+
+
+sub runnable {
+  my ($self,$arg) = @_;
+
+  if (!defined($self->{'_runnables'})) {
+      $self->{'_runnables'} = [];
+  }
+  
+  if (defined($arg)) {
+#FIXME kfb 11.01.2006 use Analysis/Runnable object rather than Pipeline/RunnableI
+#      if ($arg->isa("Bio::EnsEMBL::Pipeline::RunnableI")) {
+#	  push(@{$self->{'_runnables'}},$arg);
+#      } else {
+#	  &throw("[$arg] is not a Bio::EnsEMBL::Pipeline::RunnableI");
+#      }
+
+      if ($arg->isa("Bio::EnsEMBL::Analysis::Runnable")) {
+	  push(@{$self->{'_runnables'}},$arg);
+      } else {
+	  &throw("[$arg] is not a Bio::EnsEMBL::Analysis::Runnable");
+      }
+    }
+  
+  return @{$self->{'_runnables'}};  
+}
+
+#FIXME kfb 11.01.2006 added output method from Pipeline/RunnableDB. Required by 
+#PairAligner. 
+=head2 output
+
+    Title   :   output
+    Usage   :   $self->output()
+    Function:   
+    Returns :   Array of Bio::EnsEMBL::FeaturePair
+    Args    :   None
+
+=cut
+sub output {
+    my ($self) = @_;
+   
+    $self->{'_output'} = [];
+    
+    my @r = $self->runnable;
+
+
+    if(@r && scalar(@r)){
+      foreach my $r ($self->runnable){
+
+	  #FIXME debug
+	  print STDERR "Process output " . scalar(@{$r->output}) . "\n";
+
+	  #FIXME kfb 12.01.2006 
+        #push(@{$self->{'_output'}}, $r->output);
+        push(@{$self->{'_output'}}, @{$r->output});
+      }
+    }
+
+
+    #FIXME debug
+    print STDERR "_output " . scalar(@{$self->{'_output'}}) . "\n";
+    return @{$self->{'_output'}};
+}
 
 
 1;
-- 
GitLab