From 3c3c249c1c3b9d042cbc69f191485a4656ffaec0 Mon Sep 17 00:00:00 2001
From: Web Admin <w3adm@sanger.ac.uk>
Date: Wed, 12 Apr 2006 21:34:23 +0000
Subject: [PATCH] added another scalar_attribute rapper
 get_first_scalar_attibute which gets first non-null value from a list of IDs

---
 modules/Bio/EnsEMBL/MiscFeature.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/modules/Bio/EnsEMBL/MiscFeature.pm b/modules/Bio/EnsEMBL/MiscFeature.pm
index e6e79e1713..93abddd7fd 100644
--- a/modules/Bio/EnsEMBL/MiscFeature.pm
+++ b/modules/Bio/EnsEMBL/MiscFeature.pm
@@ -325,6 +325,14 @@ sub get_scalar_attribute {
   return @results ? $results[0]->value() : '';
 }
 
+sub get_first_scalar_attribute {
+  my $self = shift;
+  foreach my $code ( @_ ) {
+    my @results = grep { uc( $_->code() ) eq uc( $code )} @{$self->{'attributes'}};
+    return $results[0]->value() if @results;
+  }
+  return '';
+}
 =head2 display_id
 
   Arg [1]    : none
-- 
GitLab