42359030b483e8b6b4ec32c743b0fff0b52b3e17 max Wed Sep 6 08:20:00 2023 -0700 improving error message when no regions are output in tb, refs #32061 diff --git src/hg/hgTables/seqOut.c src/hg/hgTables/seqOut.c index 929bc47..4f97e90 100644 --- src/hg/hgTables/seqOut.c +++ src/hg/hgTables/seqOut.c @@ -119,55 +119,56 @@ boolean gotResults = FALSE; for (bed = bedList; bed != NULL; bed = bed->next) { char *protAcc = hashFindVal(protHash, bed->name); if (protAcc != NULL && !hashLookup(uniqHash, protAcc)) { char *fa = hGetSeqAndId(conn, protAcc, NULL); hashAdd(uniqHash, protAcc, NULL); if (fa != NULL) hPrintf("%s", fa); freez(&fa); gotResults = TRUE; } } if (!gotResults) - hPrintf(NO_RESULTS); + explainWhyNoResults(stdout); + hashFree(&protHash); hashFree(&uniqHash); } void doRefGeneMrnaSequence(struct sqlConnection *conn, struct bed *bedList) /* Fetch refGene mRNA sequence. */ { struct hash *uniqHash = newHash(18); struct bed *bed; boolean gotResults = FALSE; for (bed = bedList; bed != NULL; bed = bed->next) { if (!hashLookup(uniqHash, bed->name)) { char *fa = hGetSeqAndId(conn, bed->name, NULL); hashAdd(uniqHash, bed->name, NULL); if (fa != NULL) hPrintf("%s", fa); freez(&fa); gotResults = TRUE; } } if (!gotResults) - hPrintf(NO_RESULTS); + explainWhyNoResults(stdout); hashFree(&uniqHash); } void doGenePredNongenomic(struct sqlConnection *conn, int typeIx) /* Get mrna or protein associated with selected genes. */ { /* Note this does do the whole genome at once rather than one * chromosome at a time, but that's ok because the gene prediction * tracks this serves are on the small side. */ char *typeWords[3]; char *table; struct lm *lm = lmInit(64*1024); int fieldCount; struct bed *bed, *bedList = cookedBedsOnRegions(conn, curTable, getRegions(), lm, &fieldCount); @@ -205,31 +206,31 @@ /* Scan through table, outputting ones that match. */ sqlSafef(query, sizeof(query), "select name, seq from %s", table); sr = sqlGetResult(conn, query); while ((row = sqlNextRow(sr)) != NULL) { if (hashLookup(hash, row[0])) { hPrintf(">%s\n", row[0]); writeSeqWithBreaks(stdout, row[1], strlen(row[1]), 60); gotResults = TRUE; } } sqlFreeResult(&sr); hashFree(&hash); if (!gotResults) - hPrintf(NO_RESULTS); + explainWhyNoResults(stdout); } else { internalErr(); } freez(&dupType); } lmCleanup(&lm); } void genomicFormatPage(struct sqlConnection *conn) /* Put up page asking for what sort of genomic sequence. */ { struct hTableInfo *hti = getHti(database, curTable, conn); @@ -263,31 +264,31 @@ { struct region *region, *regionList = getRegions(); struct hTableInfo *hti = getHti(database, curTable, conn); int fieldCount; textOpen(); int resultCount = 0; for (region = regionList; region != NULL; region = region->next) { struct lm *lm = lmInit(64*1024); struct bed *bedList = cookedBedList(conn, curTable, region, lm, &fieldCount); if (bedList != NULL) resultCount += hgSeqBed(database, hti, bedList); lmCleanup(&lm); } if (!resultCount) - hPrintf(NO_RESULTS); + explainWhyNoResults(stdout); } void doGenePredSequence(struct sqlConnection *conn) /* Output genePred sequence. */ { char *type = cartString(cart, hgtaGeneSeqType); if (sameWord(type, "protein")) { if (doGalaxy() && !cgiOptionalString(hgtaDoGalaxyQuery)) sendParamsToGalaxy(hgtaDoGenePredSequence, "submit"); else doGenePredNongenomic(conn, 1); } else if (sameWord(type, "mRNA"))