From b06b9c6d7cfd6aba8ebaf419dafbd704659c447f Mon Sep 17 00:00:00 2001
From: Stefano Giorgetti <sgiorgetti@ebi.ac.uk>
Date: Fri, 20 Sep 2024 15:29:58 +0000
Subject: [PATCH] Revert regulatory summary and filter EMARs

---
 lib/EnsEMBL/REST/Model/Overlap.pm | 13 ++++---------
 t/overlap.t                       |  8 ++++----
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/lib/EnsEMBL/REST/Model/Overlap.pm b/lib/EnsEMBL/REST/Model/Overlap.pm
index 9c64fe72..2f1da502 100644
--- a/lib/EnsEMBL/REST/Model/Overlap.pm
+++ b/lib/EnsEMBL/REST/Model/Overlap.pm
@@ -160,15 +160,7 @@ sub to_hash {
   my ($self, $features, $feature_type) = @_;
   my @hashed;
   foreach my $feature (@{$features}) {
-
-    my $hash;
-    
-    if (lc($feature_type)  eq 'regulatory') {
-      $hash = $feature->summary_as_hash_2(); 
-    } else {
-      $hash = $feature->summary_as_hash();
-    }
-  
+    my $hash = $feature->summary_as_hash();
     foreach my $key (@KNOWN_NUMERICS) {
       my $v = $hash->{$key};
       $hash->{$key} = ($v*1) if defined $v;
@@ -189,6 +181,9 @@ sub to_hash {
         $hash->{description} = $feature->{$feature_type}->{hdescription} if defined($feature->{$feature_type}->{hdescription});
       }
     }
+    if (lc($feature_type) eq 'regulatory') {
+      next if ($hash->{description} eq 'Epigenetically modified accessible region');
+    }
     push(@hashed, $hash);
   }
   return \@hashed;
diff --git a/t/overlap.t b/t/overlap.t
index 85ad58dc..34b064fd 100644
--- a/t/overlap.t
+++ b/t/overlap.t
@@ -304,13 +304,13 @@ my $base = '/overlap/region/homo_sapiens';
   my $region = '1:76429380..76430144';
   cmp_deeply(json_GET("$base/$region?feature=regulatory", 'Get regulatory_feature'), [{
     id => 'ENSR00000105157',
-    extended_end => 76430144,        
-    extended_start => 76429380,
-    description => 'open_chromatin_region',
+    bound_end => 76430144,
+    bound_start => 76429380,
+    description => 'Open chromatin region',
     end => 76430144,
     feature_type => 'regulatory',
     seq_region_name => 1,
-    source => 'Ensembl',
+    source => 'Regulatory_Build',
     start => 76429380,
     strand => 0
   }], 'Getting regulatory_feature as JSON');
-- 
GitLab