From bd3ce1d1cd45f4e89754fe1ce25e9d07adc6edf0 Mon Sep 17 00:00:00 2001
From: Martijn Vermaat <martijn@vermaat.name>
Date: Mon, 25 Feb 2013 12:24:26 +0000
Subject: [PATCH] Warning on non-adjacent exons in transcript reference

git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/trunk@671 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1
---
 mutalyzer/GenRecord.py       |  9 +++++++++
 tests/test_variantchecker.py | 18 ++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/mutalyzer/GenRecord.py b/mutalyzer/GenRecord.py
index cd2eace4..05f40be5 100644
--- a/mutalyzer/GenRecord.py
+++ b/mutalyzer/GenRecord.py
@@ -511,6 +511,15 @@ class GenRecord() :
             for j in i.transcriptList :
                 if not j.mRNA :
                     usableExonList = self.__checkExonList(j.exon, j.CDS)
+                    if self.record.molType == 'n' and j.exon:
+                        if not all(p1 + 1 == p2 for p1, p2 in
+                                   util.grouper(j.exon.positionList[1:-1])):
+                            code = 'WEXON_ANNOTATION' if j.current else 'WEXON_ANNOTATION_OTHER'
+                            self.__output.addMessage(__file__, 2, code,
+                                "Exons for gene %s, transcript variant %s were "
+                                "found not to be adjacent. This signifies a "
+                                "possible problem in the annotation of the "
+                                "reference sequence." % (i.name, j.name))
                     if not j.exon or not usableExonList :
                         if self.record.molType == 'g' :
                             code = 'WNOMRNA' if j.current else 'WNOMRNA_OTHER'
diff --git a/tests/test_variantchecker.py b/tests/test_variantchecker.py
index 4ef4dab5..b4fc0a50 100644
--- a/tests/test_variantchecker.py
+++ b/tests/test_variantchecker.py
@@ -829,3 +829,21 @@ class TestVariantchecker():
         wnomrna = self.output.getMessagesWithErrorCode('WNOMRNA')
         wnomrna_other = self.output.getMessagesWithErrorCode('WNOMRNA_OTHER')
         assert len(wnomrna) == len(wnomrna_other) == 1
+
+    def test_mrna_ref_adjacent_exons_warn(self):
+        """
+        Warning for mRNA reference where exons are not adjacent.
+
+        In L41870.1 exon 15 ends on 1558 and 16 starts on 1636.
+        """
+        check_variant('L41870.1:c.1del', self.output)
+        w_exon_annotation = self.output.getMessagesWithErrorCode('WEXON_ANNOTATION')
+        assert len(w_exon_annotation) == 1
+
+    def test_mrna_ref_adjacent_exons_no_warn(self):
+        """
+        No warning for mRNA reference where exons are adjacent.
+        """
+        check_variant('NM_133378.3:c.1del', self.output)
+        w_exon_annotation = self.output.getMessagesWithErrorCode('WEXON_ANNOTATION')
+        assert len(w_exon_annotation) == 0
-- 
GitLab