ea5b4301814c1df9f2a0f3b2d9e0d2f06b22635e
braney
Tue May 24 18:37:10 2016 -0700
hgTables support , some display changes, and a better hgc
page for longTabix
diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 17dc990..2b6e044 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -3913,30 +3913,31 @@
struct trackDb *tdb, char *item, char *itemForUrl)
/* Print page for container of some sort. */
{
if (sameString(containerType, "multiWig"))
{
errAbort("It's suprising that multiWig container gets to hgc. It should go to hgTrackUi.");
}
else
{
errAbort("Unrecognized container type %s for %s", containerType, tdb->track);
}
}
static void doLongTabix(struct trackDb *tdb, char *item)
+/* Handle a click on a long range interaction */
{
char *bigDataUrl = hashFindVal(tdb->settingsHash, "bigDataUrl");
struct bedTabixFile *btf = bedTabixFileMayOpen(bigDataUrl, NULL, 0, 0);
char *chromName = cartString(cart, "c");
struct bed *list = bedTabixReadBeds(btf, chromName, winStart, winEnd, bedLoad5);
bedTabixFileClose(btf);
unsigned maxWidth;
struct longRange *longRangeList = parseLongTabix(list, &maxWidth, 0);
struct longRange *longRange, *ourLongRange = NULL;
unsigned itemNum = sqlUnsigned(item);
unsigned count = slCount(longRangeList);
double *doubleArray;
AllocArray(doubleArray, count);
@@ -3946,43 +3947,54 @@
if (longRange->id == itemNum)
{
ourLongRange = longRange;
}
doubleArray[ii] = longRange->score;
}
if (ourLongRange == NULL)
errAbort("cannot find long range item with id %d\n", itemNum);
struct aveStats *as = aveStatsCalc(doubleArray, count);
printf("Item you clicked on:
\n");
printf("Score: %g
\n", ourLongRange->score);
printf("ID: %u
\n", ourLongRange->id);
-//printf("Link to other block
\n", otherChrom, s, e);
-
-printf("
All items in window:\n");
-
-printf("
Q1 %f\n", as->q1);
-printf("
median %f\n", as->median);
-printf("
Q3 %f\n", as->q3);
-printf("
average %f\n", as->average);
-printf("
min %f\n", as->minVal);
-printf("
max %f\n", as->maxVal);
-printf("
count %d\n", as->count);
-printf("
total %f\n", as->total);
-printf("
standard deviation %f\n", as->stdDev);
+unsigned padding = (ourLongRange->e - ourLongRange->s) / 10;
+int s = ourLongRange->s - padding;
+int e = ourLongRange->e + padding;
+if (s < 0 )
+ s = 0;
+int chromSize = hChromSize(database, seqName);
+if (e > chromSize)
+ e = chromSize;
+printf("Link to range covered by interaction.
\n",
+ ourLongRange->sChrom, s, e);
+
+printf("
Statistics on the scores of all items in window (go to track controls to set minimum score to display):\n");
+
+printf("
Q1 | %f |
median | %f |
Q3 | %f |
average | %f |
min | %f |
max | %f |
count | %d |
total | %f |
standard deviation | %f |