2070aedea88da26aee0af3e2fd867b67140b09b5
lrnassar
  Wed Aug 5 16:59:19 2026 -0700
Move the maf sequence-name splitter into jkweb so both summary tools share one copy. refs #37928

mafSplitSrcGetChrom existed as two independent copies, in hgLoadMafSummary.c and
mafToBigMafSummary.c, and they had diverged: only the first had the GenArk accession
rule added by 2db6bab8db0. It now lives in src/lib/maf.c, with the rules documented
in maf.h.

mafToBigMafSummary therefore picks up the GenArk rule it was missing, so a dotted
GenArk name like GCA_009914755.4.CM034974.1 now keeps its accession version instead of
dropping it, which matches what hprc90waySummary already holds.

Also removes mafCompGetSrcDb and mafCompGetSrcName from maf.c and maf.h. Both were
first-dot splitters with no callers anywhere in the tree.

diff --git src/hg/utils/mafToBigMafSummary/mafToBigMafSummary.c src/hg/utils/mafToBigMafSummary/mafToBigMafSummary.c
index ddc22a86a69..4d6a82d8299 100644
--- src/hg/utils/mafToBigMafSummary/mafToBigMafSummary.c
+++ src/hg/utils/mafToBigMafSummary/mafToBigMafSummary.c
@@ -1,23 +1,25 @@
 /* mafToBigMafSummary - Convert a maf into bed3+4 input ready for bedToBigBed
  * to make a bigMaf summary (.bb) file.  Companion to mafToBigMaf. */
 
 /* The summary scoring/merging logic in this file is deliberately duplicated
  * from hgLoadMafSummary.c rather than refactored into a shared library.
  * That code is stable, hgLoadMafSummary is widely referenced from existing
  * makedocs, and a refactor would force retesting all of those pipelines for
- * minimal payoff.  If you change one, change the other. */
+ * minimal payoff.  If you change one, change the other.
+ * The sequence-name splitting that used to be duplicated here is the exception:
+ * it now lives in jkweb as mafSplitSrcGetChrom(), called by both tools. */
 
 #include "common.h"
 #include "linefile.h"
 #include "hash.h"
 #include "options.h"
 #include "maf.h"
 #include "mafSummary.h"
 
 static struct optionSpec optionSpecs[] = {
     {"mergeGap", OPTION_INT},
     {"minSize", OPTION_INT},
     {"maxSize", OPTION_INT},
     {"minSeqSize", OPTION_INT},
     {NULL, 0}
 };
@@ -89,60 +91,30 @@
 double total = ms1->score * (ms1->chromEnd - ms1->chromStart) +
                ms2->score * (ms2->chromEnd - ms2->chromStart);
 return total / (ms2->chromEnd - ms1->chromStart);
 }
 
 struct mafComp *mafMaster(struct mafAli *maf, struct mafFile *mf, char *fileName)
 /* Get master component from maf. errAbort if not found. */
 {
 struct mafComp *mcMaster = mafMayFindCompPrefix(maf, referenceDb, ".");
 if (mcMaster == NULL)
     errAbort("Couldn't find %s. sequence line %d of %s\n",
              referenceDb, mf->lf->lineIx, fileName);
 return mcMaster;
 }
 
-char *mafSplitSrcGetChrom(char *src, char *database)
-/* src can be in format chrom, db|chrom or db.chrom: split string on separator and return pointer to chrom.
- * If database is non-NULL and src starts with "database.", strip exactly that prefix
- * (so a database name like GCF_1234.3 with its own dot is handled correctly).
- * Side effect: src is truncated at the separator (so it becomes just the db). */
-{
-char *pipe = strchr(src, '|');
-if (pipe)
-    {
-    *pipe = '\0';
-    return pipe + 1;
-    }
-
-if (database != NULL)
-    {
-    int dbLen = strlen(database);
-    if (strncmp(src, database, dbLen) == 0 && src[dbLen] == '.')
-        {
-        src[dbLen] = '\0';
-        return src + dbLen + 1;
-        }
-    }
-
-char *dot = strchr(src, '.');
-if (!dot)
-    return src;
-*dot = '\0';
-return dot + 1;
-}
-
 long processMaf(struct mafAli *maf, struct hash *componentHash,
                 FILE *f, struct mafFile *mf, char *fileName)
 /* Compute scores for each pairwise component in the maf and emit summary blocks. */
 {
 struct mafComp *mc = NULL, *nextMc = NULL;
 struct mafSummary *ms, *msPending;
 struct mafAli pairMaf;
 long componentCount = 0;
 struct mafComp *mcMaster = mafMaster(maf, mf, fileName);
 struct mafComp *oldMasterNext = mcMaster->next;
 char *chrom;
 char src[256];
 
 strcpy(src, mcMaster->src);
 chrom = mafSplitSrcGetChrom(src, referenceDb);