08ec019f344fc52bd83ea3a98bedccd0048d732c angie Mon May 24 00:04:08 2021 -0700 Let the user upload a file containing names or IDs of sequences already in the selected tree; run matUtils extract to get subtrees that include those sequences. protobufs.tab gets a new optional column to specify a file that maps alias to tree name/ID (e.g. for mapping EPI_ISL to public names/IDs). diff --git src/hg/hgPhyloPlace/hgPhyloPlace.c src/hg/hgPhyloPlace/hgPhyloPlace.c index 2b40aaf..dd8661e 100644 --- src/hg/hgPhyloPlace/hgPhyloPlace.c +++ src/hg/hgPhyloPlace/hgPhyloPlace.c @@ -138,62 +138,62 @@ // Container for bootstrap grid layout puts( "
\n"); } static void newPageEndStuff() { puts( "
"); jsIncludeFile("utils.js", NULL); webIncludeFile("inc/gbFooter.html"); webEndJWest(); } -#define CHECK_FILE_INPUT_JS "{ var $fileInput = $('input[name="seqFileVar"]'); " \ +#define CHECK_FILE_INPUT_JS(varName) "{ var $fileInput = $('input[name="varName"]'); " \ "if ($fileInput && $fileInput[0] && $fileInput[0].files && !$fileInput[0].files.length) {" \ " alert('Please choose a file first, then click the upload button.');" \ " return false; " \ "} else { loadingImage.run(); return true; } }" static void inputForm() /* Ask the user for FASTA or VCF. */ { printf("
\n\n", "hgPhyloPlace"); cartSaveSession(cart); char *db = "wuhCor1"; cgiMakeHiddenVar("db", db); puts("
"); puts("
"); puts("

Upload your SARS-CoV-2 sequence (FASTA or VCF file) to find the most similar\n" "complete, high-coverage samples from \n" "GISAID\n" "or from public sequence databases (" "NCBI Virus / GenBank,\n" "COG-UK and the\n" "China National Center for Bioinformation), " "and your sequence's placement in the phylogenetic tree generated by the\n" "sarscov2phylo\n" "pipeline.\n" "Placement is performed by\n" "" "Ultrafast Sample placement on Existing tRee (UShER) " - "(" + "(" "Turakhia et al.). UShER also generates local subtrees to show samples " "in the context of the most closely related sequences. The subtrees can be visualized " "as Genome Browser custom tracks and/or using " "Nextstrain's interactive display " "which supports " "drag-and-drop of local metadata that remains on your computer.

\n"); puts("
"); puts("
"); puts("
"); puts(""); puts("
"); puts("
"); -printf("

Select your FASTA or VCF file: "); -printf("", +printf("

Select your FASTA, VCF or list of sequence names/IDs: "); +printf("", seqFileVar, seqFileVar); struct treeChoices *treeChoices = loadTreeChoices(db); if (treeChoices) { puts("

"); printf("Phylogenetic tree version: "); char *phyloPlaceTree = cartOptionalString(cart, "phyloPlaceTree"); cgiMakeDropListWithVals("phyloPlaceTree", treeChoices->descriptions, treeChoices->protobufFiles, treeChoices->count, phyloPlaceTree); } puts("

"); printf("Number of samples per subtree showing sample placement: "); int subtreeSize = cartUsualInt(cart, "subtreeSize", 50); cgiMakeIntVarWithLimits("subtreeSize", subtreeSize, "Number of samples in subtree showing neighborhood of placement", - 5, 10, 2000); + 5, 10, 5000); puts("

"); -cgiMakeOnClickSubmitButton(CHECK_FILE_INPUT_JS, "submit", "upload"); +cgiMakeOnClickSubmitButton(CHECK_FILE_INPUT_JS(seqFileVar), "submit", "upload"); puts("

"); // Add a loading image to reassure people that we're working on it when they upload a big file printf("
\n"); printf("
\n"); jsInline("$(document).ready(function() {\n" " loadingImage.init($('#loadingImg'), $('#loadingMsg'), " "'

Uploading and processing your sequences " "may take some time. Please leave this window open while we work on your sequences.

');" "});\n"); puts("
"); puts("
"); } static void exampleForm() @@ -361,43 +360,45 @@ // Form submits subtree custom tracks to hgTracks printf("
\n\n", hgTracksName(), cartUsualString(cart, "formMethod", "POST")); cartSaveSession(cart); puts("
"); fflush(stdout); if (lf != NULL) { // Use trackLayout to get hgTracks parameters relevant to displaying trees: struct trackLayout tl; trackLayoutInit(&tl, cart); // Do our best to place the user's samples, make custom tracks if successful: char *phyloPlaceTree = cartOptionalString(cart, "phyloPlaceTree"); int subtreeSize = cartUsualInt(cart, "subtreeSize", 50); + boolean success = FALSE; char *ctFile = phyloPlaceSamples(lf, db, phyloPlaceTree, measureTiming, subtreeSize, - tl.fontHeight); + tl.fontHeight, &success); if (ctFile) { cgiMakeHiddenVar(CT_CUSTOM_TEXT_VAR, ctFile); if (tl.leftLabelWidthChars < 0 || tl.leftLabelWidthChars == leftLabelWidthDefaultChars) cgiMakeHiddenVar(leftLabelWidthVar, leftLabelWidthForLongNames); cgiMakeButton("submit", "view in Genome Browser"); puts("
"); puts("
"); } - else + else if (! success) { + puts("

"); puts(" "); puts(""); // Let the user upload something else and try again: inputForm(); } } else { warn("Unable to read your uploaded data - please choose a file and try again, or click the " ""try example" button."); // Let the user try again: puts(" "); puts(""); inputForm(); exampleForm();