ce891d7726cb07920b5072bb5b4ca9faf44c6e61 angie Fri Sep 3 16:39:47 2021 -0700 Translating protein coords to CDS might result in coords that fall off the end of CDS but not off the end of the transcript. Avoid showing 3'UTR results for a protein search by requiring results in the coding region for protein searches. refs #28107 diff --git src/hg/lib/tests/hgvsTester.c src/hg/lib/tests/hgvsTester.c index 2051ad7..2c292ad 100644 --- src/hg/lib/tests/hgvsTester.c +++ src/hg/lib/tests/hgvsTester.c @@ -40,46 +40,49 @@ char *term = trimSpaces(line); if (term[0] == '\0' || term[0] == '#') { puts(line); continue; } struct hgvsVariant *hgvsList = hgvsParseTerm(term); if (hgvsList == NULL) hgvsList = hgvsParsePseudoHgvs(db, term); if (hgvsList == NULL) printf("# Failed to parse '%s' as HGVS\n", term); else { struct hgvsVariant *hgvs = NULL; struct hash *bedHash = hashNew(0); + int okCount = 0; for (hgvs = hgvsList; hgvs != NULL; hgvs = hgvs->next) { struct bed *region = hgvsMapToGenome(db, hgvs, NULL); - if (region == NULL) - printf("# Failed to map '%s' to %s assembly\n", term, db); - else + if (region != NULL) { + okCount++; // Now that hgvsParsePsuedoHgvs returns a list of valid positions // we only want to print the unique ones in the list dyStringClear(dy);; dyStringPrintf(dy, "%s\t%d\t%d\t%s\t0\t%c\n", region->chrom, region->chromStart, region->chromEnd, term, region->strand[0]); if (hashFindVal(bedHash, dy->string) == NULL) hashAdd(bedHash, cloneString(dy->string), region); } } + // Complain only if none of the HGVS terms in the list could be mapped + if (okCount == 0) + printf("# Failed to map '%s' to %s assembly\n", term, db); struct hashEl *hel, *helList = hashElListHash(bedHash); for (hel = helList; hel != NULL; hel = hel->next) { struct bed *region = (struct bed *)hel->val; printf("%s\t%d\t%d\t%s\t0\t%c\n", region->chrom, region->chromStart, region->chromEnd, term, region->strand[0]); } } } lineFileClose(&lf); carefulCheckHeap(); return 0; } int main(int argc, char *argv[])