From f0cdbdeace5a284a03f07894d312a6d32dc7e12e Mon Sep 17 00:00:00 2001
From: Kieron Taylor <ktaylor@ebi.ac.uk>
Date: Mon, 24 Sep 2012 10:34:51 +0000
Subject: [PATCH] Added a 'flag' at Genebuilder request to allow them to switch
 off collection of NMD choices. They want to investigate these cases. Hacky
 job for a hacky script.

---
 misc-scripts/canonical_transcripts/reason_changes.pl | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/misc-scripts/canonical_transcripts/reason_changes.pl b/misc-scripts/canonical_transcripts/reason_changes.pl
index f26ae38b99..3bd96cf5b7 100755
--- a/misc-scripts/canonical_transcripts/reason_changes.pl
+++ b/misc-scripts/canonical_transcripts/reason_changes.pl
@@ -9,6 +9,11 @@
 #   - Transcript length (longest)
 #   - Translation length (longest)
 #
+# A not so normal scenario is the choice of an NMD over an Ensembl protein
+# coder. To emit these in all their glory, add NMD to the command line. e.g.
+#
+# perl reason_changes.pl logfile NMD
+#
 # If it was not one of these we will complain bitterly and you should
 # investigate. If it is a known reason after investigation, that is an
 # allowed scenario, then code it into this script.
@@ -20,6 +25,7 @@ use warnings;
 use JSON;
 
 my $file = $ARGV[0];
+my $blurt = $ARGV[1] ;
 
 if(! $file) {
   die "Was not given a file. Command is $0 PATH_TO_FILE";
@@ -77,7 +83,8 @@ sub compare {
       $old->[2] == 3 &&         #Old was an Ensembl/Havana transcript
       $new->[2] == 2 &&         #New was E! Havana merged 
       $old->[3] == 1 &&         #Old was a Protein Coding
-      $new->[3] == 2            #New was a "NMD"
+      $new->[3] == 2 &&         #New was a "NMD"
+      $blurt !~ /nmd/i          #User suppressing this test     
       ) {
       $reason_key = 'havana_merge_nmd_over_e_coding';
     }
-- 
GitLab