21e5bfb345bf372c0855901b583cc6833a67aa03
angie
Wed Jan 26 14:24:05 2011 -0800
Feature #1638 (Add "this SNP also maps to" text to hgdpGeo track).
diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index feff54d..c9fccb5 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -16246,86 +16246,91 @@
jsEndCollapsibleSection();
}
static void checkForLsSnpMappings(struct sqlConnection *conn, char *snpTrack, char *snpId)
/* check if this SNP is mapped to any protein by LS-SNP, and if so print
* the information. */
{
struct slName *pdbIds = lsSnpPdbChimeraGetSnpPdbs(conn, snpId);
if (pdbIds != NULL)
{
printLsSnpMappings(conn, pdbIds, snpTrack, snpId);
slFreeList(&pdbIds);
}
}
+void printOtherSnpMappings(char *table, char *name, int start,
+ struct sqlConnection *conn, int rowOffset)
+/* If this SNP (from any bed4+ table) is not uniquely mapped, print the other mappings. */
+{
+char query[512];
+safef(query, sizeof(query), "select * from %s where name='%s'",
+ table, name);
+struct sqlResult *sr = sqlGetResult(conn, query);
+int snpCount = 0;
+char **row;
+while ((row = sqlNextRow(sr)) != NULL)
+ {
+ struct bed *snp = bedLoad3(row + rowOffset);
+ if (snp->chromStart != start || differentString(snp->chrom, seqName))
+ {
+ printf("
\n");
+ if (snpCount == 0)
+ printf("This SNP maps to these additional locations:
\n");
+ snpCount++;
+ bedPrintPos((struct bed *)snp, 3, tdb);
+ }
+ }
+sqlFreeResult(&sr);
+}
+
void doSnpWithVersion(struct trackDb *tdb, char *itemName, int version)
/* Process SNP details. */
{
char *table = tdb->table;
struct snp132Ext *snp;
struct snp *snpAlign = NULL;
int start = cartInt(cart, "o");
struct sqlConnection *conn = hAllocConn(database);
struct sqlResult *sr;
char **row;
char query[512];
int rowOffset=hOffsetPastBin(database, seqName, table);
-int snpCount=0;
genericHeader(tdb, NULL);
printf("