ff9313091f342ffe62a124427b5c9d6a516faaea
hiram
  Thu Oct 15 15:03:07 2015 -0700
fixup gcc warnings for -Wunused-but-set-variable refs #16121

diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index e89235c..8f0d449 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -1334,41 +1334,30 @@
     atomStaticLoad(row, &ret);
     //atomOutput(&ret, stdout, '\t', '\n');
     linkToOtherBrowser(ret.species, ret.chrom, ret.start, ret.end);
     if (sameString(ret.chrom, seqName) && (start  == ret.start) &&
 	sameString(ret.species, database))
 	printf("* ");
     else
         printf("  ");
     printf( "%4d %-10s %-5s %12d %12d %10d      %c      %-10s %-10s\n",
             ret.instance, ret.species,ret.chrom, ret.start + 1, ret.end,
             ret.end - ret.start + 1, ret.strand[0],ret.fivePrime,ret.threePrime);
     }
 printf("</A>");
 sqlFreeResult(&sr);
 
-#if 0
-//struct tempName launchFile;
-char *fileName = "../trash/braney.launch";
-FILE *launchF;
-//trashDirFile(&launchFile, "braney", "launch", ".txt");
-//printf("writing %s\n",fileName);
-launchF = mustOpen(fileName, "w");
-fprintf(launchF, "%s\n", item);
-fclose(launchF);
-#endif
-
 if (!sameString("atom20080226d", table))
     return;
 
 printf("<TABLE>");
 printf("<THEAD>");
 printf("<TBODY>");
 printf("<TR><TH>");
 printf("Suh Trees<BR>\n");
 printf("<IMG src=http://hgwdev.cse.ucsc.edu/~braney/suhTrees/%s.tt.png><BR>",item);
 printf("<TD><IMG src=http://hgwdev.cse.ucsc.edu/~braney/suhTrees/%s.gt.png><BR>",item);
 printf("<TR><TH>");
 printf("NJ Trees<BR>\n");
 printf("<IMG src=http://hgwdev.cse.ucsc.edu/~braney/njTrees/%s.tt.png><BR>",item);
 printf("<TD><IMG src=http://hgwdev.cse.ucsc.edu/~braney/njTrees/%s.gt.png><BR>",item);
 printf("<TR><TH>");
@@ -2298,31 +2287,31 @@
         freeDyString(&dyT);
         freeDyString(&dyQ);
         freeDyString(&dyQprot);
         freeDyString(&dyTprot);
         }
     }
 }
 
 struct axt *getAxtListForGene(struct genePred *gp, char *nib, char *fromDb, char *toDb,
 		       struct lineFile *lf)
 /* get all axts for a gene */
 {
 struct axt *axt, *axtGap;
 struct axt *axtList = NULL;
 int prevEnd = gp->txStart;
-int prevStart = gp->txEnd;
+// int prevStart = gp->txEnd;  unused variable
 int tmp;
 
 while ((axt = axtRead(lf)) != NULL)
     {
     if (sameString(gp->chrom, axt->tName)
     &&  (  (  (axt->tStart <= gp->cdsStart && axt->tEnd >= gp->cdsStart)
            || (axt->tStart <= gp->cdsEnd   && axt->tEnd >= gp->cdsEnd  ) )
         || (   axt->tStart <  gp->cdsEnd   && axt->tEnd >  gp->cdsStart  ) ) )
         {
         if (gp->strand[0] == '-')
             {
             reverseComplement(axt->qSym, axt->symCount);
             reverseComplement(axt->tSym, axt->symCount);
             tmp = hChromSize(fromDb, axt->qName) - axt->qStart;
             axt->qStart = hChromSize(fromDb, axt->qName) - axt->qEnd;
@@ -2330,31 +2319,31 @@
             if (prevEnd < (axt->tStart)-1)
                 {
                 axtGap = createAxtGap(nib,gp->chrom,prevEnd,(axt->tStart),gp->strand[0]);
                 reverseComplement(axtGap->qSym, axtGap->symCount);
                 reverseComplement(axtGap->tSym, axtGap->symCount);
                 slAddHead(&axtList, axtGap);
                 }
             }
         else if (prevEnd < (axt->tStart))
             {
             axtGap = createAxtGap(nib,gp->chrom,prevEnd,(axt->tStart),gp->strand[0]);
             slAddHead(&axtList, axtGap);
             }
         slAddHead(&axtList, axt);
         prevEnd = axt->tEnd;
-        prevStart = axt->tStart;
+        // prevStart = axt->tStart;  unused variable
         }
     if (sameString(gp->chrom, axt->tName) && (axt->tStart > gp->txEnd))
         {
         if ((prevEnd < axt->tStart) && prevEnd < min(gp->txEnd, axt->tStart))
             {
             axtGap = createAxtGap(nib,gp->chrom,prevEnd,min(axt->tStart,gp->txEnd),gp->strand[0]);
             if (gp->strand[0] == '-')
                 {
                 reverseComplement(axtGap->qSym, axtGap->symCount);
                 reverseComplement(axtGap->tSym, axtGap->symCount);
                 }
             slAddHead(&axtList, axtGap);
             }
         else
             if (axtList == NULL)
@@ -2371,31 +2360,31 @@
         }
     }
 if (gp->strand[0] == '+')
     slReverse(&axtList);
 return axtList ;
 }
 
 struct axt *getAxtListForRange(struct genePred *gp, char *nib, char *fromDb, char *toDb,
 		       char *alignment, char *qChrom, int qStart, int qEnd)
 /* get all axts for a chain */
 {
 struct lineFile *lf ;
 struct axt *axt, *axtGap;
 struct axt *axtList = NULL;
 int prevEnd = gp->txStart;
-int prevStart = gp->txEnd;
+// int prevStart = gp->txEnd;  unused variable
 int tmp;
 
 lf = lineFileOpen(getAxtFileName(gp->chrom, toDb, alignment, fromDb), TRUE);
 printf("file %s\n",lf->fileName);
 while ((axt = axtRead(lf)) != NULL)
     {
 /*    if (sameString(gp->chrom , axt->tName))
  *       printf("axt %s qstart %d axt tStart %d\n",axt->qName, axt->qStart,axt->tStart); */
     if ( sameString(gp->chrom, axt->tName)
     &&   sameString(   qChrom, axt->qName)
     &&   positiveRangeIntersection(     qStart,      qEnd, axt->qStart, axt->qEnd)
     &&   positiveRangeIntersection(gp->txStart, gp->txEnd, axt->tStart, axt->tEnd) )
         {
         if (gp->strand[0] == '-')
             {
@@ -2407,31 +2396,31 @@
             if (prevEnd < (axt->tStart)-1)
                 {
                 axtGap = createAxtGap(nib,gp->chrom,prevEnd,(axt->tStart)-1,gp->strand[0]);
                 reverseComplement(axtGap->qSym, axtGap->symCount);
                 reverseComplement(axtGap->tSym, axtGap->symCount);
                 slAddHead(&axtList, axtGap);
                 }
             }
         else if (prevEnd < (axt->tStart)-1)
             {
             axtGap = createAxtGap(nib,gp->chrom,prevEnd,(axt->tStart)-1,gp->strand[0]);
             slAddHead(&axtList, axtGap);
             }
         slAddHead(&axtList, axt);
         prevEnd = axt->tEnd;
-        prevStart = axt->tStart;
+        // prevStart = axt->tStart;  unused variable
         }
     if (sameString(gp->chrom, axt->tName) && (axt->tStart > gp->txEnd+20000))
         {
         if (axt->tStart > prevEnd)
             {
             axtGap = createAxtGap(nib,gp->chrom,prevEnd+1,(axt->tStart)-1,gp->strand[0]);
             if (gp->strand[0] == '-')
                 {
                 reverseComplement(axtGap->qSym, axtGap->symCount);
                 reverseComplement(axtGap->tSym, axtGap->symCount);
                 }
             slAddHead(&axtList, axtGap);
             }
         break;
         }
@@ -3478,49 +3467,45 @@
 if (net->qNewR >= 0)
     printLabeledPercent(otherOrg, "new repeat bases", net->qOldR, qSize);
 if (net->tEnd >= net->tStart)
     printLabeledNumber(org, "size", net->tEnd - net->tStart);
 if (net->qEnd >= net->qStart)
     printLabeledNumber(otherOrg, "size", net->qEnd - net->qStart);
 printf("<BR>Fields above refer to entire chain or gap, not just the part inside the window.<BR>\n");
 netAlignFree(&net);
 }
 
 void tfbsConsSites(struct trackDb *tdb, char *item)
 /* detail page for tfbsConsSites track */
 {
 boolean printedPlus = FALSE;
 boolean printedMinus = FALSE;
-char *dupe, *words[16];
-int wordCount;
 int start = cartInt(cart, "o");
 struct sqlConnection *conn = hAllocConn(database);
 char table[64];
 boolean hasBin;
 char query[512];
 struct sqlResult *sr;
 char **row;
 struct tfbsConsSites *tfbsConsSites;
 struct tfbsConsSites *tfbsConsSitesList = NULL;
 struct tfbsConsFactors *tfbsConsFactor;
 struct tfbsConsFactors *tfbsConsFactorList = NULL;
 boolean firstTime = TRUE;
 char *mappedId = NULL;
 
-dupe = cloneString(tdb->type);
 genericHeader(tdb, item);
-wordCount = chopLine(dupe, words);
 
 hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
 sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s' and chromStart = %d",
 	    table, item, seqName, start);
 sr = sqlGetResult(conn, query);
 
 while ((row = sqlNextRow(sr)) != NULL)
     {
     tfbsConsSites = tfbsConsSitesLoad(row+hasBin);
     slAddHead(&tfbsConsSitesList, tfbsConsSites);
     }
 sqlFreeResult(&sr);
 slReverse(&tfbsConsSitesList);
 
 hFindSplitTable(database, seqName, "tfbsConsFactors", table, &hasBin);
@@ -3565,58 +3550,53 @@
     {
     htmlHorizontalLine();
     printf("<B style='font-size:large;'>Transcription Factors known to bind to this site:</B><BR><BR>");
     for(tfbsConsFactor =tfbsConsFactorList ; tfbsConsFactor  != NULL ; tfbsConsFactor  = tfbsConsFactor ->next)
 	{
 	if (!sameString(tfbsConsFactor->species, "N"))
 	    {
 	    printf("<BR><B>Factor:</B> %s<BR>\n", tfbsConsFactor->factor);
 	    printf("<B>Species:</B> %s<BR>\n", tfbsConsFactor->species);
 	    printf("<B>SwissProt ID:</B> %s<BR>\n", sameString(tfbsConsFactor->id, "N")? "unknown": tfbsConsFactor->id);
 	    }
 	}
     }
 
 printTrackHtml(tdb);
-freez(&dupe);
 hFreeConn(&conn);
 }
 
 void tfbsCons(struct trackDb *tdb, char *item)
 /* detail page for tfbsCons track */
 {
 boolean printFactors = FALSE;
 boolean printedPlus = FALSE;
 boolean printedMinus = FALSE;
-char *dupe, *words[16];
-int wordCount;
 int start = cartInt(cart, "o");
 struct sqlConnection *conn = hAllocConn(database);
 char table[64];
 boolean hasBin;
 char query[512];
 struct sqlResult *sr;
 char **row;
 struct tfbsCons *tfbs;
 struct tfbsCons *tfbsConsList = NULL;
 struct tfbsConsMap tfbsConsMap;
 boolean firstTime = TRUE;
 char *mappedId = NULL;
 
-dupe = cloneString(tdb->type);
 genericHeader(tdb, item);
-wordCount = chopLine(dupe, words);
 
 hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
 sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s' and chromStart = %d",
 	    table, item, seqName, start);
 sr = sqlGetResult(conn, query);
 
 while ((row = sqlNextRow(sr)) != NULL)
     {
     tfbs = tfbsConsLoad(row+hasBin);
     slAddHead(&tfbsConsList, tfbs);
     }
 sqlFreeResult(&sr);
 slReverse(&tfbsConsList);
 
 if (hTableExists(database, "tfbsConsMap"))
@@ -3665,74 +3645,68 @@
 	/* print only the positive strand when factors are on both strands */
 	if ((tfbs->strand[0] == '-') && printedPlus)
 	    continue;
 
 	if (!sameString(tfbs->species, "N"))
 	    {
 	    printf("<BR><B>Factor:</B> %s<BR>\n", tfbs->factor);
 	    printf("<B>Species:</B> %s<BR>\n", tfbs->species);
 	    printf("<B>SwissProt ID:</B> %s<BR>\n", sameString(tfbs->id, "N")? "unknown": tfbs->id);
 
 	    }
 	}
     }
 
 printTrackHtml(tdb);
-freez(&dupe);
 hFreeConn(&conn);
 }
 
 void firstEF(struct trackDb *tdb, char *item)
 {
-char *dupe, *words[16];
-int wordCount;
 int start = cartInt(cart, "o");
 struct sqlConnection *conn = hAllocConn(database);
 char table[64];
 boolean hasBin;
 struct bed *bed;
 char query[512];
 struct sqlResult *sr;
 char **row;
 boolean firstTime = TRUE;
 
 /* itemForUrl = item; */
-dupe = cloneString(tdb->type);
 genericHeader(tdb, item);
-wordCount = chopLine(dupe, words);
 printCustomUrl(tdb, item, FALSE);
 /* printCustomUrl(tdb, itemForUrl, item == itemForUrl); */
 
 hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
 sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s' and chromStart = %d",
 	    table, item, seqName, start);
 sr = sqlGetResult(conn, query);
 while ((row = sqlNextRow(sr)) != NULL)
     {
     if (firstTime)
 	firstTime = FALSE;
     else
 	htmlHorizontalLine();
     bed = bedLoadN(row+hasBin, 6);
 
     printf("<B>Item:</B> %s<BR>\n", bed->name);
     printf("<B>Probability:</B> %g<BR>\n", bed->score / 1000.0);
     printf("<B>Strand:</B> %s<BR>\n", bed->strand);
     printPos(bed->chrom, bed->chromStart, bed->chromEnd, NULL, TRUE, bed->name);
     }
 printTrackHtml(tdb);
