dde2dc8383fa276b091e085197044a61be0ee6ac
angie
  Mon Jan 30 10:44:42 2017 -0800
Fix for mapping HGVS to genome when both start and end are upstream of a transcript.  Previously, both start and end were set to 0 so the transcript was 0-length and not mapped by pslTransMap.  hgFixed fell through to display the whole transcript.  Now it maps to the correct location.  Example term: NM_016176.3:c.-562A>C

diff --git src/hg/lib/hgHgvs.c src/hg/lib/hgHgvs.c
index 22729cf..27b2d50 100644
--- src/hg/lib/hgHgvs.c
+++ src/hg/lib/hgHgvs.c
@@ -1011,32 +1011,32 @@
     *retUpstreamBases = -(*retStart - maxCoord + 1);
     *retStart = maxCoord - 1;
     }
 else
     *retUpstreamBases = 0;
 if (*retEnd > maxCoord)
     {
     // hgvs->end is downstream of coding transcript.
     *retDownstreamBases = *retEnd - maxCoord;
     *retEnd = maxCoord;
     }
 else if (*retEnd < 0)
     {
     // Even the end coord is upstream of coding transcript -- make a negative "downstream"
     // for adjusting end.
-    *retDownstreamBases = *retEnd;
-    *retEnd = 0;
+    *retEnd += *retUpstreamBases;
+    *retDownstreamBases = -*retUpstreamBases;
     }
 else
     *retDownstreamBases = 0;
 }
 
 static struct psl *pslFromHgvsNuc(struct hgvsVariant *hgvs, char *acc, int accSize, int accEnd,
                                   struct genbankCds *cds,
                                   int *retUpstreamBases, int *retDownstreamBases)
 /* Allocate and return a PSL modeling the variant in nucleotide sequence acc.
  * The PSL target is the sequence and the query is the changed part of the sequence.
  * accEnd is given in case accSize includes an unaligned poly-A tail.
  * If hgvs is coding ("c.") then the caller must pass in a valid cds.
  * In case the start or end position is outside the bounds of the sequence, set retUpstreamBases
  * or retDownstreamBases to the number of bases beyond the beginning or end of sequence.
  * NOTE: coding intron offsets are ignored; the PSL contains the exon anchor point