a879c24ca720e1de4c34d4a1e3407f4baa0259d6
braney
  Mon Dec 14 15:35:45 2020 -0800
some tweaks to sequence output from bigPsl if they have sequence and
maybe cds

diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 4649d02..c143ca3 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -3111,56 +3111,48 @@
 boolean firstTime = TRUE;
 for (bb = bbList; bb != NULL; bb = bb->next)
     {
     bbiCachedChromLookup(bbi, bb->chromId, lastChromId, chromName, sizeof(chromName));
 
     lastChromId=bb->chromId;
     bigBedIntervalToRow(bb, chromName, startBuf, endBuf, bedRow, 4);
     if (showEvery || sameString(bedRow[3], item))
 	{
         char *cdsStr, *seq;
         struct psl *psl= pslFromBigPsl(chromName, bb, seqTypeField, &seq, &cdsStr);
         slAddHead(&pslList, psl);
 
         // we're assuming that if there are multiple psl's with the same id that
         // they are the same query sequence so we only put out one set of sequences
-        if (firstTime)  
+        if (firstTime  && !isEmpty(seq))    // if there is a query sequence
             {
             firstTime = FALSE;
             printf("<H3>Links to sequence:</H3>\n");
             printf("<UL>\n");
 
-            if (!isEmpty(seq))    // if there is a query sequence
-                {
             if (!isEmpty(cdsStr))  // if we have CDS 
                 {
                 puts("<LI>\n");
                 hgcAnchorSomewhere("htcTranslatedBigPsl", item, "translate", seqName);
                 printf("Translated Amino Acid Sequence</A> from Query Sequence\n");
                 puts("</LI>\n");
                 }
 
             puts("<LI>\n");
             hgcAnchorSomewhere("htcBigPslSequence", item, tdb->track, seqName);
             printf("Query Sequence</A> \n");
             puts("</LI>\n");
-                }
-
-            puts("<LI>\n");
-            hgcAnchorSomewhere("htcGeneInGenome", item, tdb->track, seqName);
-            printf("Genomic Sequence</A> from assembly\n");
-            puts("</LI>\n");
             printf("</UL>\n");
             }
 	}
     }
 
 char *sort = cartUsualString(cart, "sort", pslSortList[0]);
 pslSortListByVar(&pslList, sort);
 
 if (showEvery)
     printf("<H3>Genomic Alignments</H3>");
 else
     printf("<H3>%s/Genomic Alignments</H3>", item);
 if (showEvery || pslIsProtein(pslList))
     printAlignmentsSimple(pslList, start, "htcBigPslAli", tdb->table, item);
 else
@@ -8639,31 +8631,36 @@
 }
 
 void htcBigPsl( char *acc, boolean translate)
 /* Output bigPsl query sequence, translated to amino acid sequence if requested. */
 {
 struct sqlConnection *conn = NULL;
 
 if (!trackHubDatabase(database))
     conn = hAllocConn(database);
 
 int start = cartInt(cart, "l");
 int end = cartInt(cart, "r");
 char *table = cartString(cart, "table");
 
 struct trackDb *tdb ;
-if (isHubTrack(table))
+if (isCustomTrack(table))
+    {
+    struct customTrack *ct = lookupCt(table);
+    tdb = ct->tdb;
+    }
+else if (isHubTrack(table))
     tdb = hubConnectAddHubForTrackAndFindTdb( database, table, NULL, trackHash);
 else
     tdb = hashFindVal(trackHash, table);
 char *fileName = bbiNameFromSettingOrTable(tdb, conn, tdb->table);
 struct bbiFile *bbi = bigBedFileOpen(fileName);
 struct lm *lm = lmInit(0);
 int ivStart = start, ivEnd = end;
 if (start == end)
     {  
     // item is an insertion; expand the search range from 0 bases to 2 so we catch it:
     ivStart = max(0, start-1);
     ivEnd++;
     }  
 
 unsigned seqTypeField =  bbExtraFieldIndex(bbi, "seqType");