9a71e97d8a11e25bc6e48e8e95fa0c9cc7da4801 chmalee Tue Apr 4 11:59:28 2023 -0700 hgPcr saves hits instead of overwriting the trash file with each new pcr search, refs #30925 diff --git src/hg/hgPcr/hgPcr.c src/hg/hgPcr/hgPcr.c index c91e5b2..b19e076 100644 --- src/hg/hgPcr/hgPcr.c +++ src/hg/hgPcr/hgPcr.c @@ -493,51 +493,64 @@ printf("%s", "<P><H3>Author</H3>\n"); printf("%s", "<P>In-Silico PCR was written by " "<A HREF=\"mailto:kent@soe.ucsc.edu\">Jim Kent</A>.\n" "Interactive use on this web server is free to all.\n" "Sources and executables to run batch jobs on your own server are available free\n" "for academic, personal, and non-profit purposes. Non-exclusive commercial\n" "licenses are also available. Contact Jim for details.</P>\n"); } void writePrimers(struct gfPcrOutput *gpo, char *fileName) /* Write primer sequences to file. Look at only the first gpo because there * is only one set of primers in the input form. */ { if (gpo == NULL) return; -FILE *f = mustOpen(fileName, "w"); +FILE *f = mustOpen(fileName, "a"); fprintf(f, "%s\t%s\n", gpo->fPrimer, gpo->rPrimer); carefulClose(&f); } void writePcrResultTrack(struct gfPcrOutput *gpoList, char *db, char *target) /* Write trash files and store their name in a cart variable. */ { char *cartVar = pcrResultCartVar(db); struct tempName bedTn, primerTn; char buf[2048]; +char *pslFile, *txtFile, *cartResult; +if ( (cartResult = cartOptionalString(cart, cartVar)) != NULL) + { + char *pcrFiles[3]; + chopByWhite(cloneString(cartResult), pcrFiles, 3); + pslFile = pcrFiles[0]; + txtFile = pcrFiles[1]; + gfPcrOutputWriteAll(gpoList, "psl", NULL, pslFile); + writePrimers(gpoList, txtFile); + } +else + { trashDirFile(&bedTn, "hgPcr", "hgPcr", ".psl"); trashDirFile(&primerTn, "hgPcr", "hgPcr", ".txt"); gfPcrOutputWriteAll(gpoList, "psl", NULL, bedTn.forCgi); writePrimers(gpoList, primerTn.forCgi); if (isNotEmpty(target)) safef(buf, sizeof(buf), "%s %s %s", bedTn.forCgi, primerTn.forCgi, target); else safef(buf, sizeof(buf), "%s %s", bedTn.forCgi, primerTn.forCgi); cartSetString(cart, cartVar, buf); } +} static void printHelpLinks(struct gfPcrOutput *gpoList) { /* print links to our docs for special chromosome names */ // if you modify this, also modify hgBlat.c:showAliPlaces, which implements a similar feature, for hgBlat boolean isAlt = FALSE; boolean isFix = FALSE; boolean isRandom = FALSE; boolean isChrUn = FALSE; if (gpoList != NULL) { struct gfPcrOutput *gpo; for (gpo = gpoList; gpo != NULL; gpo = gpo->next) { char *seq = gpo->seqName;