71b6403f90f9f221004a07cbd4e5aecedd9f6438 galt Mon Apr 24 12:41:27 2017 -0700 Refs #17538. Adds ability for user to paste a custom BED region into the multi-region dialog box instead of having to provide a URL to an on-line server. It still supports the URL through UDC however, which is more efficient for large custom region lists and also provides backwards compatibility. Uses sha1 instead of md5 for faster speed now. diff --git src/hg/hgTracks/config.c src/hg/hgTracks/config.c index 5443d77..e1ca566 100644 --- src/hg/hgTracks/config.c +++ src/hg/hgTracks/config.c @@ -627,32 +627,55 @@ /* obsolete if (conn && sqlTableExists(conn,"knownCanonical")) { hPrintf("<TR><TD>"); cgiMakeRadioButton("virtModeType", "kcGenes", sameWord("kcGenes", virtModeType)); hPrintf("</TD><TD>"); hPrintf("Show gene regions genome-wide."); hPrintf("</TD></TR>\n"); } */ hPrintf("<TR><TD>"); cgiMakeRadioButton("virtModeType", "customUrl", sameWord("customUrl", virtModeType)); hPrintf("</TD><TD>"); -hPrintf("Custom regions from BED URL: "); -hTextVar("multiRegionsBedUrl", cartUsualString(cart, "multiRegionsBedUrl", multiRegionsBedUrl), 60); +hPrintf("Enter Custom regions as BED, or a URL to them:<br>"); +//OLDWAY GALT TODO REMOVE +//hTextVar("multiRegionsBedUrl", cartUsualString(cart, "multiRegionsBedUrl", multiRegionsBedUrl), 60); +multiRegionsBedUrl = cartUsualString(cart, "multiRegionsBedUrl", multiRegionsBedUrl); +struct dyString *dyMultiRegionsBedInput = dyStringNew(256); +if (strstr(multiRegionsBedUrl,"://")) + { + dyStringAppend(dyMultiRegionsBedInput, multiRegionsBedUrl); + } +else + { + if (fileExists(multiRegionsBedUrl)) + { + struct lineFile *lf = lineFileMayOpen(multiRegionsBedUrl, TRUE); + char *line; + int lineSize; + while (lineFileNext(lf, &line, &lineSize)) + { + dyStringPrintf(dyMultiRegionsBedInput, "%s\n", line); + } + lineFileClose(&lf); + } + } +hPrintf("<TEXTAREA NAME='multiRegionsBedInput' ID='multiRegionsBedInput' rows='4' cols='60'>%s</TEXTAREA>", + dyMultiRegionsBedInput->string); hPrintf("</TD></TR>\n"); /* The AllChroms option will be released in future if (emGeneTable && sqlTableExists(conn, emGeneTable)) { hPrintf("<TR><TD>"); cgiMakeRadioButton("virtModeType", "singleTrans", sameWord("singleTrans", virtModeType)); hPrintf("</TD><TD>"); hPrintf("Show only one transcript using an ID from %s : ", emGeneTrack->shortLabel); char *trans = cartUsualString(cart, "singleTransId", singleTransId); char sql[1024]; sqlSafef(sql, sizeof sql, "select name from %s where name='%s'", emGeneTable, trans); char *result = sqlQuickString(conn, sql); if (!result)