From 0f9ae074db437d2c838a628993b4234b96b0a552 Mon Sep 17 00:00:00 2001
From: Web Admin <w3adm@sanger.ac.uk>
Date: Tue, 13 Jul 2004 11:58:06 +0000
Subject: [PATCH] addeded feature strand attribute on SliceAdaptor

---
 modules/Bio/EnsEMBL/DBSQL/SequenceAdaptor.pm | 4 ++--
 modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm    | 4 +++-
 modules/Bio/EnsEMBL/MiscFeature.pm           | 9 ++++++++-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/modules/Bio/EnsEMBL/DBSQL/SequenceAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/SequenceAdaptor.pm
index 7f7e4b1ad5..02e1dd92e5 100644
--- a/modules/Bio/EnsEMBL/DBSQL/SequenceAdaptor.pm
+++ b/modules/Bio/EnsEMBL/DBSQL/SequenceAdaptor.pm
@@ -41,8 +41,8 @@ use Bio::EnsEMBL::Utils::Cache;
 
 @ISA = qw(Bio::EnsEMBL::DBSQL::BaseAdaptor);
 
-our $SEQ_CHUNK_PWR   = 18; # 2^18 = approx. 250KB
-our $SEQ_CACHE_SZ    = 5;
+our $SEQ_CHUNK_PWR   = 22; # 2^18 = approx. 250KB
+our $SEQ_CACHE_SZ    = 10;
 our $SEQ_CACHE_MAX   = (2 ** $SEQ_CHUNK_PWR) * $SEQ_CACHE_SZ;
 
 
diff --git a/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
index 32e7b5da33..12a87941d3 100644
--- a/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
+++ b/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm
@@ -925,7 +925,7 @@ sub fetch_by_Feature{
   $size = int( ($1-100)/200 * ($fend-$fstart+1) ) if( $size =~/([\d+\.]+)%/ );
 
   #return a new slice covering the region of the feature
-  return Bio::EnsEMBL::Slice->new
+  my $S = Bio::EnsEMBL::Slice->new
     (-seq_region_name   => $slice->seq_region_name,
      -seq_region_length => $slice->seq_region_length,
      -coord_system      => $slice->coord_system,
@@ -933,6 +933,8 @@ sub fetch_by_Feature{
      -end               => $fend + $size,
      -strand            => 1,
      -adaptor           => $self);
+  $S->{'_raw_feature_strand'}  = $feature->strand * $slice_strand if $feature->can('strand');
+  return $S;
 }
 
 
diff --git a/modules/Bio/EnsEMBL/MiscFeature.pm b/modules/Bio/EnsEMBL/MiscFeature.pm
index ec41942076..95e618251e 100644
--- a/modules/Bio/EnsEMBL/MiscFeature.pm
+++ b/modules/Bio/EnsEMBL/MiscFeature.pm
@@ -240,10 +240,16 @@ sub get_all_attribute_values {
   my @results = map { uc( $_->code() ) eq uc( $code ) ? $_->value : () } @{$self->{'attributes'}};
   return \@results;
 }
+
 sub get_scalar_attribute {
   my $self = shift;
   my $code = shift;
-  my @results = grep { uc( $_->code() ) eq uc( $code )} @{$self->{'attributes'}};
+  my @results;
+  if( $code eq 'name' ) {
+    @results = grep { uc( $_->code() ) eq 'NAME' || uc( $_->code() ) eq 'NON_REF' } @{$self->{'attributes'}};
+  } else {
+    @results = grep { uc( $_->code() ) eq uc( $code )} @{$self->{'attributes'}};
+  }
   return @results ? $results[0]->value() : '';
 }
 
@@ -263,6 +269,7 @@ sub get_scalar_attribute {
 sub display_id {
   my $self = shift;
   my ($attrib) = @{$self->get_all_Attributes('name')};
+  ($attrib) =  @{$self->get_all_Attributes('non_ref')} if(!$attrib);
   ($attrib) =  @{$self->get_all_Attributes('synonym')} if(!$attrib);
   if( defined $attrib ) {
     return $attrib->value();
-- 
GitLab