0564395ec363631f2ff8d295da6f6b50f873fda4
braney
  Mon Jan 24 17:01:53 2022 -0800
more chromAlias work:  some name changes and support for the new genark
chromAlias format

diff --git src/lib/fieldedTable.c src/lib/fieldedTable.c
index e849d80..9875d08 100644
--- src/lib/fieldedTable.c
+++ src/lib/fieldedTable.c
@@ -236,65 +236,73 @@
 int i;
 for (i = 0; i < requiredCount; ++i)
     {
     char *required = requiredFields[i];
     int ix = stringArrayIx(required, fields, fieldCount);
     if (ix < 0)
         errAbort("%s is missing required field '%s'", lf->fileName, required);
     }
 
 /* Create fieldedTable . */
 struct fieldedTable *table = fieldedTableNew(lf->fileName, fields, fieldCount);
 table->startsSharp = startsSharp;
 return table;
 }
 
+struct fieldedTable *fieldedTableAttach(struct lineFile  *lf,  char *requiredFields[], int requiredCount)
+/* Read table from tab-separated file with a #header line that defines the fields
+ * from already open lineFile..  Ensures all requiredFields (if any) are present.  
+ * should be NULL for most purposes.  */
+{
+struct fieldedTable *table = fieldedTableReadTabHeader(lf, requiredFields, requiredCount);
+char *row[table->fieldCount];
+while (lineFileNextRowTab(lf, row, table->fieldCount))
+    {
+    fieldedTableAdd(table, row, table->fieldCount, lf->lineIx);
+    }
+
+/* Clean up and go home. */
+lineFileClose(&lf);
+return table;
+}
+
 struct fieldedTable *fieldedTableFromTabFile(char *fileName, char *reportFileName, 
     char *requiredFields[], int requiredCount)
 /* Read table from tab-separated file with a #header line that defines the fields.  Ensures
  * all requiredFields (if any) are present.  The reportFileName is just used for error reporting and 
  * should be NULL for most purposes.  This is used by edwSubmit though which
  * first copies to a local file, and we want to report errors from the remote file. 
  * We do know the remote file exists at least, because we just copied it. */
 {
 /* Open file with fileName */
 struct lineFile *lf = netLineFileOpen(fileName);
 
 /* Substitute in reportFileName for error reporting */
 if (reportFileName != NULL)
     {
     if (differentString(reportFileName, fileName))
         {
 	freeMem(lf->fileName);
 	lf->fileName = cloneString(reportFileName);
 	}
     }
 else
     {
     reportFileName = fileName;
     }
 
-struct fieldedTable *table = fieldedTableReadTabHeader(lf, requiredFields, requiredCount);
-char *row[table->fieldCount];
-while (lineFileNextRowTab(lf, row, table->fieldCount))
-    {
-    fieldedTableAdd(table, row, table->fieldCount, lf->lineIx);
-    }
-
-/* Clean up and go home. */
-lineFileClose(&lf);
-return table;
+return fieldedTableAttach(lf, requiredFields, requiredCount);
 }
 
 void fieldedTableToTabFileWithId(struct fieldedTable *table, char *fileName, 
     char *idField, int startId)
 /* Write out a fielded table back to file.  If idField is non-NULL it will be added
  * to the start of each output line as a steadily incrementing integer starting with startId. */
 {
 FILE *f = mustOpen(fileName, "w");
 
 /* Write out header row with optional leading # */
 if (table->startsSharp)
     fputc('#', f);
 int curId = startId;
 int i;
 if (idField)