586f7cc282b1e3a2992ee81c4060277613c636a3
braney
Thu Jul 17 11:30:34 2025 -0700
fix problem with hgLiftOver not setting default new assembly correctly
diff --git src/hg/hgLiftOver/hgLiftOver.c src/hg/hgLiftOver/hgLiftOver.c
index b9dba277453..419952d167d 100644
--- src/hg/hgLiftOver/hgLiftOver.c
+++ src/hg/hgLiftOver/hgLiftOver.c
@@ -59,30 +59,31 @@
"document.mainForm.submit();";
char *chainStringVal(struct liftOverChain *chain)
/* keep the last chain in memory in this format */
{
char chainS[64];
safef(chainS, sizeof(chainS), "%s.%s", chain->fromDb, chain->toDb);
return cloneString(chainS);
}
void webMain(struct liftOverChain *chain, boolean multiple, boolean keepSettings, int minSizeQ,
int minChainT, float minBlocks, float minMatch, boolean fudgeThick, boolean extraNameInfo)
/* set up page for entering data */
{
struct dbDb *dbList;
+printf("main %s\n", chain->toDb);
char *fromOrg = hOrganism(chain->fromDb), *toOrg = hOrganism(chain->toDb);
char *chainString = chainStringVal(chain);
cgiParagraph(
"This tool converts genome coordinates and annotation files "
"from the original to the new assembly using an alignment. "
"The input regions can be entered into the text box or uploaded as a file. "
"For files over 500Mb, use the command-line tool described in our "
"LiftOver documentation."
" If a pair of assemblies cannot be selected from the pull-down menus,"
" a sequential lift may still be possible (e.g., mm9 to mm10 to mm39). "
"If your desired conversion is still not available, please "
"contact us."
"");
/* create HMTL form */
@@ -112,30 +113,31 @@
/* from assembly */
cgiSimpleTableFieldStart();
printAllAssemblyListHtmlParm(chain->fromDb, dbList, HGLFT_FROMDB_VAR,
TRUE, "change", onChange);
cgiTableFieldEnd();
/* to assembly */
cgiSimpleTableFieldStart();
dbDbFreeList(&dbList);
dbList = hGetLiftOverToDatabases(chain->fromDb);
printLiftOverGenomeList(HGLFT_TOORG_VAR, chain->toDb, dbList, "change", onChange);
cgiTableFieldEnd();
cgiSimpleTableFieldStart();
+printf("new %s\n", chain->fromDb);
printAllAssemblyListHtmlParm(chain->toDb, dbList, HGLFT_TODB_VAR, TRUE, NULL, NULL);
cgiTableFieldEnd();
cgiTableRowEnd();
cgiTableEnd();
printf("
");
cgiSimpleTableStart();
cgiSimpleTableRowStart();
cgiTableField("Minimum ratio of bases that must remap:");
cgiSimpleTableFieldStart();
cgiMakeDoubleVar(HGLFT_MINMATCH, (keepSettings) ? minMatch : chain->minMatch,6);
puts(" ");
printInfoIcon("The minimum ratio of basepairs of the input region covered by an alignment. Regions scoring lower than this will not be lifted at all.");
@@ -399,64 +401,61 @@
if (sameOk(cartOrg,chainToOrg))
score += 1000;
score += 10*(maxRank-fromRank);
score += (maxRank - toRank);
return score;
}
struct liftOverChain *defaultChoices(struct liftOverChain *chainList,
char *cartDb)
/* Out of a list of liftOverChains and a cart, choose a
* list to display. */
{
-char *fromOrg, *fromDb, *toOrg, *toDb, *cartOrg;
+char *fromOrg, *fromDb, *toOrg, *toDb;
struct liftOverChain *choice = NULL;
-struct hash *dbRank = hGetDatabaseRank();
-struct hash *dbDbHash = hDbDbHash();
-double bestScore = -1;
struct liftOverChain *this = NULL;
/* Get the initial values. */
fromOrg = cartCgiUsualString(cart, HGLFT_FROMORG_VAR, "0");
fromDb = cartCgiUsualString(cart, HGLFT_FROMDB_VAR, "0");
toOrg = cartCgiUsualString(cart, HGLFT_TOORG_VAR, "0");
toDb = cartCgiUsualString(cart, HGLFT_TODB_VAR, "0");
-cartOrg = hOrganism(cartDb);
if (sameWord(fromOrg,"0"))
fromOrg = NULL;
if (sameWord(fromDb,"0"))
fromDb = NULL;
if (sameWord(toOrg,"0"))
toOrg = NULL;
if (sameWord(toDb,"0"))
toDb = NULL;
if (sameWord(cartDb,"0"))
cartDb = NULL;
for (this = chainList; this != NULL; this = this->next)
{
- double score = scoreLiftOverChain(this, fromOrg, fromDb, toOrg, toDb, cartOrg, cartDb, dbRank, dbDbHash);
- if (score > bestScore)
+ if (sameString(this->fromDb ,fromDb) && sameString(this->toDb, toDb))
{
choice = this;
- bestScore = score;
+ break;
}
}
+if (choice == NULL)
+ errAbort("liftOverChain not found\n");
return choice;
}
void doMiddle(struct cart *theCart)
/* Set up globals and make web page */
{
char *userData;
char *organism;
char *db;
float minBlocks, minMatch;
boolean multiple, fudgeThick;
int minSizeQ, minChainT;
boolean refreshOnly = FALSE;