09ba8a42df0be5b65518715f8f499e4ac965a4ef angie Tue Apr 30 11:10:37 2024 -0700 When multiple references are matched, make navigation links at the top of the results page. diff --git src/hg/hgPhyloPlace/phyloPlace.c src/hg/hgPhyloPlace/phyloPlace.c index 291012d..82fa6f1 100644 --- src/hg/hgPhyloPlace/phyloPlace.c +++ src/hg/hgPhyloPlace/phyloPlace.c @@ -3739,35 +3739,52 @@ name, description); } struct slName *noMatches = NULL; int startTime = clock1000(); struct refMatch *refFiles = matchSamplesWithReferences(org, nextcladeIndex, lf, &noMatches, &startTime); lineFileClose(&lf); if (noMatches != NULL) { printf("<br>No reference was found for the following sequences:\n<ul>\n"); struct slName *noMatch; for (noMatch = noMatches; noMatch != NULL; noMatch = noMatch->next) printf("<li>%s\n", noMatch->name); puts("</ul>"); } + int refCount = slCount(refFiles); + boolean doNav = (refCount > 1); struct refMatch *ref; + if (doNav) + { + // Make some navigation links at the top + puts("<a name='resultNavTop'></a>"); + printf("<p>Your uploaded sequences matched %d different reference sequences. " + "Click on these links to jump to the results for each reference.\n", + refCount); + puts("<ul>"); + for (ref = refFiles; ref != NULL; ref = ref->next) + printf("<li><a href='#results_%s'>%s</a>\n", ref->acc, ref->description); + puts("</ul></p><hr>"); + } for (ref = refFiles; ref != NULL; ref = ref->next) { + printf("<a name='results_%s'></a>\n", ref->acc); if (ref != refFiles) puts("<hr>"); - printf("<h2>Sequence(s) matched reference %s</h2>\n", ref->description); + printf("<h2>Sequence(s) matched to reference %s</h2>\n", ref->description); + if (doNav) + puts("<a href='#resultNavTop'>back to top</a>"); struct lineFile *rlf = lineFileOpen(ref->seqFile, TRUE); phyloPlaceSamplesOneRef(rlf, db, org, ref->acc, defaultProtobuf, doMeasureTiming, subtreeSize, tl, cart, &success); } puts("<br>"); } else { // No nextcladeIndex means this is the old-style single-reference setup (i.e. SARS-CoV-2). phyloPlaceSamplesOneRef(lf, db, org, org, defaultProtobuf, doMeasureTiming, subtreeSize, tl, cart, &success); } return success; }