diff --git a/components/OperonStructure.vue b/components/OperonStructure.vue index a1a31799f6c096773c8c57fe84dbbd4cc59db58f..8763100907133e644b7c9e4e88b203f3f07b773c 100644 --- a/components/OperonStructure.vue +++ b/components/OperonStructure.vue @@ -332,7 +332,7 @@ function drawStructure(operonGroup: d3.Selection<SVGGElement, any, SVGElement | .attr("width", d => d.width) .attr("height", d => d.height) .attr("preserveAspectRatio", "xMidYMid meet") - structureSelection.select("title").text(d => `${d.gene} | ${d.size} aa`) + structureSelection.select("title").text(d => operonTitle(d)) } @@ -392,7 +392,7 @@ function drawGenes(operonGroup: d3.Selection<SVGGElement, any, SVGElement | null genePathSelection .attr("d", d => drawGene(d).toString()) - genesSelection.select("title").text(d => `${d.gene} | ${d.size} aa${geneTitle(d)}`) + genesSelection.select("title").text(d => operonTitle(d)) function drawGene({ width, height }) { const context = d3.path() context.moveTo(0, 0) @@ -404,6 +404,11 @@ function drawGenes(operonGroup: d3.Selection<SVGGElement, any, SVGElement | null } } + +function operonTitle(d: StructureOperonGeneWithCoordinate) { + return `${d.gene} | ${d.size} aa${geneTitle(d)}` +} + function geneTitle(d: StructureOperonGeneWithCoordinate) { if (d?.exchangeables && d.exchangeables?.length > 0) { return `\nExchangeables: ${d.exchangeables.map(d => d.split("__")[1]).join(", ")}` @@ -447,7 +452,6 @@ function drawGenesLabel(operonGroup: d3.Selection<SVGGElement, any, SVGElement | ) updateSelection - .attr("cursor", d => d.highlight ? "pointer" : null) .select<SVGTextElement>("text") .attr("transform", function (d) { @@ -460,26 +464,13 @@ function drawGenesLabel(operonGroup: d3.Selection<SVGGElement, any, SVGElement | return `translate(${d.x + d.width / 2 - toValue(width) / 2},${d.y}) rotate(${toValue(rotate)}) ` } return null - }) .attr("style", d => d.highlight ? "font-weight: 700" : null) .text(d => d.gene) - updateSelection.select("title").text(d => d.gene) + updateSelection.select("title").text(d => operonTitle(d)) } - - - -function adjacentlinks(nodes: Record<string, any>) { - const links = [] - for (let i = 0; i < nodes.length; i++) { - if (i < nodes.length - 1) { - links.push({ index: i, source: nodes[i], target: nodes[+1] }) - } - } - return links -} </script> <template> <div ref="gbContainer">