be4311c07e14feb728abc6425ee606ffaa611a58 markd Fri Jan 22 06:46:58 2021 -0800 merge with master diff --git src/hg/makeDb/hgLoadMaf/hgLoadMafSummary.c src/hg/makeDb/hgLoadMaf/hgLoadMafSummary.c index 3f743bf..15b444b 100644 --- src/hg/makeDb/hgLoadMaf/hgLoadMafSummary.c +++ src/hg/makeDb/hgLoadMaf/hgLoadMafSummary.c @@ -119,31 +119,59 @@ 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 output to .tab file */ { 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 *e, *chrom; char src[256]; strcpy(src, mcMaster->src); -chrom = chopPrefix(src); + +char *dot = strchr(src, '.'); + +if (dot == NULL) + // this should never happen since mafMaster above requires the assembly name be in the name + chrom = src; // if there are no dots, assume the name is the chrom and don't worry about matching the assembly name +else + { + // now we're thinking maybe there's an assembly name as a prefix to the chrom name + *dot = 0; + chrom = dot + 1; + + if (differentString(src, database)) + { + // the database name isn't matching the first part of the component source, + // look to see if maybe the database has a dot in it + *dot = '.'; // replace the dot + dot = strchr(dot + 1, '.'); // look for the next dot + if (dot != NULL) + { + *dot = 0; + chrom = dot + 1; + } + + if ((dot == NULL) || differentString(src, database)) + errAbort("expecting first component to have assembly name with no more than one dot"); + } + } + for (mc = maf->components; mc != NULL; mc = nextMc) { nextMc = mc->next; if (sameString(mcMaster->src, mc->src) || mc->size == 0) continue; /* create maf summary for this alignment component */ AllocVar(ms); ms->chrom = cloneString(chrom); /* both MAF and BED format define chromStart as 0-based */ ms->chromStart = mcMaster->start; /* BED chromEnd is start+size */ ms->chromEnd = mcMaster->start + mcMaster->size; ms->src = cloneString(mc->src); /* remove trailing components (following initial .) to src name */