dc4322ce21733176ef6b04f060f15c6a3c7c773a
hiram
  Thu Sep 29 12:09:25 2022 -0700
moving the reading of rmsk .out files into library function refs #29819

diff --git src/hg/makeDb/hgLoadOut/hgLoadOut.c src/hg/makeDb/hgLoadOut/hgLoadOut.c
index fabd504..f84c250 100644
--- src/hg/makeDb/hgLoadOut/hgLoadOut.c
+++ src/hg/makeDb/hgLoadOut/hgLoadOut.c
@@ -1,30 +1,29 @@
 /* hgLoadOut - load RepeatMasker .out files into database. */
 
 /* Copyright (C) 2014 The Regents of the University of California 
  * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
 #include "common.h"
 #include "linefile.h"
 #include "dystring.h"
 #include "options.h"
 #include "cheapcgi.h"
 #include "hCommon.h"
 #include "hdb.h"
 #include "jksql.h"
 #include "rmskOut.h"
-
-
+#include "repMask.h"
 
 boolean noBin = FALSE;
 boolean split = FALSE;
 boolean noSplit = FALSE;
 char *tabFileName = NULL;
 char *suffix = NULL;
 int badRepCnt = 0;
 
 /* command line option specifications */
 static struct optionSpec optionSpecs[] = {
     {"tabFile", OPTION_STRING},
     {"tabfile", OPTION_STRING},
     {"nosplit", OPTION_BOOLEAN},
     {"noSplit", OPTION_BOOLEAN},
     {"split",   OPTION_BOOLEAN},
@@ -150,43 +149,31 @@
     {
     hashTraverseEls(chromFpHash, helCarefulClose);
     }
 else
     carefulClose(&theFile);
 }
 
 void readOneOut(char *rmskFile)
 /* Read .out file rmskFile, check each line, and print OK lines to .tab. */
 {
 struct lineFile *lf;
 char *line, *words[24];
 int lineSize, wordCount;
 
 /* Open .out file and process header. */
-lf = lineFileOpen(rmskFile, TRUE);
-if (!lineFileNext(lf, &line, &lineSize))
-    errAbort("Empty %s", lf->fileName);
-if (!(startsWith("   SW  perc perc", line) ||
-      startsWith("   SW   perc perc", line) ||
-      startsWith("    SW   perc perc", line) ||
-      startsWith("  bit   perc perc", line)))
-    {
-    errAbort("%s doesn't seem to be a RepeatMasker .out file, first "
-             "line seen:\n%s", lf->fileName, line);
-    }
-lineFileNext(lf, &line, &lineSize);
-lineFileNext(lf, &line, &lineSize);
+lf = rmskLineFileOpen(rmskFile);
 
 /* Process line oriented records of .out file. */
 while (lineFileNext(lf, &line, &lineSize))
     {
     static struct rmskOut r;
     char *s;
 
     wordCount = chopLine(line, words);
     if (wordCount < 14)
         errAbort("Expecting 14 or 15 words line %d of %s", 
 	    lf->lineIx, lf->fileName);
     r.swScore = atoi(words[0]);
     r.milliDiv = makeMilli(words[1], lf);
     r.milliDel = makeMilli(words[2], lf);
     r.milliIns = makeMilli(words[3], lf);