89ab8ae5fb747465c8f9c218c8556750033e2061
jcasper
Wed May 16 20:02:03 2018 -0700
DECIPHER CNVs track handles new format, also release of SNVs track, refs #21104
diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index efc2518..7728cc8 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -9940,31 +9940,149 @@
sqlFreeResult(&sr);
hFreeConn(&conn);
printf("
");
printPosOnChrom(chrom, atoi(chromStart), atoi(chromEnd), NULL, FALSE, itemName);
}
void doCosmic(struct trackDb *tdb, char *item)
/* Put up COSMIC track info. */
{
genericHeader(tdb, item);
printCosmicDetails(tdb, item);
printTrackHtml(tdb);
}
-void printDecipherDetails(struct trackDb *tdb, char *itemName, boolean encode)
+void printDecipherSnvsDetails(struct trackDb *tdb, char *itemName, boolean encode)
+/* Print details of a DECIPHER entry. */
+{
+struct sqlConnection *conn = hAllocConn(database);
+char query[256];
+struct sqlResult *sr;
+char **row;
+char *strand={"+"};
+int start = cartInt(cart, "o");
+int end = cartInt(cart, "t");
+char *chrom = cartString(cart, "c");
+
+/* So far, we can just remove "chr" from UCSC chrom names to get DECIPHER names */
+char *decipherChrom = chrom;
+if (startsWithNoCase("chr", decipherChrom))
+ decipherChrom += 3;
+
+printf("Patient %s
", itemName);
+
+/* print phenotypes and other information, if available */
+if (sqlFieldIndex(conn, "decipherSnvsRaw", "phenotypes") >= 0)
+ {
+ sqlSafef(query, sizeof(query),
+ "select phenotypes, refAllele, altAllele, transcript, gene, genotype, "
+ "inheritance, pathogenicity, contribution "
+ "from decipherSnvsRaw where id = '%s' and chr = '%s' and start = %d and end = %d",
+ itemName, decipherChrom, start+1, end);
+ sr = sqlMustGetResult(conn, query);
+ row = sqlNextRow(sr);
+ if ((row != NULL) && strlen(row[0]) >= 1)
+ {
+ char *phenoString = replaceChars(row[0], "|", "\n");
+ printf("Phenotypes:\n\n", phenoString);
+ // freeMem(phenoString);
+ }
+ if (row != NULL)
+ {
+ char *hgsidString = cartSidUrlString(cart);
+ if (isNotEmpty(row[1]))
+ {
+ printf("Ref Allele: %s\n
\n", row[1]);
+ }
+ if (isNotEmpty(row[2]))
+ {
+ printf("Alt Allele: %s\n
\n", row[2]);
+ }
+ if (isNotEmpty(row[3]))
+ {
+ printf("Transcript: %s\n
\n",
+ hgsidString, row[3], row[3]);
+ }
+ if (isNotEmpty(row[4]))
+ {
+ printf("Gene: %s\n
\n",
+ hgsidString, row[4], row[4]);
+ }
+ if (isNotEmpty(row[5]))
+ {
+ printf("Genotype: %s\n
\n", row[5]);
+ }
+ if (isNotEmpty(row[6]))
+ {
+ printf("Inheritance: %s\n
\n", row[5]);
+ }
+ if (isNotEmpty(row[7]))
+ {
+ printf("Pathogenicity: %s\n
\n", row[5]);
+ }
+ if (isNotEmpty(row[8]))
+ {
+ printf("Contribution: %s\n
\n", row[5]);
+ }
+ }
+ sqlFreeResult(&sr);
+ }
+else
+ {
+ sqlSafef(query, sizeof(query),
+ "select distinct phenotype from decipherSnvsRaw where id ='%s' order by phenotype", itemName);
+ sr = sqlMustGetResult(conn, query);
+ row = sqlNextRow(sr);
+ if ((row != NULL) && strlen(row[0]) >= 1)
+ {
+ printf("Phenotype: ");
+ while (row != NULL)
+ {
+ printf("- ");
+ printf("%s\n", row[0]);
+ row = sqlNextRow(sr);
+ }
+ printf("
");
+ }
+ sqlFreeResult(&sr);
+ }
+
+/* link to Ensembl DECIPHER Patient View page */
+printf("Patient View: \n");
+printf("More details on patient %s at ", itemName);
+printf("",
+ "https://decipher.sanger.ac.uk/patient/", itemName);
+printf("DECIPHER.
");
+
+/* print position info */
+printPosOnChrom(chrom, start, end, strand, TRUE, itemName);
+
+hFreeConn(&conn);
+}
+
+void doDecipherSnvs(struct trackDb *tdb, char *item, char *itemForUrl)
+/* Put up DECIPHER track info. */
+{
+genericHeader(tdb, item);
+printDecipherSnvsDetails(tdb, item, FALSE);
+printTrackHtml(tdb);
+}
+
+void printDecipherCnvsDetails(struct trackDb *tdb, char *itemName, boolean encode)
/* Print details of a DECIPHER entry. */
{
struct sqlConnection *conn = hAllocConn(database);
char query[256];
struct sqlResult *sr;
char **row;
struct sqlConnection *conn2 = hAllocConn(database);
char query2[256];
struct sqlResult *sr2;
char **row2;
char *strand={"+"};
int start = cartInt(cart, "o");
int end = cartInt(cart, "t");
char *chrom = cartString(cart, "c");
@@ -10065,35 +10183,35 @@
printf("");
printf("","./hgGene\?hgg_chrom=none&hgg_gene=", row2[1]);
printf("%s (%s) ", row2[0], row2[1]);
printf(" %s", row2[2]);
}
sqlFreeResult(&sr2);
row = sqlNextRow(sr);
}
sqlFreeResult(&sr);
printf("");
}
hFreeConn(&conn);
hFreeConn(&conn2);
}
-void doDecipher(struct trackDb *tdb, char *item, char *itemForUrl)
+void doDecipherCnvs(struct trackDb *tdb, char *item, char *itemForUrl)
/* Put up DECIPHER track info. */
{
genericHeader(tdb, item);
-printDecipherDetails(tdb, item, FALSE);
+printDecipherCnvsDetails(tdb, item, FALSE);
printTrackHtml(tdb);
}
char *gbCdnaGetDescription(struct sqlConnection *conn, char *acc)
/* return mrna description, or NULL if not available. freeMem result */
{
char query[1024];
if (!sqlTableExists(conn, gbCdnaInfoTable))
return NULL;
sqlSafef(query, sizeof(query),
"select d.name from %s g,%s d where (acc = '%s') and (g.description = d.id)", gbCdnaInfoTable, descriptionTable, acc);
char *desc = sqlQuickString(conn, query);
if ((desc == NULL) || sameString(desc, "n/a") || (strlen(desc) == 0))
freez(&desc);
return desc;
@@ -25495,31 +25613,35 @@
}
else if (sameWord(table, "rgdEst"))
{
doHgRna(tdb, item);
}
else if (sameWord(table, "rgdSslp"))
{
doRgdSslp(tdb, item, NULL);
}
else if (sameWord(table, "gad"))
{
doGad(tdb, item, NULL);
}
else if (sameWord(table, "decipher"))
{
- doDecipher(tdb, item, NULL);
+ doDecipherCnvs(tdb, item, NULL);
+ }
+else if (sameWord(table, "decipherSnvs"))
+ {
+ doDecipherSnvs(tdb, item, NULL);
}
else if (sameWord(table, "omimGene"))
{
doOmimGene(tdb, item);
}
else if (sameWord(table, "rgdQtl") || sameWord(table, "rgdRatQtl"))
{
doRgdQtl(tdb, item);
}
else if (sameWord(table, "superfamily"))
{
doSuperfamily(tdb, item, NULL);
}
else if (sameWord(table, "ensGene") || sameWord (table, "ensGeneNonCoding"))
{