Skip to content
Snippets Groups Projects
Commit e59a2a18 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

same title within operon

parent a34fe3de
Branches
No related tags found
No related merge requests found
Pipeline #129870 waiting for manual action
......@@ -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">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment