589685da775f5a122bb23d2b8eca372f53e4b5bc
angie
  Wed Sep 10 16:34:34 2014 -0700
Changes to snpNcbiToUcsc to handle b141 on hg19 and hg38:- When checking range{I,D,S}* locTypes, use strlen(refNCBI) as length only if
refNCBI contains only nucleotides.
- Checking for overlapping variants at the same location (checkCluster ->
DuplicateObserved, MixedObserved) used to be limited to insertions because
those are easier to check.  Now we check all variants that have
all-nucleotide observed.  Libified some code from hgTracks that can
reverse-complement a slash-separated string of alleles, e.g. G/T -> A/C,
-/AG -> -/CT.
- SNP IDs are getting too huge (and sparse) to use as indexes into a
statically allocated array; use a hash.
- Erroneous NULL frequencies in dbSNP's SNPAlleleFreq need to be detected
and ignored.
refs #13309

diff --git src/hg/hgTracks/variation.c src/hg/hgTracks/variation.c
index bcfac14..bd0c496 100644
--- src/hg/hgTracks/variation.c
+++ src/hg/hgTracks/variation.c
@@ -466,51 +466,33 @@
 dyStringPrintf(dy, "%s ", rsId);
 if (isNotEmpty(chimpAllele))
     {
     int chimpLen = strlen(chimpAllele);
     if (doRc && isAllNt(chimpAllele, chimpLen))
 	{
 	char chimpCopy[chimpLen+1];
 	safecpy(chimpCopy, sizeof(chimpCopy), chimpAllele);
 	reverseComplement(chimpCopy, chimpLen);
 	dyStringPrintf(dy, "%s>", chimpCopy);
 	}
     else
 	dyStringPrintf(dy, "%s>", chimpAllele);
     }
 if (doRc)
-    {
-    int obsLen = strlen(observedAlleles);
-    char obsCopy[obsLen+1];
-    safecpy(obsCopy, sizeof(obsCopy), observedAlleles);
-    char *obsWords[obsLen];
-    int obsCount = chopByChar(obsCopy, '/', obsWords, obsLen);
-    int i;
-    // dbSNP orders alleles alphabetically so reverse the order too:
-    for (i = obsCount-1;  i >= 0;  i--)
-	{
-	char *al = obsWords[i];
-	int alLen = strlen(al);
-	if (isAllNt(al, alLen))
-	    reverseComplement(al, alLen);
-	if (i < obsCount-1)
-	    dyStringAppendC(dy, '/');
-	dyStringPrintf(dy, "%s", al);
-	}
-    }
+    dyStringAppend(dy, reverseComplementSlashSeparated(observedAlleles));
 else
-    dyStringPrintf(dy, "%s", observedAlleles);
+    dyStringAppend(dy, observedAlleles);
 return dyStringCannibalize(&dy);
 }
 
 static void setSnp125ExtendedNameObserved(struct snp125 *snpList, boolean useRefStrand)
 /* Append observed alleles to each snp's name, possibly reverse-complementing alleles
  * that were reported on the - strand. */
 {
 struct snp125 *snpItem = snpList;
 for (;  snpItem != NULL;  snpItem = snpItem->next)
     {
     boolean doRc = useRefStrand && ((snpItem->strand[0] == '-') ^ revCmplDisp);
     snpItem->name = snp125ExtendName(snpItem->name, NULL, snpItem->observed, doRc);
     }
 }