-freez(&dupe);
 hFreeConn(&conn);
 }
 
 void doBed5FloatScore(struct trackDb *tdb, char *item)
 /* Handle click in BED 5+ track: BED 5 with 0-1000 score (for useScore
  * shading in hgTracks) plus real score for display in details page. */
 {
 struct sqlConnection *conn = hAllocConn(database);
 struct sqlResult *sr = NULL;
 char table[64];
 boolean hasBin;
 struct bed5FloatScore *b5;
 struct dyString *query = newDyString(512);
 char **row;
 boolean firstTime = TRUE;
@@ -5287,58 +5261,58 @@
 if ((s = skipLeadingSpaces(s)) != NULL && s[0] != 0)
     {
     int len = strlen(s);
     appendAuthor(dy, s, len);
     }
 }
 
 /* --- !!! Riken code is under development Fan. 4/16/02 */
 void printRikenInfo(char *acc, struct sqlConnection *conn )
 /* Print Riken annotation info */
 {
 struct sqlResult *sr;
 char **row;
 char query[512];
 char *seqid, *accession, *comment;
-char *qualifier, *anntext, *datasrc, *srckey, *href, *evidence;
+// char *qualifier, *anntext, *datasrc, *srckey, *href, *evidence;
 
 accession = acc;
 sqlSafef(query, sizeof(query),
          "select seqid from rikenaltid where altid='%s';", accession);
 sr = sqlMustGetResult(conn, query);
 row = sqlNextRow(sr);
 
 if (row != NULL)
     {
     seqid=cloneString(row[0]);
 
     sqlSafef(query, sizeof(query),
              "select Qualifier, Anntext, Datasrc, Srckey, Href, Evidence "
              "from rikenann where seqid='%s';", seqid);
 
     sqlFreeResult(&sr);
     sr = sqlMustGetResult(conn, query);
     row = sqlNextRow(sr);
 
     while (row !=NULL)
 	{
-	qualifier = row[0];
-	anntext   = row[1];
-	datasrc   = row[2];
-	srckey    = row[3];
-	href      = row[4];
-        evidence  = row[5];
+	// qualifier = row[0];  unused variable
+	// anntext   = row[1];  unused variable
+	// datasrc   = row[2];  unused variable
+	// srckey    = row[3];  unused variable
+	// href      = row[4];  unused variable
+        // evidence  = row[5];  unused variable
         row = sqlNextRow(sr);
         }
 
     sqlSafef(query, sizeof(query),
              "select comment from rikenseq where id='%s';", seqid);
     sqlFreeResult(&sr);
     sr = sqlMustGetResult(conn, query);
     row = sqlNextRow(sr);
 
     if (row != NULL)
 	{
 	comment = row[0];
 	printf("<B>Riken/comment:</B> %s<BR>\n",comment);
 	}
     }
@@ -5435,36 +5409,37 @@
 assert(msg != NULL);
 char *msg2= "Care should be taken in using alignments of this sequence as evidence of transcription.";
 printf("<B>Warning:<span style='color:red;'> %s %s %s</span></B><BR>\n", acc, msg, msg2);
 }
 
 static void printRnaSpecs(struct trackDb *tdb, char *acc, struct psl *psl)
 /* Print auxiliarry info on RNA. */
 {
 struct dyString *dy = newDyString(1024);
 struct sqlConnection *conn = hAllocConn(database);
 struct sqlConnection *conn2= hAllocConn(database);
 struct sqlResult *sr;
 char **row;
 char rgdEstId[512];
 char query[256];
-char *type,*direction,*source,*orgFullName,*library,*clone,*sex,*tissue,
+char *type,*direction,*orgFullName,*library,*clone,*sex,*tissue,
     *development,*cell,*cds,*description, *author,*geneName,
     *date,*productName;
-int seqSize,fileSize;
-long fileOffset;
-char *ext_file;
+// char *source;  unused variable
+// int seqSize,fileSize;  unused variables
+// long fileOffset;  unused variable
+// char *extFile;    unused variable
 boolean hasVersion = hHasField(database, "gbCdnaInfo", "version");
 boolean haveGbSeq = sqlTableExists(conn, "gbSeq");
 char *seqTbl = haveGbSeq ? "gbSeq" : "seq";
 char *version = NULL;
 struct trackDb *tdbRgdEst;
 char *chrom = cartString(cart, "c");
 int start = cartInt(cart, "o");
 int end = cartUsualInt(cart, "t",0);
 struct gbWarn *gbWarn = checkGbWarn(conn, acc);
 
 /* This sort of query and having to keep things in sync between
  * the first clause of the select, the from clause, the where
  * clause, and the results in the row ... is really tedious.
  * One of my main motivations for going to a more object
  * based rather than pure relational approach in general,
@@ -5501,38 +5476,40 @@
                " where gbCdnaInfo.acc = '%s' and gbCdnaInfo.id = %s.id ",
                seqTbl, acc, seqTbl);
 dyStringAppend(dy,
                "and gbCdnaInfo.source = source.id and gbCdnaInfo.organism = organism.id "
                "and gbCdnaInfo.library = library.id and gbCdnaInfo.mrnaClone = mrnaClone.id "
                "and gbCdnaInfo.sex = sex.id and gbCdnaInfo.tissue = tissue.id "
                "and gbCdnaInfo.development = development.id and gbCdnaInfo.cell = cell.id "
                "and gbCdnaInfo.cds = cds.id and gbCdnaInfo.description = description.id "
                "and gbCdnaInfo.author = author.id and gbCdnaInfo.geneName = geneName.id "
                "and gbCdnaInfo.productName = productName.id");
 
 sr = sqlMustGetResult(conn, dy->string);
 row = sqlNextRow(sr);
 if (row != NULL)
     {
-    type=row[0];direction=row[1];source=row[2];orgFullName=row[3];library=row[4];clone=row[5];
+    type=row[0];direction=row[1];
+      // source=row[2];  unused variable
+    orgFullName=row[3];library=row[4];clone=row[5];
     sex=row[6];tissue=row[7];development=row[8];cell=row[9];cds=row[10];description=row[11];
     author=row[12];geneName=row[13];productName=row[14];
-    seqSize = sqlUnsigned(row[15]);
+    // seqSize = sqlUnsigned(row[15]);   unused variable
     date = row[16];
-    ext_file = row[17];
-    fileOffset=sqlUnsigned(row[18]);
-    fileSize=sqlUnsigned(row[19]);
+    // ext_file = row[17];  unused variable
+    // fileOffset=sqlUnsigned(row[18]);  unused variable
+    // fileSize=sqlUnsigned(row[19]);    unused variable
     boolean isEst = sameWord(type, "est");
 
     if (hasVersion)
         {
         version = row[20];
         }
 
 
     /* Now we have all the info out of the database and into nicely named
      * local variables.  There's still a few hoops to jump through to
      * format this prettily on the web with hyperlinks to NCBI. */
     printf("<H2>Information on %s <A HREF=\"",  type);
     if (isEst)
 	printEntrezEstUrl(stdout, acc);
     else
@@ -6351,32 +6328,33 @@
 char query[256];
 struct sqlResult *sr;
 char **row;
 char query2[256];
 struct sqlResult *sr2;
 char **row2;
 char query3[256];
 struct sqlResult *sr3;
 char **row3;
 struct agpFrag frag;
 struct contigAcc contigAcc;
 int start = cartInt(cart, "o");
 boolean hasBin;
 char splitTable[64];
 char *chp;
-char *accession1, *accession2, *spanner, *evaluation, *variation, *varEvidence,
+char *accession1, *accession2, *spanner, *variation, *varEvidence,
     *contact, *remark, *comment;
+// char *evaluation;  unused variable
 char *secondAcc, *secondAccVer;
 char *tmpString;
 int first;
 
 cartWebStart(cart, database, "%s", fragName);
 hFindSplitTable(database, seqName, tdb->table, splitTable, &hasBin);
 sqlSafef(query, sizeof query, "select * from %s where frag = '%s' and chromStart = %d",
 	splitTable, fragName, start);
 sr = sqlMustGetResult(conn, query);
 row = sqlNextRow(sr);
 agpFragStaticLoad(row+hasBin, &frag);
 
 printf("<B>Clone Fragment ID:</B> %s<BR>\n", frag.frag);
 printf("<B>Clone Fragment Type:</B> %s<BR>\n", frag.type);
 printf("<B>Clone Bases:</B> %d-%d<BR>\n", frag.fragStart+1, frag.fragEnd);
@@ -6412,31 +6390,31 @@
 	{
         sqlSafef(query2, sizeof query2, "select * from certificate where accession1='%s';", tmpString);
 	}
     else
 	{
         sqlSafef(query2, sizeof query2, "select * from certificate where accession2='%s';", tmpString);
 	}
     sr2 = sqlMustGetResult(conn2, query2);
     row2 = sqlNextRow(sr2);
     while (row2 != NULL)
         {
         printf("<HR>");
         accession1      = row2[0];
         accession2      = row2[1];
         spanner         = row2[2];
-        evaluation      = row2[3];
+        // evaluation      = row2[3];  unused variable
         variation       = row2[4];
         varEvidence     = row2[5];
         contact         = row2[6];
         remark          = row2[7];
         comment         = row2[8];
 
         if (first)
             {
 	    secondAcc = accession2;
 	    }
 	else
 	    {
 	    secondAcc = accession1;
             }
 
@@ -8584,31 +8562,31 @@
        pslList->misMatch,
        pslList->nCount,
        pslList->tBaseInsert, hOrganism(database),
        pslList->qBaseInsert, item,
        pslScore(pslList));
 
 printTrackHtml(tdb);
 hFreeConn(&conn);
 }
 
 void printEnsemblCustomUrl(struct trackDb *tdb, char *itemName, boolean encode,
     char *archive)
 /* Print Ensembl Gene URL. */
 {
 char *shortItemName;
-char *genomeStr = "";
+// char *genomeStr = ""; unused variable
 char *genomeStrEnsembl = "";
 struct sqlConnection *conn = hAllocConn(database);
 char cond_str[256], cond_str2[256], cond_str3[256];
 char *proteinID = NULL;
 char *ensPep;
 char *chp;
 char ensUrl[256];
 char *ensemblIdUrl = trackDbSettingOrDefault(tdb, "ensemblIdUrl", "http://www.ensembl.org");
 
 /* shortItemName is the name without the "." + version */
 shortItemName = cloneString(itemName);
 /* ensembl gene names are different from their usual naming scheme on ce6 */
 if (! startsWith("ce6", database))
     {
     chp = strstr(shortItemName, ".");
@@ -8631,37 +8609,34 @@
 
 char query[512];
 char *geneName = NULL;
 if (hTableExists(database, "ensemblToGeneName"))
     {
     sqlSafef(query, sizeof(query), "select value from ensemblToGeneName where name='%s'", itemName);
     geneName = sqlQuickString(conn, query);
     }
 char *ensemblSource = NULL;
 if (hTableExists(database, "ensemblSource"))
     {
     sqlSafef(query, sizeof(query), "select source from ensemblSource where name='%s'", itemName);
     ensemblSource = sqlQuickString(conn, query);
     }
 
-boolean nonCoding = FALSE;
 sqlSafefFrag(query, sizeof(query), "name = \"%s\"", itemName);
 struct genePred *gpList = genePredReaderLoadQuery(conn, "ensGene", query);
 if (gpList && gpList->name2)
     {
-    if (gpList->cdsStart == gpList->cdsEnd)
-	nonCoding = TRUE;
     printf("<B>Ensembl Gene Link: </B>");
     if ((strlen(gpList->name2) < 1) || sameString(gpList->name2, "noXref"))
        printf("none<BR>\n");
     else
        printf("<A HREF=\"%s/geneview?gene=%s\" "
 	    "target=_blank>%s</A><BR>", ensUrl, gpList->name2, gpList->name2);
     }
 genePredFreeList(&gpList);
 
 printf("<B>Ensembl Transcript: </B>");
 printf("<A HREF=\"%s/transview?transcript=%s\" "
                "target=_blank>", ensUrl, shortItemName);
 printf("%s</A><br>", itemName);
 
 if (hTableExists(database, "superfamily"))
@@ -8697,30 +8672,31 @@
             {
             if (hTableExists(database, "ensemblXref"))
                 {
                 proteinID=sqlGetField(database, "ensemblXref","translation_name",cond_str);
                 }
             }
         }
     if (proteinID != NULL)
         {
         printf("<B>Ensembl Protein: </B>");
         printf("<A HREF=\"%s/protview?peptide=%s\" target=_blank>",
             ensUrl, proteinID);
         printf("%s</A><BR>\n", proteinID);
         }
 
+#ifdef NOT
     /* get genomeStr to be used in Superfamily URL */
     if (sameWord(organism, "human"))
         {
 	genomeStr = "hs";
 	}
     else
 	{
         if (sameWord(organism, "mouse"))
 	    {
 	    genomeStr = "mm";
 	    }
         else
             {
 	    if (sameWord(organism, "rat"))
                 {
@@ -8728,31 +8704,30 @@
                 }
             else
                 {
                 if (sameWord(organism, "dog"))
                     {
                     genomeStr = "dg";
                     }
                 else
                     {
                     warn("Organism %s not found!", organism);
                     return;
                     }
                 }
             }
         }
-#ifdef NOT
 /* superfamily does not update with ensGene updates, stop printing an
 	invalid URL */
     sqlSafefFrag(cond_str, "name='%s'", shortItemName);
     char *ans = sqlGetField(conn, database, "superfamily", "name", cond_str);
     if (ans != NULL)
 	{
 	/* double check to make sure trackDb is also updated to be in sync with existence of supfamily table */
 	struct trackDb *tdbSf = hashFindVal(trackHash, "superfamily");
         if (tdbSf != NULL)
 	    {
             char supfamURL[512];
             printf("<B>Superfamily Link: </B>");
             safef(supfamURL, sizeof(supfamURL), "<A HREF=\"%s%s;seqid=%s\" target=_blank>",
                       tdbSf->url, genomeStr, proteinID);
             printf("%s%s</A><BR>\n", supfamURL, proteinID);
@@ -9114,56 +9089,49 @@
         printf("<HR>");
         printPosOnChrom(chrom, atoi(chromStart), atoi(chromEnd), NULL, TRUE, transcript);
         }
     sqlFreeResult(&sr);
     }
 printTrackHtml(tdb);
 }
 
 void doOmimAv(struct trackDb *tdb, char *avName)
 /* Process click on an OMIM AV. */
 {
 struct sqlConnection *conn = hAllocConn(database);
 struct sqlResult *sr;
 char **row;
 char query[256];
-char *chrom, *chromStart, *chromEnd;
 char *chp;
 char *omimId, *avSubFdId;
 char *avDescStartPos, *avDescLen;
 char *omimTitle = cloneString("");
 char *geneSymbol = NULL;
 int iAvDescStartPos = 0;
 int iAvDescLen = 0;
 
 struct lineFile *lf;
 char *line;
 int lineSize;
 
 cartWebStart(cart, database, "%s (%s)", tdb->longLabel, avName);
 
 sqlSafef(query, sizeof(query), "select * from omimAv where name = '%s'", avName);
 sr = sqlGetResult(conn, query);
 
 if ((row = sqlNextRow(sr)) == NULL)
     errAbort("Couldn't find %s in omimAv table - database inconsistency.", avName);
-else
-    {
-    chrom       = cloneString(row[1]);
-    chromStart  = cloneString(row[2]);
-    chromEnd    = cloneString(row[3]);
-    }
 sqlFreeResult(&sr);
 
 omimId = strdup(avName);
 chp = strstr(omimId, ".");
 *chp = '\0';
 
 chp++;
 avSubFdId = chp;
 
 sqlSafef(query, sizeof(query), "select title, geneSymbol from hgFixed.omimTitle where omimId = %s", omimId);
 sr = sqlGetResult(conn, query);
 
 if ((row = sqlNextRow(sr)) != NULL)
     {
     omimTitle  = cloneString(row[0]);
@@ -9480,59 +9448,60 @@
 /* Print details of a COSMIC entry. */
 {
 struct sqlConnection *conn  = hAllocConn(database);
 struct sqlConnection *conn2 = hAllocConn(database);
 char query[1024];
 char query2[1024];
 struct sqlResult *sr;
 struct sqlResult *sr2;
 char **row;
 char **row2;
 
 char *chp;
 char indent1[40] = {"&nbsp;&nbsp;&nbsp;&nbsp;"};
 char indent2[40] = {""};
 
-char *source, *cosmic_mutation_id, *gene_name, *accession_number;
+char *gene_name, *accession_number;
+// char $source, *cosmic_mutation_id;  unused variable
 char *mut_description, *mut_syntax_cds, *mut_syntax_aa;
 char *chromosome, *grch37_start, *grch37_stop, *mut_nt;
 char *mut_aa, *tumour_site, *mutated_samples, *examined_samples, *mut_freq;
 char *url = tdb->url;
 
 char *chrom, *chromStart, *chromEnd;
 chrom      = cartOptionalString(cart, "c");
 chromStart = cartOptionalString(cart, "o");
 chromEnd   = cartOptionalString(cart, "t");
 
 sqlSafef(query, sizeof(query),
       "select source,cosmic_mutation_id,gene_name,accession_number,mut_description,mut_syntax_cds,mut_syntax_aa,"
       "chromosome,grch37_start,grch37_stop,mut_nt,mut_aa,tumour_site,mutated_samples,examined_samples,mut_freq"
       " from cosmicRaw where cosmic_mutation_id='%s'",
       itemName);
 
 sr = sqlMustGetResult(conn, query);
 row = sqlNextRow(sr);
 if (row != NULL)
     {
     int ii;
     boolean multipleTumorSites;
     char *indentString;
 
     ii=0;
 
-    source              = row[ii];ii++;
-    cosmic_mutation_id  = row[ii];ii++;
+    ii++; // source              = row[ii];ii++;  unused variable
+    ii++; // cosmic_mutation_id  = row[ii];ii++;  unused variable
     gene_name           = row[ii];ii++;
     accession_number    = row[ii];ii++;
     mut_description     = row[ii];ii++;
     mut_syntax_cds      = row[ii];ii++;
     mut_syntax_aa       = row[ii];ii++;
 
     chromosome          = row[ii];ii++;
     grch37_start        = row[ii];ii++;
     grch37_stop         = row[ii];ii++;
     mut_nt              = row[ii];ii++;
     mut_aa              = row[ii];ii++;
     tumour_site         = row[ii];ii++;
     mutated_samples     = row[ii];ii++;
     examined_samples    = row[ii];ii++;
     mut_freq            = row[ii];ii++;
@@ -10358,69 +10327,65 @@
 printOmimLocationDetails(tdb, item, FALSE);
 printTrackHtml(tdb);
 }
 
 void printOmimAvSnpDetails(struct trackDb *tdb, char *itemName, boolean encode)
 /* Print details of an OMIM AvSnp entry. */
 {
 struct sqlConnection *conn  = hAllocConn(database);
 char query[256];
 struct sqlResult *sr;
 char **row;
 char *url = tdb->url;
 char *title1 = NULL;
 char *title2 = NULL;
 char *chrom, *chromStart, *chromEnd;
-char *omimId;
 char *avId;
 char *dbSnpId;
 char *chp;
-char *seqId = NULL;
 char avString[255];
 char *avDesc = NULL;
 
 chrom      = cartOptionalString(cart, "c");
 chromStart = cartOptionalString(cart, "o");
 chromEnd   = cartOptionalString(cart, "t");
 
 avId       = strdup(itemName);
 
 chp = strstr(avId, "-");
 if (chp != NULL) *chp = '\0';
 
 safef(avString, sizeof(avString), "%s", itemName);
 
 chp = strstr(itemName, ".");
 *chp = '\0';
-omimId = strdup(itemName);
 
 chp = avString;
 chp = strstr(avString, ".");
 *chp = '#';
 
 if (url != NULL && url[0] != 0)
     {
     sqlSafef(query, sizeof(query),
           "select title1, title2,  format(seqNo/10000,4), v.description"
            " from omimGeneMap m, omimAv v"
           " where m.omimId=%s and m.omimId=v.omimId and v.avId='%s';", itemName, avId);
 
     sr = sqlMustGetResult(conn, query);
     row = sqlNextRow(sr);
     if (row != NULL)
         {
-	seqId = strdup(row[2]);
 	if (row[0] != NULL)
 	    {
 	    title1 = cloneString(row[0]);
 	    }
 	if (row[1] != NULL)
 	    {
 	    title2 = cloneString(row[1]);
 	    }
 	avDesc = cloneString(row[3]);
 	}
     sqlFreeResult(&sr);
 
     printf("<B>OMIM Allelic Variant: ");
     printf("<A HREF=\"%s%s\" target=_blank>", url, avString);
     printf("%s</A></B>", avId);
@@ -10748,51 +10713,50 @@
 printTrackHtml(tdb);
 hFreeConn(&conn);
 }
 
 void doRgdGene2(struct trackDb *tdb, char *rgdGeneId)
 /* Process click on a RGD gene. */
 {
 struct sqlConnection *conn = hAllocConn(database);
 struct sqlResult *sr;
 char **row;
 char query[256];
 char *sqlRnaName = rgdGeneId;
 char *rgdId = NULL;
 char *chp;
 char *GeneID, *Name, *note;
-char *rgdPathwayId;
 char *rgdPathwayName;
 
 /* Make sure to escape single quotes for DB parseability */
 if (strchr(rgdGeneId, '\''))
     sqlRnaName = replaceChars(rgdGeneId, "'", "''");
 
 cartWebStart(cart, database, "%s", tdb->longLabel);
 
 chp = strstr(rgdGeneId, ":");
 if (chp != NULL)
     {
     chp++;
     rgdId = strdup(chp);
     }
 else
     {
     errAbort("Couldn't find %s.", rgdGeneId);
     }
 
-sqlSafef(query, sizeof(query), "select GeneID, Name, note from rgdGeneXref where rgdGeneId = '%s'", rgdGeneId);
+sqlSafef(query, sizeof(query), "select GeneID, Name, note from rgdGeneXref where rgdGeneId = '%s'", sqlRnaName);
 
 sr = sqlGetResult(conn, query);
 if ((row = sqlNextRow(sr)) == NULL)
     errAbort("Couldn't find %s in rgdGeneXref table - database inconsistency.", rgdGeneId);
 GeneID = cloneString(row[0]);
 Name   = cloneString(row[1]);
 note   = cloneString(row[2]);
 
 sqlFreeResult(&sr);
 
 printf("<H2>Gene %s</H2>\n", Name);
 printf("<B>RGD Gene Report: </B> <A HREF=\"");
 printf("%s%s", tdb->url, rgdId);
 printf("\" TARGET=_blank>RGD:%s</A>", rgdId);
 
@@ -10844,31 +10808,30 @@
         row = sqlNextRow(sr);
 	}
     }
 sqlFreeResult(&sr);
 
 htmlHorizontalLine();
 printf("<H3>RGD Pathway(s)</H3>\n");
 sqlSafef(query, sizeof(query),
 "select p.rgdPathwayId, p.name from rgdGenePathway g, rgdPathway p where g.rgdGeneId = '%s' and g.rgdPathwayId=p.rgdPathwayId", rgdGeneId);
 sr = sqlGetResult(conn, query);
 if ((row = sqlNextRow(sr)) == NULL)
     errAbort("Couldn't find %s in rgdGenePathway table - database inconsistency.", rgdGeneId);
 printf("<UL>");
 while (row != NULL)
     {
-    rgdPathwayId   = cloneString(row[0]);
     rgdPathwayName = cloneString(row[1]);
     printf("<LI><B>%s</B><BR>", rgdPathwayName);
     row = sqlNextRow(sr);
     }
 sqlFreeResult(&sr);
 printf("</UL>");
 printf("<A HREF=\"");
 printf("%s%s%s", "http://rgd.mcw.edu/tools/genes/gene_ont_view.cgi?id=", rgdId, "#Pathway");
 printf("\" TARGET=_blank> %s</A> </H3>", "Click here for more RGD pathway details related to this gene...");
 
 htmlHorizontalLine();
 
 printTrackHtml(tdb);
 hFreeConn(&conn);
 }
@@ -12247,41 +12210,37 @@
 void doSangerGene(struct trackDb *tdb, char *geneName, char *pepTable, char *mrnaTable, char *extraTable)
 /* Handle click on Sanger gene track. */
 {
 genericHeader(tdb, geneName);
 showSangerExtra(geneName, extraTable);
 geneShowCommon(geneName, tdb, pepTable);
 printTrackHtml(tdb);
 }
 
 void doTrnaGenesGb(struct trackDb *tdb, char *trnaName)
 {
 struct tRNAs *trna;
 char query[512];
 struct sqlConnection *conn = hAllocConn(database);
 struct sqlResult *sr;
-char *dupe, *words[16];
 char **row;
-int wordCount;
 int rowOffset;
 
 int start   = cartInt(cart, "o");
 int end     = cartInt(cart, "t");
 
 genericHeader(tdb,trnaName);
-dupe = cloneString(tdb->type);
-wordCount = chopLine(dupe, words);
 
 rowOffset = hOffsetPastBin(database, seqName, tdb->table);
 sqlSafef(query, ArraySize(query),
       "select * from %s where name = '%s' and chromStart=%d and chromEnd=%d",
 tdb->table, trnaName, start, end);
 
 sr = sqlGetResult(conn, query);
 
 /* use TABLE to align image with other info side by side */
 printf("<TABLE>");
 while ((row = sqlNextRow(sr)) != NULL)
     {
     char imgFileName[512];
     char encodedName[255];
     char *chp1, *chp2;
@@ -13469,36 +13428,35 @@
 
 if (hTableExists(database, chainTable_chrom) )
     {
     /* lookup chain if not stored */
     char **row;
     struct sqlResult *sr = NULL;
     sqlDyStringPrintf(dy, "select id, score, qStart, qEnd, qStrand, qSize from %s where ",
                    chainTable_chrom);
     hAddBinToQuery(chromStart, chromEnd, dy);
     dyStringPrintf(dy, "tEnd > %d and tStart < %d ", chromStart,chromEnd);
     dyStringAppend(dy, " order by qStart");
     sr = sqlGetResult(conn, dy->string);
 
     while ((row = sqlNextRow(sr)) != NULL)
         {
-        int chainId = 0, score;
+        int chainId = 0;
         unsigned int qStart, qEnd, qSize;
         struct chain *chain = NULL;
         char qStrand;
         chainId = sqlUnsigned(row[0]);
-        score = sqlUnsigned(row[1]);
         qStart = sqlUnsigned(row[2]);
         qEnd = sqlUnsigned(row[3]);
         qStrand =row[4][0];
         qSize = sqlUnsigned(row[5]);
         if (qStrand == '-')
             {
             unsigned int tmp = qSize - qEnd;
             qEnd = qSize - qStart;
             qStart = tmp;
             }
         chain = NULL;
         if (chainId != 0)
             {
             chain = chainLoadIdRange(database, chainTable, chrom, chromStart, chromEnd, chainId);
             if (chain != NULL)
@@ -15354,47 +15312,45 @@
     }
 return rsId;
 }
 
 void doSnpEntrezGeneLink(struct trackDb *tdb, char *name)
 /* print link to EntrezGene for this SNP */
 {
 char *table = tdb->table;
 if (hTableExists(database, "knownGene") && hTableExists(database, "refLink") &&
     hTableExists(database, "mrnaRefseq") && hTableExists(database, table))
     {
     struct sqlConnection *conn = hAllocConn(database);
     struct sqlResult *sr;
     char **row;
     char query[512];
-    int rowOffset;
 
     sqlSafef(query, sizeof(query),
 	  "select distinct        "
 	  "       rl.locusLinkID, "
 	  "       rl.name         "
 	  "from   knownGene  kg,  "
 	  "       refLink    rl,  "
 	  "       %s         snp, "
 	  "       mrnaRefseq mrs  "
 	  "where  snp.chrom  = kg.chrom       "
 	  "  and  kg.name    = mrs.mrna       "
 	  "  and  mrs.refSeq = rl.mrnaAcc     "
 	  "  and  kg.txStart < snp.chromStart "
 	  "  and  kg.txEnd   > snp.chromEnd   "
 	  "  and  snp.name   = '%s'", table, name);
-    rowOffset = hOffsetPastBin(database, seqName, table);
     sr = sqlGetResult(conn, query);
     while ((row = sqlNextRow(sr)) != NULL)
 	{
 	printf("<BR><A HREF=\"http://www.ncbi.nlm.nih.gov/SNP/snp_ref.cgi?");
 	printf("geneId=%s\" TARGET=_blank>Entrez Gene for ", row[0]);
 	printf("%s</A><BR>\n", row[1]);
 	}
     sqlFreeResult(&sr);
     hFreeConn(&conn);
     }
 }
 
 void doSnpOld(struct trackDb *tdb, char *itemName)
 /* Put up info on a SNP. */
 {
@@ -18418,31 +18374,30 @@
 hFreeConn(&conn2);
 hFreeConn(&conn);
 }
 
 void doJaxPhenotype(struct trackDb *tdb, char *item)
 /* Show gene prediction position and other info. */
 {
 struct sqlConnection *conn = hAllocConn(database);
 struct sqlResult *sr = NULL;
 char **row = NULL;
 boolean hasBin;
 char query[512];
 char aliasTable[256], phenoTable[256];
 struct slName *phenoList = NULL, *pheno = NULL;
 boolean first = TRUE;
-int chromStart=0, chromEnd=0;
 char *selectedPheno = NULL;
 
 /* Parse out the selected phenotype passed in from hgTracks. */
 if ((selectedPheno = strstr(item, " source=")) != NULL)
     {
     *selectedPheno = '\0';
     selectedPheno += strlen(" source=");
     }
 genericHeader(tdb, item);
 safef(aliasTable, sizeof(aliasTable), "%sAlias", tdb->table);
 safef(phenoTable, sizeof(phenoTable), "jaxAllelePheno");
 sqlSafefFrag(query, sizeof(query), "name = \"%s\"", item);
 sr = hRangeQuery(conn, tdb->table, seqName, winStart, winEnd, query,
 		 &hasBin);
 while ((row = sqlNextRow(sr)) != NULL)
@@ -18457,32 +18412,30 @@
 	if (hTableExists(database, aliasTable))
 	    {
 	    struct sqlConnection *conn2 = hAllocConn(database);
 	    char query2[512];
 	    char buf[512];
 	    char *mgiId;
 	    sqlSafef(query2, sizeof(query2),
 		  "select alias from %s where name = '%s'", aliasTable, item);
 	    mgiId = sqlQuickQuery(conn2, query2, buf, sizeof(buf));
 	    if (mgiId != NULL)
 		printCustomUrl(tdb, mgiId, TRUE);
 	    hFreeConn(&conn2);
 	    }
 	printPos(bed->chrom, bed->chromStart, bed->chromEnd, bed->strand,
 		 FALSE, NULL);
-	chromStart = bed->chromStart;
-	chromEnd = bed->chromEnd;
 	bedFree(&bed);
 	}
     pheno = slNameNew(row[hasBin+12]);
     slAddHead(&phenoList, pheno);
     }
 sqlFreeResult(&sr);
 printf("<B>Phenotype(s) at this locus: </B> ");
 first = TRUE;
 slNameSort(&phenoList);
 for (pheno = phenoList;  pheno != NULL;  pheno = pheno->next)
     {
     if (first)
 	first = FALSE;
     else
 	printf(", ");
@@ -19468,48 +19421,44 @@
     printf("<b>Genbank accession:</b> %s<br>\n", chick->gbkAcc);
     printf("<b>BLAT alignment:</b> %s<br>\n", chick->blat);
     printf("<b>Source annotation:</b> %s<br>\n", chick->sourceAnnot);
     printf("<b>TIGR assigned TC:</b> %s<br>\n", chick->tigrTc);
     printf("<b>TIGR TC annotation:</b> %s<br>\n", chick->tigrTcAnnot);
     printf("<b>BLAST determined annotation:</b> %s<br>\n", chick->blastAnnot);
     printf("<b>Comment:</b> %s<br>\n", chick->comment);
     }
 genericBedClick(conn, tdb, item, start, 1);
 printTrackHtml(tdb);
 hFreeConn(&conn);
 }
 
 void perlegenDetails(struct trackDb *tdb, char *item)
 {
-char *dupe, *words[16];
-int wordCount;
 int start = cartInt(cart, "o");
 struct sqlConnection *conn = hAllocConn(database);
 char table[64];
 boolean hasBin;
 struct bed *bed;
 char query[512];
 struct sqlResult *sr;
 char **row;
 boolean firstTime = TRUE;
 int numSnpsReq = -1;
 if(tdb == NULL)
     errAbort("TrackDb entry null for perlegen, item=%s\n", item);
 
-dupe = cloneString(tdb->type);
 genericHeader(tdb, item);
-wordCount = chopLine(dupe, words);
 printCustomUrl(tdb, item, FALSE);
 hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
 sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s' and chromStart = %d",
         table, item, seqName, start);
 sr = sqlGetResult(conn, query);
 
 while ((row = sqlNextRow(sr)) != NULL)
     {
     char *name;
     /* set up for first time */
     if (firstTime)
 	firstTime = FALSE;
     else
 	htmlHorizontalLine();
     bed = bedLoadN(row+hasBin, 12);
@@ -19542,93 +19491,85 @@
 	}
 
     /* finish off report ... */
     printf("<B>Block:</B> %s<BR>\n", name);
     printf("<B>Number of SNPs in block:</B> %d<BR>\n", bed->blockCount);
     printf("<B>Number of SNPs to represent block:</B> %d<BR>\n",numSnpsReq);
     printf("<B>Strand:</B> %s<BR>\n", bed->strand);
     bedPrintPos(bed, 3, tdb);
     }
 printTrackHtml(tdb);
 hFreeConn(&conn);
 }
 
 void haplotypeDetails(struct trackDb *tdb, char *item)
 {
-char *dupe, *words[16];
-int wordCount;
 int start = cartInt(cart, "o");
 struct sqlConnection *conn = hAllocConn(database);
 char table[64];
 boolean hasBin;
 struct bed *bed;
 char query[512];
 struct sqlResult *sr;
 char **row;
 boolean firstTime = TRUE;
 if(tdb == NULL)
     errAbort("TrackDb entry null for haplotype, item=%s\n", item);
 
-dupe = cloneString(tdb->type);
 genericHeader(tdb, item);
-wordCount = chopLine(dupe, words);
 printCustomUrl(tdb, item, TRUE);
 hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
 sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s' and chromStart = %d",
         table, item, seqName, start);
 sr = sqlGetResult(conn, query);
 
 while ((row = sqlNextRow(sr)) != NULL)
     {
     /* set up for first time */
     if (firstTime)
 	firstTime = FALSE;
     else
 	htmlHorizontalLine();
     bed = bedLoadN(row+hasBin, 12);
 
     /* finish off report ... */
     printf("<B>Block:</B> %s<BR>\n", bed->name);
     printf("<B>Number of SNPs in block:</B> %d<BR>\n", bed->blockCount);
     /*    printf("<B>Number of SNPs to represent block:</B> %d<BR>\n",numSnpsReq);*/
     printf("<B>Strand:</B> %s<BR>\n", bed->strand);
     bedPrintPos(bed, 3, tdb);
     }
 printTrackHtml(tdb);
 hFreeConn(&conn);
 }
 
 void mitoDetails(struct trackDb *tdb, char *item)
 {
-char *dupe, *words[16];
-int wordCount;
 int start = cartInt(cart, "o");
 struct sqlConnection *conn = hAllocConn(database);
 char table[64];
 boolean hasBin;
 struct bed *bed;
 char query[512];
 struct sqlResult *sr;
 char **row;
 boolean firstTime = TRUE;
 int numSnpsReq = -1;
 if(tdb == NULL)
     errAbort("TrackDb entry null for mitoSnps, item=%s\n", item);
 
-dupe = cloneString(tdb->type);
 genericHeader(tdb, item);
-wordCount = chopLine(dupe, words);
 printCustomUrl(tdb, item, TRUE);
 hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
 sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s' and chromStart = %d",
         table, item, seqName, start);
 sr = sqlGetResult(conn, query);
 
 while ((row = sqlNextRow(sr)) != NULL)
     {
     char *name;
     /* set up for first time */
     if (firstTime)
 	firstTime = FALSE;
     else
 	htmlHorizontalLine();
     bed = bedLoadN(row+hasBin, 12);
@@ -19660,48 +19601,44 @@
 	    break;
 	}
     /* finish off report ... */
     printf("<B>Block:</B> %s<BR>\n", name);
     printf("<B>Number of SNPs in block:</B> %d<BR>\n", bed->blockCount);
     printf("<B>Number of SNPs to represent block:</B> %d<BR>\n",numSnpsReq);
     printf("<B>Strand:</B> %s<BR>\n", bed->strand);
     bedPrintPos(bed, 3, tdb);
     }
 printTrackHtml(tdb);
 hFreeConn(&conn);
 }
 
 void ancientRDetails(struct trackDb *tdb, char *item)
 {
-char *dupe, *words[16];
-int wordCount;
 struct sqlConnection *conn = hAllocConn(database);
 char table[64];
 boolean hasBin;
 struct bed *bed = NULL;
 char query[512];
 struct sqlResult *sr = NULL;
 char **row;
 boolean firstTime = TRUE;
 double ident = -1.0;
 struct ancientRref *ar = NULL;
 
 if(tdb == NULL)
     errAbort("TrackDb entry null for ancientR, item=%s\n", item);
-dupe = cloneString(tdb->type);
 genericHeader(tdb, item);
-wordCount = chopLine(dupe, words);
 printCustomUrl(tdb, item, TRUE);
 hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
 sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s'",
         table, item, seqName );
 sr = sqlGetResult(conn, query);
 
 while ((row = sqlNextRow(sr)) != NULL)
     {
     char *name;
     /* set up for first time */
     if (firstTime)
 	firstTime = FALSE;
     else
 	htmlHorizontalLine();
     bed = bedLoadN(row+hasBin, 12);
@@ -20435,31 +20372,30 @@
 {
 int humMusWinSize = 50;
 int i;
 char table[64];
 boolean hasBin;
 struct sample *smp;
 char query[512];
 char tempTableName[1024];
 struct sqlResult *sr;
 char **row;
 char **pslRow;
 boolean firstTime = TRUE;
 struct psl *thisPsl;
 char str[256];
 char thisItem[256];
-char *cgiItem;
 char otherString[256] = "";
 struct sqlResult *pslSr;
 struct sqlConnection *conn2 = hAllocConn(database);
 int thisStart, thisEnd;
 int left = cartIntExp( cart, "l" );
 int right = cartIntExp( cart, "r" );
 char *winOn = cartUsualString( cart, "win", "F" );
 
 hFindSplitTable(database, seqName, tdb->table, table, &hasBin);
 sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chrom = '%s'",
 	table, item, seqName);
 sr = sqlGetResult(conn, query);
 while ((row = sqlNextRow(sr)) != NULL)
     {
     if (firstTime)
@@ -20471,31 +20407,30 @@
     hFindSplitTable(database, seqName, pslTableName, table, &hasBin);
     sqlSafef(query, sizeof query, "select * from %s where tName = '%s' and tEnd >= %d and tStart <= %d"
 	    , table, smp->chrom, smp->chromStart+smp->samplePosition[0]
 	    , smp->chromStart+smp->samplePosition[smp->sampleCount-1] );
 
     pslSr = sqlGetResult(conn2, query);
     if(!sameString(winOn,"T"))
 	{
 	while(( pslRow = sqlNextRow(pslSr)) != NULL )
 	    {
 	    thisPsl = pslLoad( pslRow+hasBin );
 	    firstAndLastPosition( &thisStart, &thisEnd, thisPsl );
 	    snprintf(thisItem, 256, "%s:%d-%d %s:%d-%d", thisPsl->qName,
 		     thisPsl->qStart, thisPsl->qEnd, thisPsl->tName,
 		     thisPsl->tStart, thisPsl->tEnd );
-	    cgiItem = cgiEncode(thisItem);
 	    longXenoPsl1Given(tdb, thisItem, otherOrg, "chromInfo",
 			      otherDb, thisPsl, pslTableName );
 	    safef(otherString, sizeof otherString, "%d&win=T", thisPsl->tStart );
 	    hgcAnchorSomewhere( tdb->track, cgiEncode(item), otherString, thisPsl->tName );
 	    printf("View individual alignment windows\n</a>");
 	    printf("<br><br>");
 	    }
 	}
     else
 	{
 	cartSetString( cart, "win", "F" );
 	printf("<h3>Alignments Windows </h3>\n"
 	       "<b>start&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stop"
 	       "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L-score</b><br>" );
 	while(( pslRow = sqlNextRow(pslSr)) != NULL )
@@ -20569,65 +20504,63 @@
 	    smp->chromStart+smp->samplePosition[smp->sampleCount-1] );
 
     printf("Content-Type: text/html\n\n<HTML><BODY><SCRIPT>\n");
     printf("location.replace('%s')\n",filename);
     printf("</SCRIPT> <NOSCRIPT> No JavaScript support. "
            "Click <b><a href=\"%s\">continue</a></b> for "
            "the requested GenBank report. </NOSCRIPT>\n",
            filename);
     }
 }
 
 void humMusClickHandler(struct trackDb *tdb, char *item,
         char *targetName, char *targetDb, char *targetTable, boolean printWindowFlag )
 /* Put up sample track info. */
 {
-char *type, *words[16], *dupe = cloneString(tdb->type);
+char *words[16], *dupe = cloneString(tdb->type);
 int num;
 int wordCount;
 int start = cartInt(cart, "o");
 struct sqlConnection *conn = hAllocConn(database);
 
 genericHeader(tdb, item);
 wordCount = chopLine(dupe, words);
 if (wordCount > 0)
     {
-    type = words[0];
     num = 0;
     if (wordCount > 1)
 	num = atoi(words[1]);
     if (num < 3) num = 3;
         humMusSampleClick( conn, tdb, item, start, num, targetName, targetDb, targetTable, printWindowFlag );
     }
 printTrackHtml(tdb);
 freez(&dupe);
 hFreeConn(&conn);
 }
 
 void footPrinterClickHandler(struct trackDb *tdb, char *item )
 /* Put up generic track info. */
 {
-char *type, *words[16], *dupe = cloneString(tdb->type);
+char *words[16], *dupe = cloneString(tdb->type);
 int num;
 int wordCount;
 int start = cartInt(cart, "o");
 struct sqlConnection *conn = hAllocConn(database);
 
 wordCount = chopLine(dupe, words);
 if (wordCount > 0)
     {
-    type = words[0];
     num = 0;
     if (wordCount > 1)
 	num = atoi(words[1]);
     if (num < 3) num = 3;
     footPrinterSampleClick(conn, tdb, item, start, num);
     }
 printTrackHtml(tdb);
 freez(&dupe);
 hFreeConn(&conn);
 }
 
 void hgCustom(char *trackId, char *fileItem)
 /* Process click on custom track. */
 {
 char *fileName, *itemName;
@@ -21255,76 +21188,72 @@
 	}
     bedFree(&bed);
     }
 else
     errAbort("query returned no results: \"%s\"", query);
 sqlFreeResult(&sr);
 hFreeConn(&conn);
 printTrackHtml(tdb);
 }
 
 
 void doScaffoldEcores(struct trackDb *tdb, char *item)
 /* Creates details page and gets the scaffold co-ordinates for unmapped */
 /* genomes for display and to use to create the correct outside link URL */
 {
-char *dupe, *words[16];
-int wordCount;
+char *words[16];
 int start = cartInt(cart, "o");
 struct sqlConnection *conn = hAllocConn(database);
 int num;
 struct bed *bed = NULL;
 char query[512];
 struct sqlResult *sr;
 char **row;
 char *scaffoldName;
 int scaffoldStart, scaffoldEnd;
 struct dyString *itemUrl = newDyString(128), *d;
 char *old = "_";
 char *new = "";
 char *pat = "fold";
 int hasBin = 1;
-dupe = cloneString(tdb->type);
-wordCount = chopLine(dupe, words);
 /* get bed size */
 num = 0;
 num = atoi(words[1]);
 
 /* get data for this item */
 sqlSafef(query, sizeof query, "select * from %s where name = '%s' and chromStart = %d", tdb->table, item, start);
 sr = sqlGetResult(conn, query);
 while ((row = sqlNextRow(sr)) != NULL)
     bed = bedLoadN(row+hasBin, num);
 
 genericHeader(tdb, item);
 /* convert chromosome co-ordinates to scaffold position and */
 /* make into item for URL */
 if (hScaffoldPos(database, bed->chrom, bed->chromStart, bed->chromEnd, &scaffoldName,            &scaffoldStart, &scaffoldEnd) )
    {
     scaffoldStart += 1;
    dyStringPrintf(itemUrl, "%s:%d-%d", scaffoldName, scaffoldStart,                           scaffoldEnd);
    /* remove underscore in scaffold name and change to "scafN" */
    d = dyStringSub(itemUrl->string, old, new);
    itemUrl = dyStringSub(d->string, pat, new);
    printCustomUrl(tdb, itemUrl->string, TRUE);
    }
 
 genericBedClick(conn, tdb, item, start, num);
 printTrackHtml(tdb);
 
 dyStringFree(&itemUrl);
-freez(&dupe);
 sqlFreeResult(&sr);
 hFreeConn(&conn);
 }
 
 char *stripBDGPSuffix(char *name)
 /* cloneString(name), and if it ends in -R[A-Z], strip that off. */
 {
 char *stripped = cloneString(name);
 int len = strlen(stripped);
 if (stripped[len-3] == '-' &&
     stripped[len-2] == 'R' &&
     isalpha(stripped[len-1]))
     stripped[len-3] = 0;
 return(stripped);
 }
