From 25e0ecd11314a800f29a9c0772c5c5663fa10c3c Mon Sep 17 00:00:00 2001
From: William McLaren <wm2@ebi.ac.uk>
Date: Tue, 19 Jan 2010 16:51:36 +0000
Subject: [PATCH] Fix for partial codons

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

diff --git a/modules/Bio/EnsEMBL/Utils/TranscriptSNPs.pm b/modules/Bio/EnsEMBL/Utils/TranscriptSNPs.pm
index 545fa17bf2..6b71badc4e 100644
--- a/modules/Bio/EnsEMBL/Utils/TranscriptSNPs.pm
+++ b/modules/Bio/EnsEMBL/Utils/TranscriptSNPs.pm
@@ -129,6 +129,9 @@ sub get_all_peptide_variations {
     #calculate the peptide coordinate of the snp
     my $peptide = ($start - $translation_start +
 		   ($codon_length - $codon_pos)) / $codon_length;
+	
+	# skip this SNP if it falls in a partial codon
+	next if $start - $codon_pos + $codon_length > length($cdna);
 
     #retrieve the codon
     my $codon = substr($cdna, $start - $codon_pos-1, $codon_length);
-- 
GitLab