533112afe2a2005e80cdb1f82904ea65032d4302
braney
  Sat Oct 2 11:37:34 2021 -0700
split hg/lib into two separate libaries, one only used by the cgis

diff --git src/hg/cgilib/transMapStuff.c src/hg/cgilib/transMapStuff.c
new file mode 100644
index 0000000..4df43df
--- /dev/null
+++ src/hg/cgilib/transMapStuff.c
@@ -0,0 +1,42 @@
+/* transMapStuff - common definitions and functions for supporting transMap
+ * tracks in the browser CGIs */
+
+/* Copyright (C) 2014 The Regents of the University of California 
+ * See README in this or parent directory for licensing information. */
+#include "common.h"
+#include "transMapStuff.h"
+#include "trackDb.h"
+#include "hdb.h"
+
+char* transMapSkipGenomeDbPrefix(char *id)
+/* Skip the source genome db prefix (e.g. hg19:) in a TransMap identifier.
+ * Return the full id if no db prefix is found for compatibility with older
+ * version of transmap. */
+{
+char *simpleId = strchr(id, ':');
+if (simpleId == NULL)
+    return id;
+else
+    return simpleId+1;
+}
+
+char *transMapIdToSeqId(char *id)
+/* remove all unique suffixes (starting with last `-') from any TransMap 
+ * id, leaving the database prefix in place.  WARNING: static return */
+{
+static char acc[128];
+safecpy(acc, sizeof(acc), id);
+char *dash = strrchr(acc, '-');
+if (dash != NULL)
+    *dash = '\0';
+return acc;
+}
+
+char *transMapIdToAcc(char *id)
+/* remove database prefix and all unique suffixes (starting with last `-')
+ * from any TransMap id.  WARNING: static return */
+{
+static char acc[128];
+safecpy(acc, sizeof(acc), transMapSkipGenomeDbPrefix(transMapIdToSeqId(id)));
+return acc;
+}