6992d44bfe238ffb2c2d559b23cf739bee503fda chmalee Fri May 11 15:27:50 2018 -0700 Adding a clear button to phyloPng and changing the default tree, refs #17322 diff --git src/hg/phyloPng/phyloPng.c src/hg/phyloPng/phyloPng.c index 3fc4ce7..811a411 100644 --- src/hg/phyloPng/phyloPng.c +++ src/hg/phyloPng/phyloPng.c @@ -442,53 +442,48 @@ puts("<tr><td> How many decimal places?</td><td>"); cartMakeIntVar(cart, "phyloPng_branchDecimals", branchDecimals,1); puts("</td></tr>"); puts("<tr><td> Multiply branch length by factor?</td><td>"); cartMakeIntVar(cart, "phyloPng_branchMultiplier", branchMultiplier,5); puts("</td></tr>"); puts("<tr><td>Strip underscore-suffixes?</td><td>"); cartMakeCheckBox(cart, "phyloPng_undersuff_strip", stripUnderscoreSuff); puts("</td></tr>"); puts("<tr><td>Change dash to space?</td><td>"); cartMakeCheckBox(cart, "phyloPng_dash_to_space", dashToSpace); puts("</td></tr>"); puts("<tr><td>Change underscore to space?</td><td>"); cartMakeCheckBox(cart, "phyloPng_under_to_space", underToSpace); puts("</td></tr>"); puts("<tr><td>Wrap in html page?</td><td>"); cartMakeCheckBox(cart, "phyloPng_htmlPage", htmlPageWrapper); puts("</td></tr>"); puts("<tr><td>Monospace font?</td><td>"); cartMakeCheckBox(cart, "phyloPng_monospace", monospace); puts("</td></tr>"); printf("<tr><td><big>TREE:</big>"); puts("<br><br><INPUT type=\"submit\" name=\"phyloPng_restore\" value=\"restore default\">"); puts("</td><td><textarea name=\"phyloPng_tree\" rows=14 cols=70>"); if (NULL == phyloData || phyloData[0] == '\0' || cgiVarExists("phyloPng_restore")) { puts( -"(((((((((\n" -"(human_hg18:0.00669,chimp_panTro1:0.00757):0.0243,\n" -" macaque_rheMac2:0.0592):0.0240,\n" -" ((rat_rn4:0.0817,mouse_mm8:0.0770):0.229,\n" -" rabbit_oryCun1:0.207):0.107):0.0230,\n" -" (cow_bosTau2:0.159,dog_canFam2:0.148):0.0394):0.0285,\n" -" armadillo_dasNov1:0.150):0.0160,\n" -" (elephant_loxAfr1:0.105,tenrec_echTel1:0.260):0.0404):0.218,\n" -" monodelphis_monDom4:0.371):0.189,\n" -" chicken_galGal2:0.455):0.123,\n" -" xenopus_xenTro1:0.782):0.156,\n" -" ((tetraodon_tetNig1:0.199,fugu_fr1:0.239):0.493,\n" -" zebrafish_danRer3:0.783):0.156);" +"(((((Human:0.00655,\n" +" Chimp:0.00684):0.027424,\n" +" Rhesus:0.037601):0.109934,\n" +" (Mouse:0.084509,\n" +" Rat:0.091589):0.271974):0.020593,\n" +" Dog:0.165928):0.258392,\n" +"Opossum:0.340786);\n" ); } else { printf("%s",phyloData); } puts("</TEXTAREA>"); puts("</td></tr>"); puts("<tr><td> </td><td>"); puts("<INPUT type=\"submit\" name=\"phyloPng_submit\" value=\"submit\">"); + cgiMakeClearButtonNoSubmit("mainForm", "phyloPng_tree"); puts("</td></tr>"); puts("</table>"); puts("</form>"); webNewSection("Notes"); puts( "\n" "1. Length-ruler and length-values cannot be shown unless use-branch-lengths is also checked.<br>\n" "<br>\n" "2. If \"Strip underscore-suffixes?\" is checked, underscores and anything following them are stripped from node labels.<br>\n" "<br>\n" "3. For backwards compatibility, options exist to convert a dash or underscore to a space in a node label.<br>\n" "<br>\n" "4. The tree is in the phastCons or .nh format name:length. Parentheses create a parent.\n" "Parents must have two children. Length is not required if use-branch-lengths is not checked.\n" "The length of the root branch is usually not specified.<br>\n" @@ -574,30 +569,31 @@ if (stripUnderscoreSuff) printf("&phyloPng_underscores=1"); if (dashToSpace) printf("&phyloPng_dash_to_space=1"); if (underToSpace) printf("&phyloPng_under_to_space=1"); if (monospace) printf("&phyloPng_monospace=1"); puts("\"></body></html>"); freez(&phyloData); return 0; } + if (!onWeb && phyloData[0] != '(') { int fd = 0; /* default to stdin */ if (!sameString(phyloData,"stdin")) fd = open(phyloData,O_RDONLY); struct dyString *dy = netSlurpFile(fd); if (fd) close(fd); freez(&phyloData); phyloData = dyStringCannibalize(&dy); } /* remove carriage returns which are a side-effect of html forms */ if (strchr(phyloData,'\r')) {