161078cdaf6e7304a4f38882d67fff7dcd51d303
angie
Mon Sep 30 10:29:31 2013 -0700
Code review feedback from Brian - use trackDb instead of hardcoding accessory URL.refs #11763
diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 88aed04..4fdcd46 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -16138,45 +16138,45 @@
}
printf("Variant Type: %s
\n", dgv.varType);
printf("Reference: %s
\n", dgv.reference);
printf("Method/platform: %s
\n", dgv.method);
printf("Sample: %s
\n", dgv.sample);
if (isNotEmpty(dgv.landmark))
printf("Landmark: %s
\n", dgv.landmark);
}
sqlFreeResult(&sr);
hFreeConn(&conn);
printTrackHtml(tdb);
}
-#define CORIELL_ID_URL_BASE "http://ccr.coriell.org/Sections/Search/Sample_Detail.aspx?Ref="
-
-static void maybePrintCoriellLinks(char *commaSepIds)
-/* If id looks like a Coriell ID, print a link to Coriell, otherwise just print id. */
+static void maybePrintCoriellLinks(struct trackDb *tdb, char *commaSepIds)
+/* If id looks like a Coriell NA ID, print a link to Coriell, otherwise just print id. */
{
+char *coriellUrlBase = trackDbSetting(tdb, "coriellUrlBase");
struct slName *id, *sampleIds = slNameListFromComma(commaSepIds);
for (id = sampleIds; id != NULL; id = id->next)
{
- if (startsWith("NA", id->name) && countLeadingDigits(id->name+2) == strlen(id->name+2))
+ if (startsWith("NA", id->name) && countLeadingDigits(id->name+2) == strlen(id->name+2)
+ && isNotEmpty(coriellUrlBase))
{
// I don't know why coriell doesn't have direct links to NA's but oh well,
// we can substitute 'GM' for 'NA' to get to the page...
char *gmId = cloneString(id->name);
gmId[0] = 'G'; gmId[1] = 'M';
- printf("%s", gmId, id->name);
+ printf("%s", coriellUrlBase, gmId, id->name);
freeMem(gmId);
}
else
printf("%s", id->name);
if (id->next != NULL)
printf(", ");
}
slNameFreeList(&sampleIds);
}
static void printBrowserPosLinks(char *commaSepIds)
/* Print hgTracks links with position=id. */
{
struct slName *id, *sampleIds = slNameListFromComma(commaSepIds);
for (id = sampleIds; id != NULL; id = id->next)
@@ -16218,31 +16218,31 @@
dgv.chrom, dgv.chromStart+1, dgv.chromEnd);
printBand(dgv.chrom, dgv.chromStart, dgv.chromEnd, FALSE);
printf("Genomic size: %d
\n", dgv.chromEnd - dgv.chromStart);
printf("Variant type: %s
\n", dgv.varType);
printf("Reference: %s
\n", dgv.reference);
printf("Method: %s
\n", dgv.method);
if (isNotEmpty(dgv.platform))
printf("Platform: %s
\n", dgv.platform);
if (isNotEmpty(dgv.cohortDescription))
printf("Sample cohort description: %s
\n", dgv.cohortDescription);
if (isNotEmpty(dgv.samples))
{
printf("Sample IDs: ");
- maybePrintCoriellLinks(dgv.samples);
+ maybePrintCoriellLinks(tdb, dgv.samples);
printf("
\n");
}
printf("Sample size: %u
\n", dgv.sampleSize);
if (dgv.observedGains != 0 || dgv.observedLosses != 0)
{
printf("Observed gains: %u
\n", dgv.observedGains);
printf("Observed losses: %u
\n", dgv.observedLosses);
}
if (isNotEmpty(dgv.mergedVariants))
{
printf("Merged variants: ");
printBrowserPosLinks(dgv.mergedVariants);
printf("
\n");
}
if (isNotEmpty(dgv.supportingVariants))