/* hgSoftberryHom - Make table storing Softberry protein homology information. */ #include "common.h" #include "linefile.h" #include "hash.h" #include "dystring.h" #include "jksql.h" void usage() /* Explain usage and exit. */ { errAbort( "hgSoftberryHom - Make table storing Softberry protein homology information\n" "usage:\n" " hgSoftberryHom database file(s).pro\n"); } void makeTabLines(char *fileName, FILE *f) /* Loop through file and write out tab-separated records to f. */ { struct lineFile *lf = lineFileOpen(fileName, TRUE); char *line, *s, *e, *protParts[128]; int lineSize, protCount; int i; char *label, *gi; while (lineFileNext(lf, &line, &lineSize)) { if (line[0] != '>') continue; line += 1; label = nextWord(&line); if (label == NULL) errAbort("Bad format A line %d of %s\n", lf->lineIx, lf->fileName); if ((s = strstr(line, "##")) == NULL) continue; s += 2; if ((e = strstr(line, "##")) != NULL) *e = 0; s = trimSpaces(s); protCount = chopString(s, "\001", protParts, ArraySize(protParts)); if (protCount < 1) errAbort("Bad format C line %d of %s\n", lf->lineIx, lf->fileName); for (i=0; istring); dyStringClear(ds); dyStringPrintf(ds, "LOAD data local infile '%s' into table %s", tabFileName, table); sqlUpdate(conn, ds->string); sqlDisconnect(&conn); } int main(int argc, char *argv[]) /* Process command line. */ { if (argc < 3) usage(); hgSoftberryHom(argv[1], argc-2, argv+2); return 0; }