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

same title within operon

parent a34fe3de
No related branches found
No related tags found
No related merge requests found
Pipeline #129870 waiting for manual action with stages
in 8 minutes and 8 seconds
...@@ -332,7 +332,7 @@ function drawStructure(operonGroup: d3.Selection<SVGGElement, any, SVGElement | ...@@ -332,7 +332,7 @@ function drawStructure(operonGroup: d3.Selection<SVGGElement, any, SVGElement |
.attr("width", d => d.width) .attr("width", d => d.width)
.attr("height", d => d.height) .attr("height", d => d.height)
.attr("preserveAspectRatio", "xMidYMid meet") .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 ...@@ -392,7 +392,7 @@ function drawGenes(operonGroup: d3.Selection<SVGGElement, any, SVGElement | null
genePathSelection genePathSelection
.attr("d", d => drawGene(d).toString()) .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 }) { function drawGene({ width, height }) {
const context = d3.path() const context = d3.path()
context.moveTo(0, 0) context.moveTo(0, 0)
...@@ -404,6 +404,11 @@ function drawGenes(operonGroup: d3.Selection<SVGGElement, any, SVGElement | null ...@@ -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) { function geneTitle(d: StructureOperonGeneWithCoordinate) {
if (d?.exchangeables && d.exchangeables?.length > 0) { if (d?.exchangeables && d.exchangeables?.length > 0) {
return `\nExchangeables: ${d.exchangeables.map(d => d.split("__")[1]).join(", ")}` return `\nExchangeables: ${d.exchangeables.map(d => d.split("__")[1]).join(", ")}`
...@@ -447,7 +452,6 @@ function drawGenesLabel(operonGroup: d3.Selection<SVGGElement, any, SVGElement | ...@@ -447,7 +452,6 @@ function drawGenesLabel(operonGroup: d3.Selection<SVGGElement, any, SVGElement |
) )
updateSelection updateSelection
.attr("cursor", d => d.highlight ? "pointer" : null) .attr("cursor", d => d.highlight ? "pointer" : null)
.select<SVGTextElement>("text") .select<SVGTextElement>("text")
.attr("transform", function (d) { .attr("transform", function (d) {
...@@ -460,26 +464,13 @@ function drawGenesLabel(operonGroup: d3.Selection<SVGGElement, any, SVGElement | ...@@ -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 `translate(${d.x + d.width / 2 - toValue(width) / 2},${d.y}) rotate(${toValue(rotate)}) `
} }
return null return null
}) })
.attr("style", d => d.highlight ? "font-weight: 700" : null) .attr("style", d => d.highlight ? "font-weight: 700" : null)
.text(d => d.gene) .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> </script>
<template> <template>
<div ref="gbContainer"> <div ref="gbContainer">
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment