45e79d76639fb235b57f43a27ba6ee257aac1fde kent Mon Feb 11 15:42:43 2019 -0800 Making the search for known genes prioritize results on the main chromosome over those on alt haplotypes. diff --git src/hg/lib/hgFind.c src/hg/lib/hgFind.c index 9559701..ac6219c 100644 --- src/hg/lib/hgFind.c +++ src/hg/lib/hgFind.c @@ -602,30 +602,35 @@ sqlFreeResult(&sr); } return foundIt; } static int hgPosCmpCanonical(const void *vhg1, const void *vhg2) // Compares two hgPos structs and returns an integer { const struct hgPos *hg1 = *((struct hgPos**)vhg1); const struct hgPos *hg2 = *((struct hgPos**)vhg2); int diff = trixSearchResultCmp(&hg1->tp->tsr, &hg2->tp->tsr); if (diff == 0) { diff = (hg2->canonical - hg1->canonical); + if (diff == 0) + { + // Prioritize things on main chromosomes + diff = chrNameCmpWithAltRandom(hg1->chrom, hg2->chrom); + } } return diff; } static void addKnownGeneItems(struct hgPosTable *table, struct trixSearchResult *tsrList, struct sqlConnection *conn, struct sqlConnection *conn2) /* Convert tsrList to posList, and hang posList off of table. */ { /* This code works with just two SQL queries no matter how * big the search result list is. For cases where the search * result list is big (say 100 or 1000 items) this is noticably * faster than the simpler-to-code approach that would do two * queries for each search result. We pay for this speed tweak * by having to construct a more elaborate query, and by having