11f81d207f0d0c4e66697e4df53f7cf2ed1f9a4d angie Tue Nov 8 13:08:17 2022 -0800 Add node[branch_attrs][label][id] to JSON so links can be formed by node ID, HT @corneliusroemer in #yatisht/usher/#284. diff --git src/hg/hgPhyloPlace/treeToAuspiceJson.c src/hg/hgPhyloPlace/treeToAuspiceJson.c index 5665c58..2902bfe 100644 --- src/hg/hgPhyloPlace/treeToAuspiceJson.c +++ src/hg/hgPhyloPlace/treeToAuspiceJson.c @@ -445,30 +445,32 @@ return geneChangeList; } static void jsonWriteBranchAttrs(struct jsonWrite *jw, struct phyloTree *node, struct geneInfo *geneInfoList, struct seqWindow *gSeqWin) /* Write mutations (if any). If node is not a leaf, write label for mutations at this node. */ { if (node->priv != NULL) { struct singleNucChange *sncList = node->priv; struct slPair *geneAaMutations = getAaMutations(sncList, geneInfoList, gSeqWin); jsonWriteObjectStart(jw, "branch_attrs"); if (node->numEdges > 0) { jsonWriteObjectStart(jw, "labels"); + if (node->ident->name) + jsonWriteString(jw, "id", node->ident->name); struct singleNucChange *snc = sncList; struct dyString *dy = dyStringCreate("%c%d%c", snc->parBase, snc->chromStart+1, snc->newBase); for (snc = sncList->next; snc != NULL; snc = snc->next) dyStringPrintf(dy, ",%c%d%c", snc->parBase, snc->chromStart+1, snc->newBase); jsonWriteString(jw, "nuc mutations", dy->string); dyStringClear(dy); for (snc = sncList; snc != NULL; snc = snc->next) { char ref[2]; seqWindowCopy(gSeqWin, snc->chromStart, 1, ref, sizeof(ref)); if (snc->newBase == ref[0]) { dyStringAppendSep(dy, ","); dyStringPrintf(dy, "%c%d%c", snc->parBase, snc->chromStart+1, snc->newBase);