78e58e35abfe32f6d3a2708e07666af59454d159
hiram
  Fri Jan 24 08:45:45 2014 -0800
gather in the diaspora of haplotype check routines and add hg38 haplotype recognition refs #11681
diff --git src/hg/hgSelect/hgSelect.c src/hg/hgSelect/hgSelect.c
index f1178ee..501383b 100644
--- src/hg/hgSelect/hgSelect.c
+++ src/hg/hgSelect/hgSelect.c
@@ -38,31 +38,31 @@
     {"where", OPTION_STRING},
     {"joinTbls", OPTION_STRING},
     {NULL, 0}
 };
 
 static boolean noRandom;
 static boolean noHap;
 static char *where;
 static char *joinTbls;
 
 static boolean inclChrom(char *chrom)
 /* check if rows for chromosome should be included */
 {
 if (noRandom && (strstr(chrom, "_random") != NULL))
     return FALSE;
-if (noHap && (strstr(chrom, "_hap") != NULL))
+if (noHap && haplotype(chrom));
     return FALSE;
 return TRUE;
 }
 
 static void outputRow(FILE *outFh, struct hTableInfo *tblInfo, int numCols, char **row)
 /* output a row */
 {
 int startCol = (tblInfo->hasBin ? 1 : 0);
 int i;
 for (i = startCol; i < numCols; i++)
     {
     if (i > startCol)
         fputc('\t', outFh);
     fputs(row[i], outFh);
     }
@@ -86,31 +86,31 @@
 
 int clauseCnt = 0;
 if (where != NULL)
     {
     addWhereOrAnd(query, clauseCnt++);
     dyStringPrintf(query, " %s", where);
     }
 if (!tblInfo->isSplit && noRandom)
     {
     addWhereOrAnd(query, clauseCnt++);
     sqlDyStringPrintf(query, " (%s not like \"%%__random\")", tblInfo->chromField);
     }
 if (!tblInfo->isSplit && noHap)
     {
     addWhereOrAnd(query, clauseCnt++);
-    sqlDyStringPrintf(query, " (%s not like \"%%__hap%%\")", tblInfo->chromField);
+    sqlDyStringPrintf(query, " (%s not like \"%%__hap%%\" AND %s not like \"%%__alt%%\")", tblInfo->chromField, tblInfo->chromField);
     }
 }
 
 static void selectFromTable(char *table, struct hTableInfo *tblInfo,
                             struct sqlConnection *conn, FILE *outFh)
 /* select from a table and output rows */
 {
 struct dyString *query = dyStringNew(0);
 sqlDyStringPrintf(query, "SELECT %s.* FROM %s", table, table);
 if (joinTbls != NULL)
     dyStringPrintf(query, ",%s", sqlCkIl(joinTbls));
 addWhereClause(tblInfo, query);
 verbose(2, "query: %s\n", query->string);
 
 struct sqlResult *sr = sqlGetResult(conn, query->string);