6b833bddf059affee05eb0ddb1b2d4e06554ca6b jcasper Thu Mar 23 14:28:05 2017 -0700 DECIPHER track now displays correct mean ratio and pathogenicity, refs #19129 diff --git src/hg/hgTracks/simpleTracks.c src/hg/hgTracks/simpleTracks.c index 40d742c..a45b39e 100644 --- src/hg/hgTracks/simpleTracks.c +++ src/hg/hgTracks/simpleTracks.c @@ -6598,61 +6598,69 @@ bedPlusLabelLoad(tg, decipherPhenotypeList); } Color decipherColor(struct track *tg, void *item, struct hvGfx *hvg) /* Return color to draw DECIPHER entry */ { struct bed *bed = item; int col = tg->ixColor; struct sqlConnection *conn = hAllocConn(database); struct sqlResult *sr; char **row; char query[256]; char cond_str[256]; char *decipherId = NULL; +/* So far, we can just remove "chr" from UCSC chrom names to get DECIPHER names */ +char *decipherChrom = bed->chrom; +if (startsWithNoCase("chr", bed->chrom)) + decipherChrom += 3; + /* color scheme: RED: If the entry is a deletion (mean ratio < 0) BLUE: If the entry is a duplication (mean ratio > 0) */ sqlSafefFrag(cond_str, sizeof(cond_str),"name='%s' ", bed->name); decipherId = sqlGetField(database, "decipher", "name", cond_str); if (decipherId != NULL) { if (hTableExists(database, "decipherRaw")) { sqlSafef(query, sizeof(query), - "select mean_ratio > 0 from decipherRaw where id = '%s' and start=%d and end=%d", - decipherId, bed->chromStart+1, bed->chromEnd); + "select mean_ratio > 0 from decipherRaw where id = '%s' and " + "chr = '%s' and start = %d and end = %d", + decipherId, decipherChrom, bed->chromStart+1, bed->chromEnd); sr = sqlGetResult(conn, query); if ((row = sqlNextRow(sr)) != NULL) { if (sameWord(row[0], "1")) { col = MG_BLUE; } else { col = MG_RED; } } sqlFreeResult(&sr); /* add more logic here to check for mean_ratio = 0 (which is a problem to be fixed by DECIPHER */ sqlSafef(query, sizeof(query), - "select mean_ratio = 0 from decipherRaw where id = '%s'", decipherId); + "select mean_ratio = 0 from decipherRaw where id = '%s' and " + "chr = '%s' and start = %d and end = %d", + decipherId, decipherChrom, bed->chromStart+1, bed->chromEnd); sr = sqlGetResult(conn, query); if ((row = sqlNextRow(sr)) != NULL) { if (sameWord(row[0], "1")) { col = MG_GRAY; } } sqlFreeResult(&sr); } } hFreeConn(&conn); return(col); }