src/hg/hgc/bigBedClick.c 1.9
1.9 2010/02/19 23:24:34 angie
Instead of dumping out the full BED+ record when there are more than 6 BED fields (we don't subject our users to that on plain BED track details pages), display non-BED fields if there are any.
Index: src/hg/hgc/bigBedClick.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgc/bigBedClick.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -b -B -U 4 -r1.8 -r1.9
--- src/hg/hgc/bigBedClick.c 19 Feb 2010 00:22:30 -0000 1.8
+++ src/hg/hgc/bigBedClick.c 19 Feb 2010 23:24:34 -0000 1.9
@@ -53,18 +53,19 @@
}
if (bbMatch != NULL)
{
- int extraFields = 0;
+ int seq1Seq2Fields = 0;
// check for seq1 and seq2 in columns 7+8 (eg, pairedTagAlign)
- char *setting = trackDbSetting(tdb, BASE_COLOR_USE_SEQUENCE);
- if (bedSize == 6 && setting && sameString(setting, "seq1Seq2"))
- extraFields = 2;
- char *fields[bedSize+extraFields];
+ boolean seq1Seq2 = sameOk(trackDbSetting(tdb, BASE_COLOR_USE_SEQUENCE), "seq1Seq2");
+ if (seq1Seq2 && bedSize == 6)
+ seq1Seq2Fields = 2;
+ char *fields[bedSize+seq1Seq2Fields];
char startBuf[16], endBuf[16];
char *rest = cloneString(bbMatch->rest);
- int bbFieldCount = bigBedIntervalToRow(bbMatch, chrom, startBuf, endBuf, fields, bedSize+extraFields);
- if (bbFieldCount != bedSize+extraFields)
+ int bbFieldCount = bigBedIntervalToRow(bbMatch, chrom, startBuf, endBuf, fields,
+ bedSize+seq1Seq2Fields);
+ if (bbFieldCount != bedSize+seq1Seq2Fields)
{
errAbort("Disagreement between trackDb field count (%d) and %s fieldCount (%d)",
bedSize, fileName, bbFieldCount);
}
@@ -71,14 +72,27 @@
struct bed *bed = bedLoadN(fields, bedSize);
if (bedSize >= 4)
printCustomUrl(tdb, item, TRUE);
bedPrintPos(bed, bedSize, tdb);
+
// display seq1 and seq2
- if (bedSize+extraFields == 8 && setting && sameString(setting, "seq1Seq2"))
- printf("<table><tr><th>Sequence 1</th><th>Sequence 2</th></tr><tr><td> %s </td><td> %s </td></tr></table>", fields[6], fields[7]);
- else if (bedSize+extraFields > 6) // we have more fields to print
- printf("Full bed record:<BR><PRE><TT>%s\t%u\t%u\t%s\n</TT></PRE>\n",
- chrom, bb->start, bb->end, rest);
+ if (seq1Seq2 && bedSize+seq1Seq2Fields == 8)
+ printf("<table><tr><th>Sequence 1</th><th>Sequence 2</th></tr>"
+ "<tr><td> %s </td><td> %s </td></tr></table>", fields[6], fields[7]);
+ else
+ {
+ char *restFields[256];
+ int restCount = chopTabs(rest, restFields);
+ int restBedFields = bedSize - 3;
+ if (restCount > restBedFields)
+ {
+ int i;
+ printf("<B>Non-BED fields:</B> ");
+ for (i = restBedFields; i < restCount; i++)
+ printf("%s%s", (i > 0 ? "\t" : ""), restFields[i]);
+ printf("<BR>\n");
+ }
+ }
}
else
{
printf("No item %s starting at %d\n", emptyForNull(item), start);