07db8c7cc0e21b21c49d9d37502e12101e54b22d
angie
  Fri Nov 11 20:10:36 2016 +0000
Don't errAbort if an exon edge is not an exon-intron junction but instead an exon-exon junction -- i.e. an alignment gap for a deletion in the reference.  The ideal way to annotate an insertion where the reference has a deletion is an open question.

diff --git src/hg/lib/gpFx.c src/hg/lib/gpFx.c
index 2d91199..7632f6c 100644
--- src/hg/lib/gpFx.c
+++ src/hg/lib/gpFx.c
@@ -869,32 +869,34 @@
 	    // Let the user beware -- this variant is just complex (it overlaps at least one
 	    // exon/intron boundary).  It could be an insertion, an MNV (multi-nt var) or
 	    // a deletion.
 	    struct gpFx *effect = gpFxNew(defaultAltAllele, pred->name, complex_transcript_variant,
 					  none, lm);
 	    effectsList = slCat(effectsList, effect);
 	    }
 	// But we can at least say which introns and/or exons are affected.
 	// Transform exon and intron numbers into ordered integers, -1 (upstream) through
 	// 2*lastExonIx+1 (downstream), with even numbers being exonNum*2 and odd numbers
 	// being intronNum*2 + 1:
 	int vieStart = (2 * txc.startExonIx) + (txc.startInExon ? 0 : 1);
 	int vieEnd = (2 * txc.endExonIx) + (txc.endInExon ? 0 : 1);
 	if (vieEnd < vieStart)
 	    {
-	    // Insertion at exon boundary (or bug)
-	    if (vieEnd != vieStart-1 || varStart != varEnd || txc.startInExon == txc.endInExon)
+	    // vieEnd == vieStart-1 ==> insertion at exon/intron boundary
+            // vieEnd == vieStart-2 ==> insertion at exon-exon boundary (i.e. ref has deletion!)
+	    if ((vieEnd != vieStart-1 && vieEnd != vieStart-2) ||
+                varStart != varEnd)
 		errAbort("gpFxCheckTranscript: expecting insertion in pred=%s "
 			 "but varStart=%d, varEnd=%d, vieStart=%d, vieEnd=%d, "
 			 "starts in %son, ends in %son",
 			 pred->name, varStart, varEnd, vieStart, vieEnd,
 			 (txc.startInExon ? "ex" : "intr"), (txc.endInExon ? "ex" : "intr"));
 	    // Since it's an insertion, remember that end is before start.
 	    if (txc.startInExon)
 		{
 		// Intronic end precedes exonic start. Watch out for upstream as "intron[-1]":
 		if (txc.endExonIx >= 0)
 		    effectsList = slCat(effectsList,
 					gpFxInIntron(variant, &txc, txc.endExonIx, pred, predIsNmd,
 						     defaultAltAllele, lm));
 		effectsList = slCat(effectsList,
 				    gpFxInExon(variant, &txc, txc.startExonIx, pred, predIsNmd,