@@ -22559,61 +22488,59 @@
 qSeq = loadGenomePart(db, psl->qName, psl->qStart, psl->qEnd);
 safef(name, sizeof name, "%s in %s(%d-%d)", item,psl->qName, psl->qStart, psl->qEnd);
 writeFramesetType();
 puts("<HTML>");
 printf("<HEAD>\n<TITLE>%s %dk</TITLE>\n</HEAD>\n\n", name, psl->qStart/1000);
 showSomeAlignment2(psl, qSeq, gftDnaX, psl->qStart, psl->qEnd, name, item, "", psl->qStart, psl->qEnd);
 }
 
 void doPutaFrag(struct trackDb *tdb, char *item)
 /* display the potential pseudo and coding track */
 {
 struct sqlConnection *conn = hAllocConn(database);
 struct sqlResult *sr = NULL;
 char **row, table[256], query[256], *parts[6];
 struct putaInfo *info = NULL;
-struct psl *psl = NULL;
 int start = cartInt(cart, "o"),  end = cartInt(cart, "t");
 char *db = cgiString("db");
 char *name = cartString(cart, "i"),  *chr = cartString(cart, "c");
 char pslTable[256];
-char otherString[256], *tempName = NULL;
-int partCount;
+char otherString[256];
 
 safef(table, sizeof table, "putaInfo");
 safef(pslTable, sizeof pslTable, "potentPsl");
 cartWebStart(cart, database, "Putative Coding or Pseudo Fragments");
 sqlSafef(query, sizeof query, "SELECT * FROM %s WHERE name = '%s' "
         "AND chrom = '%s' AND chromStart = %d "
         "AND chromEnd = %d",
          table, name, chr, start, end);
 
 sr = sqlMustGetResult(conn, query);
 row = sqlNextRow(sr);
 
 if(row != NULL)
     {
     info = putaInfoLoad(row+1);
     }
 else
     {
     errAbort("Can't find information for %s in data base\n", name);
     }
 sqlFreeResult(&sr);
 
-tempName = cloneString(name);
-partCount = chopByChar(tempName, '|',parts, 4);
+char *tempName = cloneString(name);
+chopByChar(tempName, '|',parts, 4);
 
 printf("<B>%s</B> is homologous to the known gene: <A HREF=\"", name);
 printEntrezNucleotideUrl(stdout, parts[0]);
 printf("\" TARGET=_blank>%s</A><BR>\n", parts[0]);
 printf("<B>%s </B>is aligned here with score : %d<BR><BR>\n", parts[0], info->score);
 
 /* print the info about the stamper gene */
 printf("<B> %s</B><BR>\n", parts[0]);
 printf("<B>Genomic location of the mapped part of %s</B>: <A HREF=\""
        "%s?db=%s&position=%s:%d-%d\" TARGET=_blank>%s(%s):%d-%d </A> <BR>\n",
        parts[0], hgTracksName(), db, info->oChrom, info->oChromStart, info->oChromEnd,
        info->oChrom, parts[2],info->oChromStart+1, info->oChromEnd);
 printf("<B>Mapped %s Exons</B>: %d of %d. <BR> <B>Mapped %s CDS exons</B>: %d of %d <BR>\n", parts[0], info->qExons[0], info->qExons[1], parts[0], info->qExons[2], info->qExons[3]);
 
 printf("<b>Aligned %s bases</B>:%d of %d with %f identity. <BR> <B>Aligned %s CDS bases</B>:  %d of %d with %f identity.<BR><BR>\n", parts[0],info->qBases[0], info->qBases[1], info->id[0], parts[0], info->qBases[2], info->qBases[3], info->id[1]);
@@ -22645,31 +22572,30 @@
 
 
 /* show genome sequence */
 hgcAnchorSomewhere("htcGeneInGenome", cgiEncode(info->name), tdb->track, seqName);
 printf("View DNA for this putative fragment</A><BR>\n");
 
 /* show the detail alignment */
 sqlSafef(query, sizeof query, "SELECT * FROM %s WHERE "
 	"tName = '%s' AND tStart = %d "
 	"AND tEnd = %d AND strand = '%c%c'",
 	pslTable, info->chrom, info->chromStart, info->chromEnd, parts[2][0], info->strand[0]);
 sr = sqlMustGetResult(conn, query);
 row = sqlNextRow(sr);
 if(row != NULL)
     {
-    psl = pslLoad(row+1);
     safef(otherString, sizeof otherString, "&db=%s&pslTable=%s&chrom=%s&cStart=%d&cEnd=%d&strand=%s&qStrand=%s",
 	    database, pslTable, info->chrom,info->chromStart, info->chromEnd, info->strand, parts[2]);
     hgcAnchorSomewhere("potentPsl", cgiEncode(parts[0]), otherString, info->chrom);
     printf("<BR>View details of parts of alignment </A>.</BR>\n");
     }
 sqlFreeResult(&sr);
 putaInfoFree(&info);
 hFreeConn(&conn);
 }
 
 void doInterPro(struct trackDb *tdb, char *itemName)
 {
 char condStr[255];
 char *desc;
 struct sqlConnection *conn;
@@ -24104,31 +24030,31 @@
 printTrackHtml(tdb);
 hFreeConn(&conn);
 }
 
 void doUCSFDemo(struct trackDb *tdb, char *item)
 {
 genericHeader(tdb, item);
 
 printf("<B>Name:</B> %s<BR>\n", item);
 
 /* this prints the detail page for the clinical information for Cancer Demo datasets */
 char *table = tdb->table;
 char *cliniTable=NULL, *key=NULL;
 char query[256];
 struct sqlConnection *conn = hAllocConn(database);
-struct sqlResult *sr, *startSr;
+struct sqlResult *sr;
 char **row;
 
 if (sameString(table, "CGHBreastCancerUCSF") || sameString(table, "expBreastCancerUCSF"))
     {
     cliniTable = "phenBreastTumors";
     key = "id";
 
     /* er, pr */
     printf("<BR>");
     printf("<TABLE BORDER=1>\n");
     printf("<TR><TH>ER</TH> <TH>PR</TH></TR>\n");
     sqlSafef(query, sizeof(query), "select er, pr from %s where %s = '%s' ", cliniTable, key, item);
     sr = sqlGetResult(conn, query);
     if ((row = sqlNextRow(sr)) != NULL)
         {
@@ -24289,32 +24215,30 @@
     {
     cliniTable = "tspLungClinical";
     key = "tumorID";
     }
 else
     return;
 
 htmlHorizontalLine();
 
 sqlSafef(query, sizeof(query),
       "select * from %s where %s = '%s' ", cliniTable, key,item);
 
 sr = sqlGetResult(conn, query);
 if ((row = sqlNextRow(sr)) != NULL)
     {
-    startSr = sr;
-
     int numFields = sqlCountColumns(sr);
     int i;
     char *fieldName=NULL, *value=NULL;
     for (i=0; i< numFields; i++)
 	{
 	fieldName = sqlFieldName(sr);
 	value = row[i];
 	printf("%s: <B>%s</B><BR>\n", fieldName, value);
 	}
     }
 sqlFreeResult(&sr);
 //printTrackHtml(tdb);
 //hFreeConn
 }