From 5aa3583b326ec5b1620fd16e051675a033fad19c Mon Sep 17 00:00:00 2001
From: Yuan Chen <yuan@sanger.ac.uk>
Date: Wed, 20 Jul 2005 15:31:46 +0000
Subject: [PATCH] add upstream/downstream flanking 5kb around transcript when
 consider a variation is involved in the transcript

---
 modules/Bio/EnsEMBL/Utils/TranscriptAlleles.pm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/Bio/EnsEMBL/Utils/TranscriptAlleles.pm b/modules/Bio/EnsEMBL/Utils/TranscriptAlleles.pm
index 9f2f628a59..8434ae6f1b 100644
--- a/modules/Bio/EnsEMBL/Utils/TranscriptAlleles.pm
+++ b/modules/Bio/EnsEMBL/Utils/TranscriptAlleles.pm
@@ -172,10 +172,19 @@ sub calculate_same_codon{
 sub type_variation {
   my $tr  = shift;
   my $var = shift;
+
+  my $UPSTREAM = 5000;
+  my $DOWNSTREAM = 5000;
+
   if (!$var->isa('Bio::EnsEMBL::Variation::ConsequenceType')){
       throw("Not possible to calculate the consequence type for ",ref($var)," : Bio::EnsEMBL::Variation::ConsequenceType object expected");
   }
 
+  if (($var->start < $tr->start - $UPSTREAM) || ($var->end  > $tr->end + $DOWNSTREAM)){
+    #since the variation is more than UPSTREAM and DOWNSTREAM of the transcript, there is no effect in the transcript
+    return [];
+  }
+
   my $tm = $tr->get_TranscriptMapper();
   my @coords = $tm->genomic2cdna($var->start,
                                  $var->end,
-- 
GitLab