8e6fcda9f58bf3549bab4ff15b99efc46f842bab
larrym
Thu Jun 7 12:29:54 2012 -0700
remove hBackgroundImage and hgColOutside
diff --git src/hg/phyloGif/phyloGif.c src/hg/phyloGif/phyloGif.c
index 7db7a57..667ed9a 100644
--- src/hg/phyloGif/phyloGif.c
+++ src/hg/phyloGif/phyloGif.c
@@ -1,753 +1,752 @@
/* phyloGif.c for parsing phylo tree and outputting a gif.
*
* Author: Galt Barber 2006
*
* Designed to be run either as a cgi or as a command-line utility.
* The input file spec matches the .nh tree format e.g. (cat:0.5,dog:0.6):1.2;
* The output gif layout was originally designed to ignore branch lengths.
* However, options have now been added to allow it to use branchlengths,
* and to label the length of the branches.
* Any _suffix is stripped from labels both because pyloTree.c
* can't tolerate underscores and because we don't want suffixes anyway.
* A semi-colon is automatically appended to the input if left off.
* Because phyloTree.c does errAbort on bad input, this causes cgi err 500
* if the input data has incorrect syntax. See the apache error_log.
* Added another option to place form output in a static html page
* so that we can prevent IE6 save-as bug, and FF auto-shrunk output.
* Added an option to display a length-scale legend or ruler at the bottom.
* Added an option to preserve underscores in input as spaces in output.
*
*
* One may use as a cgi in html GET:
*
*
* Or as cgi in html POST:
\n" "((A:0.1,B:0.1):0.2,C:0.15);\n" " | \n"
" |
\n" "((A:0.1,B:0.1)D:0.2,C:0.15)E;\n" " | \n"
" (internal or ancestral node labels)\n" " |
\n" " ((((\n" " (\n" " ((mouse,rat),human),\n" " (dog,cow)\n" " ),\n" " opossum),\n" " chicken),\n" " xenopus),\n" " (tetraodon,zebrafish));\n" " | \n"
" |
"); /* we dont think the specific error message coming back are correct or useful * so supply a generic err msg */ printf("Original input tree:\n[%s]\n\n",cgiString("phyloGif_tree")); printf("Input tree as passed to parser:\n[%s]\n\n",phyloData); printf("Parser syntax error:\n%s",errMsg); puts(""); } else { warn("%s", errMsg); } freez(&errMsg); freez(&phyloData); return 0; } } MgFont *font = NULL; if (monospace) font = mgMenloMediumFont(); else font = mgMediumBoldFont(); if (phyloTree) { mg = mgNew(width,height); mgClearPixels(mg); lengthLegend = lengthLegend && branchLengths; /* moot without lengths */ if (lengthLegend) { int fHeight = mgFontPixelHeight(font); height -= (MARGIN+2*fHeight); } phyloTreeLayoutBL(phyloTree, &maxDepth, &numLeafs, 0, font, &maxLabelWidth, width, &minMaxFactor, 0.0); if (layoutErrMsg[0] != 0) { if (onWeb) { printf("Content-type: text/html\r\n"); printf("\r\n"); puts("
"); printf("input tree: [%s]\n\n%s",cgiString("phyloGif_tree"),layoutErrMsg); puts(""); } else { warn("%s", layoutErrMsg); } freez(&phyloData); mgFree(&mg); return 0; } if (branchLengths) phyloTreeGifBL(phyloTree, maxDepth, numLeafs, maxLabelWidth, width, height, mg, font, minMaxFactor, FALSE); else phyloTreeGif(phyloTree, maxDepth, numLeafs, maxLabelWidth, width, height, mg, font); if (lengthLegend) { int i = 0; char out[256]; double scaleEnd = (width - 2*MARGIN); int fHeight = mgFontPixelHeight(font); int x=0; int dh=0; mgDrawLine(mg, MARGIN, height+fHeight/2, width-MARGIN, height+fHeight/2, MG_BLACK); while(TRUE) { x=((minMaxFactor*i)/10); if (x >= scaleEnd) break; if ((i % 5) == 0) { int y = mgFontCharWidth(font,'0'); y += 0.5*mgFontCharWidth(font,'.'); safef(out,sizeof(out),"%3.2f",branchMultiplier*i/10.0); if (branchMultiplier > 10) safef(out,sizeof(out),"%3.0f",branchMultiplier*i/10.0); mgText(mg, MARGIN+x-y, height+fHeight, MG_BLACK, font, out); dh=fHeight/2; } else { dh = fHeight / 4; } mgDrawLine(mg, MARGIN+x, height+fHeight/2-dh, MARGIN+x, height+fHeight/2+dh, MG_BLACK); ++i; } } } if (onWeb) { printf("Content-type: image/png\r\n"); printf("\r\n"); } if (!mgSaveToPng(stdout, mg, FALSE)) { errAbort("Couldn't save png to stdout"); } if (cgiOptionalString("phyloGif_submit")) cartCheckout(&cart); /* there's no code for freeing the phyloTree yet in phyloTree.c */ mgFree(&mg); freez(&phyloData); return 0; }