a1c329068ad18aa4093972b501e6324f8bcdb398
angie
  Fri Sep 16 17:19:30 2016 -0700
Parse HGVS position ranges and coding terms' UTR and intron coordinates.
When the chromAlias table is present, this also now supports NC_*:g. terms.
The sequence change part is no longer parsed -- it's not necessary for mapping
to genomic ranges, although it will be necessary in order for hgVai to take
HGVS input.
This does not yet support ranges-of-ranges but neither does Mutalyzer.  This
also doesn't support uncertain positions ('?').  Like complex sequence changes,
those can wait until we have a sophisticated parser.
We also support some new not-quite-HGVS forms: geneSymbol and protein pos only,
or geneSymbol and c.<valid position range>.
refs #15071

diff --git src/hg/lib/hgFind.c src/hg/lib/hgFind.c
index 78da647..5e4bdbb 100644
--- src/hg/lib/hgFind.c
+++ src/hg/lib/hgFind.c
@@ -3079,42 +3079,48 @@
         warn("Can't find accession for HGVS term '%s'", term);
     else
         {
         int hgvsVersion = getDotVersion(hgvs->seqAcc);
         char foundAccWithV[strlen(foundAcc)+20];
         if (foundVersion)
             safef(foundAccWithV, sizeof(foundAccWithV), "%s.%d", foundAcc, foundVersion);
         else
             safecpy(foundAccWithV, sizeof(foundAccWithV), foundAcc);
         if (hgvsVersion && hgvsVersion != foundVersion)
             warn("HGVS term '%s' is based on %s but UCSC has version %s",
                  term, hgvs->seqAcc, foundAccWithV);
         if (! coordsOk)
             warn("HGVS term '%s' has coordinates outside the bounds of %s", term, foundAccWithV);
         else if (diffRefAllele != NULL)
-            warn ("HGVS term '%s' reference value '%s' does not match %s value '%s'",
-                  term, hgvs->refAllele, foundAccWithV, diffRefAllele);
+            warn ("HGVS term '%s' reference value does not match %s value '%s'",
+                  term, foundAccWithV, diffRefAllele);
         if (coordsOk)
             {
             char *pslTable = NULL;
-            struct psl *mapping = hgvsMapToGenome(db, hgvs, &pslTable);
+            struct bed3 *mapping = hgvsMapToGenome(db, hgvs, &pslTable);
             if (mapping)
                 {
                 int padding = 5;
-                char *trackTable = startsWith("lrg", pslTable) ? "lrgTranscriptAli" : "refGene";
+                char *trackTable;
+                if (isEmpty(pslTable))
+                    trackTable = "chromInfo";
+                else if (startsWith("lrg", pslTable))
+                    trackTable = "lrgTranscriptAli";
+                else
+                    trackTable = "refGene";
                 singlePos(hgp, "HGVS", NULL, trackTable, term, "",
-                          mapping->tName, mapping->tStart-padding, mapping->tEnd+padding);
+                          mapping->chrom, mapping->chromStart-padding, mapping->chromEnd+padding);
                 foundIt = TRUE;
                 }
             }
         }
     }
 return foundIt;
 }
 
 struct hgPositions *hgPositionsFind(char *db, char *term, char *extraCgi,
 	char *hgAppNameIn, struct cart *cart, boolean multiTerm)
 /* Return table of positions that match term or NULL if none such. */
 {
 struct hgPositions *hgp = NULL, *hgpItem = NULL;
 regmatch_t substrs[4];
 boolean canonicalSpec = FALSE;