9c92205b58d6b9319f67782c79df1afc154dacd0 galt Thu Mar 31 00:13:38 2011 -0700 fixing hgLiftOver: grouping and slightly re-ordering options; adding a new section to show what parameters were actually used to display the results, since code currently resets most options to the values in the chain liftOverChains record; also renamed minSizeT to minChainT since that is what it really is, everywhere except liftOverChain.as and the actual db tables and liftOverChain.sql diff --git src/hg/lib/liftOverChain.c src/hg/lib/liftOverChain.c index 66e5ae2..9fa33ad 100644 --- src/hg/lib/liftOverChain.c +++ src/hg/lib/liftOverChain.c @@ -7,49 +7,49 @@ #include "dystring.h" #include "jksql.h" #include "liftOverChain.h" static char const rcsid[] = "$Id: liftOverChain.c,v 1.5 2006/07/11 05:51:39 kate Exp $"; void liftOverChainStaticLoad(char **row, struct liftOverChain *ret) /* Load a row from liftOverChain table into ret. The contents of ret will * be replaced at the next call to this function. */ { ret->fromDb = row[0]; ret->toDb = row[1]; ret->path = row[2]; ret->minMatch = atof(row[3]); -ret->minSizeT = sqlUnsigned(row[4]); +ret->minChainT = sqlUnsigned(row[4]); ret->minSizeQ = sqlUnsigned(row[5]); strcpy(ret->multiple, row[6]); ret->minBlocks = atof(row[7]); strcpy(ret->fudgeThick, row[8]); } struct liftOverChain *liftOverChainLoad(char **row) /* Load a liftOverChain from row fetched with select * from liftOverChain * from database. Dispose of this with liftOverChainFree(). */ { struct liftOverChain *ret; AllocVar(ret); ret->fromDb = cloneString(row[0]); ret->toDb = cloneString(row[1]); ret->path = cloneString(row[2]); ret->minMatch = atof(row[3]); -ret->minSizeT = sqlUnsigned(row[4]); +ret->minChainT = sqlUnsigned(row[4]); ret->minSizeQ = sqlUnsigned(row[5]); strcpy(ret->multiple, row[6]); ret->minBlocks = atof(row[7]); strcpy(ret->fudgeThick, row[8]); return ret; } struct liftOverChain *liftOverChainLoadAll(char *fileName) /* Load all liftOverChain from a whitespace-separated file. * Dispose of this with liftOverChainFreeList(). */ { struct liftOverChain *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[9]; @@ -102,77 +102,77 @@ sqlFreeResult(&sr); return list; } void liftOverChainSaveToDb(struct sqlConnection *conn, struct liftOverChain *el, char *tableName, int updateSize) /* Save liftOverChain as a row to the table specified by tableName. * As blob fields may be arbitrary size updateSize specifies the approx size * of a string that would contain the entire query. Arrays of native types are * converted to comma separated strings and loaded as such, User defined types are * inserted as NULL. Note that strings must be escaped to allow insertion into the database. * For example "autosql's features include" --> "autosql\'s features include" * If worried about this use liftOverChainSaveToDbEscaped() */ { struct dyString *update = newDyString(updateSize); dyStringPrintf(update, "insert into %s values ( '%s','%s',%s,%g,%u,%u,'%s',%g,'%s')", - tableName, el->fromDb, el->toDb, el->path, el->minMatch, el->minSizeT, el->minSizeQ, el->multiple, el->minBlocks, el->fudgeThick); + tableName, el->fromDb, el->toDb, el->path, el->minMatch, el->minChainT, el->minSizeQ, el->multiple, el->minBlocks, el->fudgeThick); sqlUpdate(conn, update->string); freeDyString(&update); } void liftOverChainSaveToDbEscaped(struct sqlConnection *conn, struct liftOverChain *el, char *tableName, int updateSize) /* Save liftOverChain as a row to the table specified by tableName. * As blob fields may be arbitrary size updateSize specifies the approx size. * of a string that would contain the entire query. Automatically * escapes all simple strings (not arrays of string) but may be slower than liftOverChainSaveToDb(). * For example automatically copies and converts: * "autosql's features include" --> "autosql\'s features include" * before inserting into database. */ { struct dyString *update = newDyString(updateSize); char *fromDb, *toDb, *path, *multiple, *fudgeThick; fromDb = sqlEscapeString(el->fromDb); toDb = sqlEscapeString(el->toDb); path = sqlEscapeString(el->path); multiple = sqlEscapeString(el->multiple); fudgeThick = sqlEscapeString(el->fudgeThick); dyStringPrintf(update, "insert into %s values ( '%s','%s','%s',%g,%u,%u,'%s',%g,'%s')", - tableName, fromDb, toDb, path, el->minMatch , el->minSizeT , el->minSizeQ , multiple, el->minBlocks , fudgeThick); + tableName, fromDb, toDb, path, el->minMatch , el->minChainT , el->minSizeQ , multiple, el->minBlocks , fudgeThick); sqlUpdate(conn, update->string); freeDyString(&update); freez(&fromDb); freez(&toDb); freez(&path); freez(&multiple); freez(&fudgeThick); } struct liftOverChain *liftOverChainCommaIn(char **pS, struct liftOverChain *ret) /* Create a liftOverChain out of a comma separated string. * This will fill in ret if non-null, otherwise will * return a new liftOverChain */ { char *s = *pS; if (ret == NULL) AllocVar(ret); ret->fromDb = sqlStringComma(&s); ret->toDb = sqlStringComma(&s); ret->path = sqlStringComma(&s); ret->minMatch = sqlFloatComma(&s); -ret->minSizeT = sqlUnsignedComma(&s); +ret->minChainT = sqlUnsignedComma(&s); ret->minSizeQ = sqlUnsignedComma(&s); sqlFixedStringComma(&s, ret->multiple, sizeof(ret->multiple)); ret->minBlocks = sqlFloatComma(&s); sqlFixedStringComma(&s, ret->fudgeThick, sizeof(ret->fudgeThick)); *pS = s; return ret; } void liftOverChainFree(struct liftOverChain **pEl) /* Free a single dynamically allocated liftOverChain such as created * with liftOverChainLoad(). */ { struct liftOverChain *el; if ((el = *pEl) == NULL) return; @@ -200,31 +200,31 @@ { if (sep == ',') fputc('"',f); fprintf(f, "%s", el->fromDb); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->toDb); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->path); if (sep == ',') fputc('"',f); fputc(sep,f); fprintf(f, "%g", el->minMatch); fputc(sep,f); -fprintf(f, "%u", el->minSizeT); +fprintf(f, "%u", el->minChainT); fputc(sep,f); fprintf(f, "%u", el->minSizeQ); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->multiple); if (sep == ',') fputc('"',f); fputc(sep,f); fprintf(f, "%g", el->minBlocks); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->fudgeThick); if (sep == ',') fputc('"',f); fputc(lastSep,f); }