96a87aed7b047a453d14ae47ca82de09492e6117
aamp
Wed Mar 2 14:42:02 2011 -0800
track-handling code for ENCODE peptideMapping tracks
diff --git src/hg/hgc/encodeClick.c src/hg/hgc/encodeClick.c
index 3c6ac0e..a8a9f10 100644
--- src/hg/hgc/encodeClick.c
+++ src/hg/hgc/encodeClick.c
@@ -1,25 +1,26 @@
/* Handle details page for ENCODE tracks. */
#include "common.h"
#include "cart.h"
#include "hgc.h"
#include "hCommon.h"
#include "hgColors.h"
#include "customTrack.h"
#include "web.h"
#include "encode/encodePeak.h"
+#include "peptideMapping.h"
#ifdef UNUSED
static boolean pairInList(struct slPair *pair, struct slPair *list)
/* Return TRUE if pair is in list. */
{
struct slPair *el;
for (el = list; el != NULL; el = el->next)
if (sameString(pair->name, el->name) && sameString(pair->val, el->val))
return TRUE;
return FALSE;
}
static boolean selGroupListMatch(struct trackDb *tdb, struct slPair *selGroupList)
/* Return TRUE if tdb has match to every item in selGroupList */
{
@@ -176,15 +177,69 @@
webPrintLinkCell(s);
if (start > inter->thickStart)
distance = inter->thickEnd - start;
else
distance = inter->thickStart - end;
safef(s, sizeof(s), "%d", distance);
webPrintLinkCell(s);
if (++outCount == 50)
break;
if (inter->next != NULL)
webPrintLinkTableNewRow();
}
webPrintLinkTableEnd();
sqlFreeResult(&sr);
}
+
+void doPeptideMapping(struct sqlConnection *conn, struct trackDb *tdb, char *item)
+/* Print details for a peptideMapping track. */
+{
+char *chrom = cartString(cart,"c");
+int start = cgiInt("o");
+int end = cgiInt("t");
+char **row;
+struct sqlResult *sr;
+struct peptideMapping *pos = NULL;
+int rowOffset;
+genericHeader(tdb, NULL);
+sr = hOrderedRangeQuery(conn, tdb->track, chrom, start, end, NULL, &rowOffset);
+if ((row = sqlNextRow(sr)) != NULL)
+ {
+ pos = peptideMappingLoad(row + rowOffset);
+ sqlFreeResult(&sr);
+ }
+else
+ {
+ errAbort("No items in range");
+ }
+printf("Item: %s
\n", pos->name);
+printf("Score: %d
\n", pos->score);
+printf("Raw Score: %f
\n", pos->rawScore);
+printf("Spectrum ID: %s
\n", pos->spectrumId);
+printf("Peptide Rank: %d
\n", pos->peptideRank);
+printf("Peptide Repeat Count: %d
\n", pos->peptideRepeatCount);
+printPos(pos->chrom, pos->chromStart, pos->chromEnd, pos->strand, TRUE, item);
+if (pos->peptideRepeatCount > 1)
+ {
+ char query[256];
+ struct peptideMapping anotherPos;
+ safef(query, sizeof(query), "select * from %s where name=\'%s\' and not (chrom=\'%s\' and chromStart=%d and chromEnd=%d)",
+ tdb->track, pos->name, pos->chrom, pos->chromStart, pos->chromEnd);
+ printf("
\n");
+ webPrintLinkTableStart();
+ webPrintLabelCell("Other genomic loci");
+ sr = sqlGetResult(conn, query);
+ while ((row = sqlNextRow(sr)) != NULL)
+ {
+ char s[1024];
+ peptideMappingStaticLoad(row + rowOffset, &anotherPos);
+ safef(s, sizeof(s), "%s:%d-%d",
+ hgTracksPathAndSettings(), database, anotherPos.chrom, anotherPos.chromStart+1,
+ anotherPos.chromEnd, anotherPos.chrom, anotherPos.chromStart+1, anotherPos.chromEnd);
+ webPrintLinkTableNewRow();
+ webPrintLinkCell(s);
+ }
+ webPrintLinkTableEnd();
+ sqlFreeResult(&sr);
+ }
+peptideMappingFree(&pos);
+}