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

hide links and highlight when no structure

parent e7568b36
No related branches found
No related tags found
No related merge requests found
Pipeline #130577 waiting for manual action
...@@ -242,8 +242,12 @@ const plotHeight = computed(() => { ...@@ -242,8 +242,12 @@ const plotHeight = computed(() => {
return marginTop + marginBottom + toValue(geneLabelHeight) + toValue(structureHeight) + toValue(geneHeight) + toValue(linkHeight) + 10 return marginTop + marginBottom + toValue(geneLabelHeight) + toValue(structureHeight) + toValue(geneHeight) + toValue(linkHeight) + 10
}) })
const linksGenesStruct = computed<StructureGeneLinks[]>(() => { const linksGenesStruct = computed<StructureGeneLinks[]>(() => {
const geneNodesVal = toValue(geneNodesWithY) const geneNodesVal = toValue(geneNodesWithY).filter(d => {
const structureNodesVal = toValue(structureNodes) return d.structPath !== undefined
})
const structureNodesVal = toValue(structureNodes).filter(d => {
return d.structPath !== undefined
})
return d3.zip(geneNodesVal, structureNodesVal).map(([source, target]) => { return d3.zip(geneNodesVal, structureNodesVal).map(([source, target]) => {
return { return {
...@@ -362,11 +366,13 @@ function drawStructure(operonGroup: d3.Selection<SVGGElement, any, SVGElement | ...@@ -362,11 +366,13 @@ function drawStructure(operonGroup: d3.Selection<SVGGElement, any, SVGElement |
.classed("structure", true) .classed("structure", true)
.on("click", function (event) { .on("click", function (event) {
const data = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(this).data() const data = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(this).data()
structureBasket.set(data.map(s => s?.structPath ?? '')) const structPaths = data.filter(s => s?.structPath !== undefined).map<string>(s => s?.structPath ?? "")
if (structPaths.length > 0) structureBasket.set(structPaths)
}).on("mouseover", function (event) { }).on("mouseover", function (event) {
const srcSelection = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(event.srcElement) const srcSelection = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(event.srcElement)
const node = srcSelection.data() const node = srcSelection.data()
geneToHighlight.value = node[0].gene const structPaths = node.filter(s => s?.structPath !== undefined).map<string>(s => s?.structPath ?? "")
if (structPaths.length > 0) geneToHighlight.value = node[0].gene
}) })
.on("mouseout", function (event) { .on("mouseout", function (event) {
geneToHighlight.value = null geneToHighlight.value = null
...@@ -402,11 +408,6 @@ function drawStructure(operonGroup: d3.Selection<SVGGElement, any, SVGElement | ...@@ -402,11 +408,6 @@ function drawStructure(operonGroup: d3.Selection<SVGGElement, any, SVGElement |
function drawGenes(operonGroup: d3.Selection<SVGGElement, any, SVGElement | null, any>) { function drawGenes(operonGroup: d3.Selection<SVGGElement, any, SVGElement | null, any>) {
const genesWithCoordVal = toValue(geneNodesWithY) const genesWithCoordVal = toValue(geneNodesWithY)
const genes = genesWithCoordVal const genes = genesWithCoordVal
const genesSelection = operonGroup const genesSelection = operonGroup
.selectAll("g.gene-grp") // get all "existing" lines in svg .selectAll("g.gene-grp") // get all "existing" lines in svg
.data<StructureOperonGeneWithCoordinate>(genes) // sync them with our data .data<StructureOperonGeneWithCoordinate>(genes) // sync them with our data
...@@ -416,12 +417,14 @@ function drawGenes(operonGroup: d3.Selection<SVGGElement, any, SVGElement | null ...@@ -416,12 +417,14 @@ function drawGenes(operonGroup: d3.Selection<SVGGElement, any, SVGElement | null
.classed("gene-grp", true) .classed("gene-grp", true)
.on("click", function (event) { .on("click", function (event) {
const data = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(this).data() const data = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(this).data()
structureBasket.set(data.map(s => s?.structPath ?? '')) const structPaths = data.filter(s => s?.structPath !== undefined).map<string>(s => s?.structPath ?? "")
if (structPaths.length > 0) structureBasket.set(structPaths)
}) })
.on("mouseover", function (event) { .on("mouseover", function (event) {
const srcSelection = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(event.srcElement) const srcSelection = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(event.srcElement)
const node = srcSelection.data() const node = srcSelection.data()
geneToHighlight.value = node[0].gene const structPaths = node.filter(s => s?.structPath !== undefined).map<string>(s => s?.structPath ?? "")
if (structPaths.length > 0) geneToHighlight.value = node[0].gene
}) })
.on("mouseout", function (event) { .on("mouseout", function (event) {
geneToHighlight.value = null geneToHighlight.value = null
...@@ -496,12 +499,14 @@ function drawGenesLabel(operonGroup: d3.Selection<SVGGElement, any, SVGElement | ...@@ -496,12 +499,14 @@ function drawGenesLabel(operonGroup: d3.Selection<SVGGElement, any, SVGElement |
.classed("gene-label", true) .classed("gene-label", true)
.on("click", function (event) { .on("click", function (event) {
const data = d3.select<SVGElement, StructureOperonGeneLabels>(this).data() const data = d3.select<SVGElement, StructureOperonGeneLabels>(this).data()
structureBasket.set(data.map(s => s?.structPath ?? '')) const structPaths = data.filter(s => s?.structPath !== undefined).map<string>(s => s?.structPath ?? "")
if (structPaths.length > 0) structureBasket.set(structPaths)
}) })
.on("mouseover", function (event) { .on("mouseover", function (event) {
const srcSelection = d3.select<SVGElement, StructureOperonGeneLabels>(event.srcElement) const srcSelection = d3.select<SVGElement, StructureOperonGeneLabels>(event.srcElement)
const node = srcSelection.data() const node = srcSelection.data()
geneToHighlight.value = node[0].gene const structPaths = node.filter(s => s?.structPath !== undefined).map<string>(s => s?.structPath ?? "")
if (structPaths.length > 0) geneToHighlight.value = node[0].gene
}) })
.on("mouseout", function (event) { .on("mouseout", function (event) {
......
...@@ -184,10 +184,15 @@ const operonStructurePerMatrix = computed<[string, StructureOperonGeneWithImg[]] ...@@ -184,10 +184,15 @@ const operonStructurePerMatrix = computed<[string, StructureOperonGeneWithImg[]]
} }
}) })
const rawImgUrl = joinURL(`/${toValue(system).toLowerCase()}`, matchingMonomer?.structImg ?? '') if (matchingMonomer === undefined) {
const rawStructUrl = joinURL(`/${toValue(system).toLowerCase()}`, matchingMonomer?.structPath ?? '') return { ...gene, structImg: undefined, structPath: undefined }
const { refinedUrl: structImgHref } = useRefinedUrl(rawImgUrl)
return { ...gene, gene: matchingMonomer ? matchingMonomer.proteins_in_the_prediction[0] : sanitizedGene, structImg: toValue(structImgHref), structPath: rawStructUrl } } else {
const rawImgUrl = joinURL(`/${toValue(system).toLowerCase()}`, matchingMonomer?.structImg ?? '')
const rawStructUrl = joinURL(`/${toValue(system).toLowerCase()}`, matchingMonomer?.structPath ?? '')
const { refinedUrl: structImgHref } = useRefinedUrl(rawImgUrl)
return { ...gene, gene: matchingMonomer ? matchingMonomer.proteins_in_the_prediction[0] : sanitizedGene, structImg: toValue(structImgHref), structPath: rawStructUrl }
}
})] })]
} }
else { return [] } else { return [] }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment