31b5609343b1ad1864cc9ce43ddbf7bad3435208 angie Mon Jan 17 10:06:44 2011 -0800 Just for fun, added HGDP world map icon to collapsible section header in SNP details. diff --git src/hg/hgc/hgdpClick.c src/hg/hgc/hgdpClick.c index b804999..05426ca 100644 --- src/hg/hgc/hgdpClick.c +++ src/hg/hgc/hgdpClick.c @@ -334,43 +334,58 @@ static boolean canMakeImages() /* Determine whether we have the necessary command line programs for * creating images above. */ { char *psxy = cfgOption("hgc.psxyPath"); char *ps2raster = cfgOption("hgc.ps2rasterPath"); char *ghostscript = cfgOption("hgc.ghostscriptPath"); if (isEmpty(psxy) || isEmpty(ps2raster) || isEmpty(ghostscript)) return FALSE; if (!fileExists(psxy) || !fileExists(ps2raster) || !fileExists(ghostscript)) return FALSE; return TRUE; } -void hgdpGeoImg(struct hgdpGeo *geo) -/* Generate a PNG image: world map with pie charts for population allele frequencies. */ +static void getTrashFileNames(char *rsId, char epsFile[PATH_LEN], char pdfFile[PATH_LEN], + char pngFile[PATH_LEN]) +/* Get stable trash file names (always in trash/hgc, based on geo->name so we can reuse). */ { -if (! canMakeImages()) - return; struct tempName tn; trashDirFile(&tn, "hgc", "", ""); char trashDir[FILENAME_LEN]; splitPath(tn.forCgi, trashDir, NULL, NULL); +safef(epsFile, PATH_LEN, "%shgdpGeo_%s.eps", trashDir, rsId); +safef(pdfFile, PATH_LEN, "%shgdpGeo_%s.pdf", trashDir, rsId); +safef(pngFile, PATH_LEN, "%shgdpGeo_%s.png", trashDir, rsId); +} + +char *hgdpPngFilePath(char *rsId) +/* Return the stable PNG trash-cached image path for rsId. */ +{ +char epsFile[PATH_LEN], pdfFile[PATH_LEN], pngFile[PATH_LEN]; +getTrashFileNames(rsId, epsFile, pdfFile, pngFile); +return cloneString(pngFile); +} + +void hgdpGeoImg(struct hgdpGeo *geo) +/* Generate image as PNG, PDF, EPS: world map with pie charts for population allele frequencies. */ +{ +if (! canMakeImages()) + return; char geoSnpEpsFile[PATH_LEN], geoSnpPdfFile[PATH_LEN], geoSnpPngFile[PATH_LEN]; -safef(geoSnpEpsFile, sizeof(geoSnpEpsFile), "%shgdpGeo_%s.eps", trashDir, geo->name); -safef(geoSnpPdfFile, sizeof(geoSnpPdfFile), "%shgdpGeo_%s.pdf", trashDir, geo->name); -safef(geoSnpPngFile, sizeof(geoSnpPngFile), "%shgdpGeo_%s.png", trashDir, geo->name); +getTrashFileNames(geo->name, geoSnpEpsFile, geoSnpPdfFile, geoSnpPngFile); if (! (fileExists(geoSnpEpsFile) && fileExists(geoSnpPdfFile) && fileExists(geoSnpPngFile))) generateImgFiles(geo, geoSnpEpsFile, geoSnpPdfFile, geoSnpPngFile); printf("<A HREF=\"%s\" TARGET=_BLANK><IMG SRC=\"%s\" WIDTH=677 HEIGHT=490></A><BR>\n", geoSnpPngFile, geoSnpPngFile); printf("<A HREF=\"%s\" TARGET=_BLANK>PDF</A> ", geoSnpPdfFile); printf("<A HREF=\"%s\" TARGET=_BLANK>EPS</A> ", geoSnpEpsFile); printf("<A HREF=\"%s\" TARGET=_BLANK>PNG</A><BR>\n", geoSnpPngFile); printf("Population key:\n"); printf("<A HREF=\"../images/hgdpGeoPopKey.pdf\" TARGET=_BLANK>PDF</A> "); printf("<A HREF=\"../images/hgdpGeoPopKey.eps\" TARGET=_BLANK>EPS</A> "); printf("<A HREF=\"../images/hgdpGeoPopKey.png\" TARGET=_BLANK>PNG</A><BR>\n"); } void hgdpGeoFreqTable(struct hgdpGeo *geo)