05e67c59a20a5d00b810a981aef3b00c5bef82e1
max
  Fri Sep 20 06:03:18 2024 -0700
more features to hubtools: search in both parent and subdirs, better docs

diff --git src/hg/lib/hgFind.c src/hg/lib/hgFind.c
index 6b2d76e..18b4c1f 100644
--- src/hg/lib/hgFind.c
+++ src/hg/lib/hgFind.c
@@ -3577,30 +3577,33 @@
     int chromEnd; // end of position
     struct slName *validTranscripts; // valid transcripts/protein accessions for this position
     char *label; // corresponding hgvs term
     char *table; // type of match, LRG, NCBI, etc
     boolean mapError; // does this hgvs mapping result in a map error?
     };
 
 static boolean matchesHgvs(struct cart *cart, char *db, char *term, struct hgPositions *hgp,
                             boolean measureTiming)
 /* Return TRUE if the search term looks like a variant encoded using the HGVS nomenclature
  * See http://varnomen.hgvs.org/
  * If search term is a pseudo hgvs term like GeneName AminoAcidPosition (RUNX2 Arg155) and
  * matches more than one transcript, fill out the hgp with the potential matches so the user
  * can choose where to go, otherwise return a singlePos */
 {
+printf("got to matches hgvs ");
+cartSetString(cart, "FOOBAR", "YES");
+
 boolean foundIt = FALSE;
 long startTime = clock1000();
 struct hgvsVariant *hgvsList = hgvsParseTerm(term);
 if (hgvsList == NULL)
     hgvsList = hgvsParsePseudoHgvs(db, term);
 if (hgvsList)
     {
     struct hgvsVariant *hgvs = NULL;
     int hgvsListLen = slCount(hgvsList);
     struct hgPosTable *table;
     AllocVar(table);
     table->description = "HGVS";
     table->searchTime = -1;
     int padding = 5;
     int mapErrCnt = 0;
@@ -3733,30 +3736,43 @@
             pos->browserName = term;
             slAddHead(&table->posList, pos);
             // highlight the 'mapped' bases to distinguish from padding
             hgp->tableList->posList->highlight = addHighlight(db, helper->chrom, spanStart, spanEnd);
             warn("%s", dyStringContents(allWarnings));
             warn("Sorry, couldn't locate %s, moving to general location", term);
             }
         else
             warn("%s", dyStringContents(dyWarn));
         }
     dyStringFree(&dyWarn);
     dyStringFree(&allWarnings);
     if (measureTiming && hgp && hgp->tableList)
         table->searchTime = clock1000() - startTime;
     }
+
+if (foundIt && hgp->tableList && hgp->tableList->posList) 
+    {
+    struct hgPos *pos = hgp->tableList->posList;
+
+    char buf[1024];
+    safef(buf, 1024, "%s:%d-%d", pos->chrom, pos->chromStart, pos->chromEnd);
+    cartSetString(cart, "lastHgvsPos", buf);
+
+    cartSetString(cart, "lastHgvsDb", db);
+    cartSetString(cart, "lastHgvsTerm", term);
+    }
+
 return foundIt;
 }
 
 struct hgPositions *hgPositionsFind(char *db, char *term, char *extraCgi,
 	char *hgAppNameIn, struct cart *cart, boolean multiTerm, boolean measureTiming, struct searchCategory *categories)
 /* Return container of tracks and positions (if any) that match term. */
 {
 struct hgPositions *hgp = NULL, *hgpItem = NULL;
 regmatch_t substrs[4];
 boolean canonicalSpec = FALSE;
 boolean gbrowserSpec = FALSE;
 boolean lengthSpec = FALSE;
 boolean singleBaseSpec = FALSE;
 boolean relativeFlag = FALSE;
 int relStart = 0, relEnd = 0;
@@ -3802,30 +3818,32 @@
             start = start + relStart;
             if (end > chromSize)
                 end = chromSize;
             if (start < 0)
                 start = 0;
             }
         singlePos(hgp, "Chromosome Range", NULL, "chromInfo", originalTerm,
               "", chrom, start, end);
         }
     else if (!matchesHgvs(cart, db, term, hgp, measureTiming))
         userDefinedSearch(db, term, limitResults, cart, hgp, categories, multiTerm, measureTiming);
     slReverse(&hgp->tableList);
     if (multiTerm)
         collapseSamePos(hgp);
     fixSinglePos(hgp);
+    printf("Found HGVS?");
+    cartSetString(cart, "FOORBAR2", "TEST");
     if (cart && hgp->singlePos && isNotEmpty(hgp->singlePos->highlight))
         cartSetString(cart, "addHighlight", hgp->singlePos->highlight);
     if (hgp->posCount > 0)
         return hgp;
     else
         // if categories was passed in we should explicitly return no results
         // if there weren't any
         return NULL;
     }
 
 /* Allow any search term to end with a :Start-End range -- also support stuff 
  * pasted in from BED (chrom start end) or SQL query (chrom | start | end).  
  * If found, strip it off and remember the start and end. */
 char *originalTerm = term;
 if ((canonicalSpec =