9ed6f979a8ec95ac934e5e8fef028d188b76a035
chmalee
  Mon Aug 6 14:38:57 2018 -0700
pslMismatchGapToBed now outputs a single bed9+ instead of 5 different bed files, refs #21079

diff --git src/hg/lib/txAliDiff.c src/hg/lib/txAliDiff.c
new file mode 100644
index 0000000..ab09668
--- /dev/null
+++ src/hg/lib/txAliDiff.c
@@ -0,0 +1,233 @@
+/* txAliDiff.c was originally generated by the autoSql program, which also 
+ * generated txAliDiff.h and txAliDiff.sql.  This module links the database and
+ * the RAM representation of objects. */
+
+#include "common.h"
+#include "linefile.h"
+#include "dystring.h"
+#include "jksql.h"
+#include "txAliDiff.h"
+
+
+
+char *txAliDiffCommaSepFieldNames = "chrom,chromStart,chromEnd,name,score,strand,thickStart,thickEnd,reserved,txName,txStart,txEnd,gSkipped,txSkipped,shiftL,shiftR,hgvsG,hgvsCN,hgvsN,hgvsPosCN";
+
+void txAliDiffStaticLoad(char **row, struct txAliDiff *ret)
+/* Load a row from txAliDiff table into ret.  The contents of ret will
+ * be replaced at the next call to this function. */
+{
+
+ret->chrom = row[0];
+ret->chromStart = sqlUnsigned(row[1]);
+ret->chromEnd = sqlUnsigned(row[2]);
+ret->name = row[3];
+ret->score = sqlUnsigned(row[4]);
+safecpy(ret->strand, sizeof(ret->strand), row[5]);
+ret->thickStart = sqlUnsigned(row[6]);
+ret->thickEnd = sqlUnsigned(row[7]);
+ret->reserved = sqlUnsigned(row[8]);
+ret->txName = row[9];
+ret->txStart = sqlUnsigned(row[10]);
+ret->txEnd = sqlUnsigned(row[11]);
+ret->gSkipped = sqlUnsigned(row[12]);
+ret->txSkipped = sqlUnsigned(row[13]);
+ret->shiftL = sqlUnsigned(row[14]);
+ret->shiftR = sqlUnsigned(row[15]);
+ret->hgvsG = row[16];
+ret->hgvsCN = row[17];
+ret->hgvsN = row[18];
+ret->hgvsPosCN = row[19];
+}
+
+struct txAliDiff *txAliDiffLoad(char **row)
+/* Load a txAliDiff from row fetched with select * from txAliDiff
+ * from database.  Dispose of this with txAliDiffFree(). */
+{
+struct txAliDiff *ret;
+
+AllocVar(ret);
+ret->chrom = cloneString(row[0]);
+ret->chromStart = sqlUnsigned(row[1]);
+ret->chromEnd = sqlUnsigned(row[2]);
+ret->name = cloneString(row[3]);
+ret->score = sqlUnsigned(row[4]);
+safecpy(ret->strand, sizeof(ret->strand), row[5]);
+ret->thickStart = sqlUnsigned(row[6]);
+ret->thickEnd = sqlUnsigned(row[7]);
+ret->reserved = sqlUnsigned(row[8]);
+ret->txName = cloneString(row[9]);
+ret->txStart = sqlUnsigned(row[10]);
+ret->txEnd = sqlUnsigned(row[11]);
+ret->gSkipped = sqlUnsigned(row[12]);
+ret->txSkipped = sqlUnsigned(row[13]);
+ret->shiftL = sqlUnsigned(row[14]);
+ret->shiftR = sqlUnsigned(row[15]);
+ret->hgvsG = cloneString(row[16]);
+ret->hgvsCN = cloneString(row[17]);
+ret->hgvsN = cloneString(row[18]);
+ret->hgvsPosCN = cloneString(row[19]);
+return ret;
+}
+
+struct txAliDiff *txAliDiffLoadAll(char *fileName) 
+/* Load all txAliDiff from a whitespace-separated file.
+ * Dispose of this with txAliDiffFreeList(). */
+{
+struct txAliDiff *list = NULL, *el;
+struct lineFile *lf = lineFileOpen(fileName, TRUE);
+char *row[20];
+
+while (lineFileRow(lf, row))
+    {
+    el = txAliDiffLoad(row);
+    slAddHead(&list, el);
+    }
+lineFileClose(&lf);
+slReverse(&list);
+return list;
+}
+
+struct txAliDiff *txAliDiffLoadAllByChar(char *fileName, char chopper) 
+/* Load all txAliDiff from a chopper separated file.
+ * Dispose of this with txAliDiffFreeList(). */
+{
+struct txAliDiff *list = NULL, *el;
+struct lineFile *lf = lineFileOpen(fileName, TRUE);
+char *row[20];
+
+while (lineFileNextCharRow(lf, chopper, row, ArraySize(row)))
+    {
+    el = txAliDiffLoad(row);
+    slAddHead(&list, el);
+    }
+lineFileClose(&lf);
+slReverse(&list);
+return list;
+}
+
+struct txAliDiff *txAliDiffCommaIn(char **pS, struct txAliDiff *ret)
+/* Create a txAliDiff out of a comma separated string. 
+ * This will fill in ret if non-null, otherwise will
+ * return a new txAliDiff */
+{
+char *s = *pS;
+
+if (ret == NULL)
+    AllocVar(ret);
+ret->chrom = sqlStringComma(&s);
+ret->chromStart = sqlUnsignedComma(&s);
+ret->chromEnd = sqlUnsignedComma(&s);
+ret->name = sqlStringComma(&s);
+ret->score = sqlUnsignedComma(&s);
+sqlFixedStringComma(&s, ret->strand, sizeof(ret->strand));
+ret->thickStart = sqlUnsignedComma(&s);
+ret->thickEnd = sqlUnsignedComma(&s);
+ret->reserved = sqlUnsignedComma(&s);
+ret->txName = sqlStringComma(&s);
+ret->txStart = sqlUnsignedComma(&s);
+ret->txEnd = sqlUnsignedComma(&s);
+ret->gSkipped = sqlUnsignedComma(&s);
+ret->txSkipped = sqlUnsignedComma(&s);
+ret->shiftL = sqlUnsignedComma(&s);
+ret->shiftR = sqlUnsignedComma(&s);
+ret->hgvsG = sqlStringComma(&s);
+ret->hgvsCN = sqlStringComma(&s);
+ret->hgvsN = sqlStringComma(&s);
+ret->hgvsPosCN = sqlStringComma(&s);
+*pS = s;
+return ret;
+}
+
+void txAliDiffFree(struct txAliDiff **pEl)
+/* Free a single dynamically allocated txAliDiff such as created
+ * with txAliDiffLoad(). */
+{
+struct txAliDiff *el;
+
+if ((el = *pEl) == NULL) return;
+freeMem(el->chrom);
+freeMem(el->name);
+freeMem(el->txName);
+freeMem(el->hgvsG);
+freeMem(el->hgvsCN);
+freeMem(el->hgvsN);
+freeMem(el->hgvsPosCN);
+freez(pEl);
+}
+
+void txAliDiffFreeList(struct txAliDiff **pList)
+/* Free a list of dynamically allocated txAliDiff's */
+{
+struct txAliDiff *el, *next;
+
+for (el = *pList; el != NULL; el = next)
+    {
+    next = el->next;
+    txAliDiffFree(&el);
+    }
+*pList = NULL;
+}
+
+void txAliDiffOutput(struct txAliDiff *el, FILE *f, char sep, char lastSep) 
+/* Print out txAliDiff.  Separate fields with sep. Follow last field with lastSep. */
+{
+if (sep == ',') fputc('"',f);
+fprintf(f, "%s", el->chrom);
+if (sep == ',') fputc('"',f);
+fputc(sep,f);
+fprintf(f, "%u", el->chromStart);
+fputc(sep,f);
+fprintf(f, "%u", el->chromEnd);
+fputc(sep,f);
+if (sep == ',') fputc('"',f);
+fprintf(f, "%s", el->name);
+if (sep == ',') fputc('"',f);
+fputc(sep,f);
+fprintf(f, "%u", el->score);
+fputc(sep,f);
+if (sep == ',') fputc('"',f);
+fprintf(f, "%s", el->strand);
+if (sep == ',') fputc('"',f);
+fputc(sep,f);
+fprintf(f, "%u", el->thickStart);
+fputc(sep,f);
+fprintf(f, "%u", el->thickEnd);
+fputc(sep,f);
+fprintf(f, "%u", el->reserved);
+fputc(sep,f);
+if (sep == ',') fputc('"',f);
+fprintf(f, "%s", el->txName);
+if (sep == ',') fputc('"',f);
+fputc(sep,f);
+fprintf(f, "%u", el->txStart);
+fputc(sep,f);
+fprintf(f, "%u", el->txEnd);
+fputc(sep,f);
+fprintf(f, "%u", el->gSkipped);
+fputc(sep,f);
+fprintf(f, "%u", el->txSkipped);
+fputc(sep,f);
+fprintf(f, "%u", el->shiftL);
+fputc(sep,f);
+fprintf(f, "%u", el->shiftR);
+fputc(sep,f);
+if (sep == ',') fputc('"',f);
+fprintf(f, "%s", el->hgvsG);
+if (sep == ',') fputc('"',f);
+fputc(sep,f);
+if (sep == ',') fputc('"',f);
+fprintf(f, "%s", el->hgvsCN);
+if (sep == ',') fputc('"',f);
+fputc(sep,f);
+if (sep == ',') fputc('"',f);
+fprintf(f, "%s", el->hgvsN);
+if (sep == ',') fputc('"',f);
+fputc(sep,f);
+if (sep == ',') fputc('"',f);
+fprintf(f, "%s", el->hgvsPosCN);
+if (sep == ',') fputc('"',f);
+fputc(lastSep,f);
+}
+
+/* -------------------------------- End autoSql Generated Code -------------------------------- */
+