src/hg/hgc/hgc.c 1.1595

1.1595 2010/01/28 00:20:16 angie
genericChainClick: fixed bug noticed by Katrina: we weren't checking the chainLinearGap trackDb setting, so when recalculating score-in-window, we used incorrect gap penalties unless the default loose penalties were used. Also, recalculating score-in-window had the unexpected side effect of clobbering the original chain's score when the whole chain fit in the window, because chainSubSetOnT was returning the original chain! I took out the score-in-window stuff for chains that fit in the window, and added a position link for the ref. genome (like we have on all of our other pages).
Index: src/hg/hgc/hgc.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgc/hgc.c,v
retrieving revision 1.1594
retrieving revision 1.1595
diff -b -B -U 4 -r1.1594 -r1.1595
--- src/hg/hgc/hgc.c	23 Jan 2010 18:54:07 -0000	1.1594
+++ src/hg/hgc/hgc.c	28 Jan 2010 00:20:16 -0000	1.1595
@@ -2710,11 +2710,12 @@
 chainSubsetOnT(chain, winStart, winEnd, &subChain, &toFree);
 
 if (subChain == NULL)
     nullSubset = TRUE;
-else if (hDbIsActive(otherDb))
+else if (hDbIsActive(otherDb) && subChain != chain)
     {
-    struct gapCalc *gapCalc = gapCalcDefault();
+    char *linearGap = trackDbSettingOrDefault(tdb, "chainLinearGap", "loose");
+    struct gapCalc *gapCalc = gapCalcFromFile(linearGap);
     struct axtScoreScheme *scoreScheme = axtScoreSchemeDefault();
     int qStart = subChain->qStart;
     int qEnd   = subChain->qEnd  ;
     struct dnaSeq *tSeq = hDnaFromSeq(database, subChain->tName, subChain->tStart, subChain->tEnd, dnaLower);
@@ -2749,10 +2750,12 @@
     subSetScore = subChain->score;
     }
 chainFree(&toFree);
 
-printf("<B>%s position:</B> %s:%d-%d</a>  size: %d <BR>\n",
-       thisOrg, chain->tName, chain->tStart+1, chain->tEnd,
+printf("<B>%s position:</B> <A HREF=\"%s?%s&db=%s&position=%s:%d-%d\">%s:%d-%d</A>"
+       "  size: %d <BR>\n",
+       thisOrg, hgTracksName(), cartSidUrlString(cart), database,
+       chain->tName, chain->tStart+1, chain->tEnd, chain->tName, chain->tStart+1, chain->tEnd,
        chain->tEnd-chain->tStart);
 printf("<B>Strand:</B> %c<BR>\n", chain->qStrand);
 qChainRangePlusStrand(chain, &qs, &qe);
 if (sameWord(otherDb, "seq"))
@@ -2776,11 +2779,13 @@
 printf("<B>Score:</B> %1.0f\n", chain->score);
 
 if (nullSubset)
     printf("<B>Score within browser window:</B> N/A (no aligned bases)<BR>\n");
-else if (hDbIsActive(otherDb))
-    printf("<B>Approximate Score within browser window:</B> %1.0f<BR>\n",
+else if (hDbIsActive(otherDb) && subChain != chain)
+    printf("<B>&nbsp;&nbsp;Approximate Score within browser window:</B> %1.0f<BR>\n",
 	   subSetScore);
+else
+    printf("<BR>\n");
 printf("<BR>Fields above refer to entire chain or gap, not just the part inside the window.<BR>\n");
 
 boolean normScoreAvailable = chainDbNormScoreAvailable(tdb);