7c04d352647faab3ca7f194dc5f11f764d876ce3
hiram
  Tue Mar 21 13:44:35 2023 -0700
adding some chromAlias recognition for some getData functions refs #30544

diff --git src/hg/hubApi/apiUtils.c src/hg/hubApi/apiUtils.c
index 1f18ba2..e9cc0b4 100644
--- src/hg/hubApi/apiUtils.c
+++ src/hg/hubApi/apiUtils.c
@@ -628,15 +628,49 @@
 }
 
 boolean isWiggleDataTable(char *type)
 /* is this a wiggle data track table */
 {
 if (startsWith("wig", type))
     {
     if (startsWith("wigMaf", type))
 	return FALSE;
     else
 	return TRUE;
     }
 else
      return FALSE;
 }
+
+char *chrOrAlias(char *db, char *hubUrl)
+/* get incoming chr name, may be an alias, return the native chr name
+ * might be given a db, maybe not
+ * might be given a hubUrl, maybe not
+ */
+{
+char *cartChr = cgiOptionalString("chrom");
+if (isEmpty(cartChr))
+   return NULL;
+char *chrom = cartChr;
+if (isEmpty(hubUrl))
+    {
+    if (isEmpty(db))
+       return chrom;
+    chromAliasSetup(db);
+    chrom = hgOfficialChromName(db, chrom);
+    }
+else
+    {
+/*
+    not sure if the 'curated' hub situation has been solved yet
+    if (sameString("hs1", db)) {
+      chromAliasSetup("hub_25359_hs1");
+    } else {
+      chromAliasSetup(db);
+    }
+*/
+    chrom = chromAliasFindNative(chrom);
+    }
+if (isEmpty(chrom))	// can't find it here, return the name from the cart
+    chrom = cartChr;
+return chrom;
+}