b35e7a26a988bb2235b9719d5105a13888db9fe6
galt
  Fri Oct 18 00:02:49 2024 -0700
Originally only Blat's guess used filtering to remove unacceptahble characters, whereas the other types would just substitute X for amino or n for dna. Now we just filter like BLATs guess for all the input types, and they are consistent and correct and default behavior type will work as it always has. fixes #29760

diff --git src/hg/hgBlat/hgBlat.c src/hg/hgBlat/hgBlat.c
index 8c96e06..21511f1 100644
--- src/hg/hgBlat/hgBlat.c
+++ src/hg/hgBlat/hgBlat.c
@@ -1497,93 +1497,101 @@
 if (allGenomes)
     {
     db = database;
     genome = organism;
     }
 else
     getDbAndGenome(cart, &db, &genome, oldVars);
 
 char *output = cgiOptionalString("output");
 boolean isJson= sameWordOk(output, "json");
 boolean isPslRaw= sameWordOk(output, "pslRaw");
 
 if (!feelingLucky && !allGenomes && !isJson && !isPslRaw)
     cartWebStart(cart, db, "%s (%s) BLAT Results",  trackHubSkipHubName(organism), trackHubSkipHubName(db));
 
+seqList = faSeqListFromMemTextRaw(seqLetters);
+
 /* Load user sequence and figure out if it is DNA or protein. */
 if (sameWord(type, "DNA"))
     {
-    seqList = faSeqListFromMemText(seqLetters, TRUE);
-    uToT(seqList);
     isTx = FALSE;
     xType = "dna"; 
     }
-else if (sameWord(type, "translated RNA") || sameWord(type, "translated DNA"))
+else if (sameWord(type, "translated RNA"))
     {
-    seqList = faSeqListFromMemText(seqLetters, TRUE);
-    uToT(seqList);
     isTx = TRUE;
     isTxTx = TRUE;
     xType = "rnax"; 
-    txTxBoth = sameWord(type, "translated DNA");
-    if (txTxBoth)
+    }
+else if (sameWord(type, "translated DNA"))
+    {
+    isTx = TRUE;
+    isTxTx = TRUE;
+    txTxBoth = TRUE;
     xType = "dnax"; 
     }
 else if (sameWord(type, "protein"))
     {
-    seqList = faSeqListFromMemText(seqLetters, FALSE);
     isTx = TRUE;
     qIsProt = TRUE;
     xType = "prot"; 
     }
 else  // BLAT's Guess
     {
-    seqList = faSeqListFromMemTextRaw(seqLetters);
     if (seqList)
 	{
 	isTx = !seqIsDna(seqList); // only tests first element, assumes the rest are the same type.
-	if (!isTx)
+	if (isTx)
 	    {
-	    xType = "dna"; 
-	    for (seq = seqList; seq != NULL; seq = seq->next)
+	    qIsProt = TRUE;
+	    xType = "prot"; 
+	    }
+	else
 	    {
-		seq->size = dnaFilteredSize(seq->dna);
-		dnaFilter(seq->dna, seq->dna);
-		toLowerN(seq->dna, seq->size);
-		subChar(seq->dna, 'u', 't');
+	    xType = "dna"; 
 	    }
 	}
-	else
+    }
+if (isTx && !isTxTx)
     {
     for (seq = seqList; seq != NULL; seq = seq->next)
 	{
 	seq->size = aaFilteredSize(seq->dna);
 	aaFilter(seq->dna, seq->dna);
 	toUpperN(seq->dna, seq->size);
 	}
-	    qIsProt = TRUE;
-	    xType = "prot"; 
     }
+else
+    {
+    for (seq = seqList; seq != NULL; seq = seq->next)
+	{
+	seq->size = dnaFilteredSize(seq->dna);
+	dnaFilter(seq->dna, seq->dna);
+	toLowerN(seq->dna, seq->size);
+	subChar(seq->dna, 'u', 't');
 	}
     }
+
 if (seqList != NULL && seqList->name[0] == 0)
     {
     freeMem(seqList->name);
     seqList->name = cloneString("YourSeq");
     }
 trimUniq(seqList);
 
+
 /* If feeling lucky only do the first one. */
 if(feelingLucky && seqList != NULL)
     {
     seqList->next = NULL;
     }
 
 /* Figure out size allowed. */
 maxSingleSize = (isTx ? 10000 : 75000);
 maxTotalSize = maxSingleSize * 2.5;
 #ifdef LOWELAB
 maxSeqCount = 200;
 #else
 maxSeqCount = 25;
 #endif
 char *optionMaxSeqCount = cfgOptionDefault("hgBlat.maxSequenceCount", NULL);