From 758cb1b0f532377682164cf47e2e8071a04d8f92 Mon Sep 17 00:00:00 2001
From: Remi  PLANEL <rplanel@pasteur.fr>
Date: Thu, 25 Apr 2024 17:04:20 +0200
Subject: [PATCH] look at the exangeables as well

---
 components/content/SystemOperonStructure.vue | 7 ++++++-
 types/structure.ts                           | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/components/content/SystemOperonStructure.vue b/components/content/SystemOperonStructure.vue
index b99c5149..379be425 100644
--- a/components/content/SystemOperonStructure.vue
+++ b/components/content/SystemOperonStructure.vue
@@ -48,10 +48,15 @@ const sanitizedHits = computed<StructureOperonGeneWithImg[]>(() => {
             // get structure information for this prot
             const monomerStructuresVal = toValue(monomerStructures)
             const sanitizedGene = hit.gene.split("__")[1]
+            const sanitizedExangeableGenes = hit.exchangeables.map(g => g.split("__")[1])
+            const genesAndSynonymous = new Set([sanitizedGene, ...sanitizedExangeableGenes])
             if (monomerStructuresVal) {
                 const struct = monomerStructuresVal.find((struct) => {
-                    return struct.proteins_in_the_prediction[0] === sanitizedGene
+                    return genesAndSynonymous.has(struct.proteins_in_the_prediction[0])
                 })
+                if (struct === undefined) {
+                    console.log(hit)
+                }
                 const rawImgUrl = joinURL(`/${system.toLowerCase()}`, struct?.structImg ?? '')
                 const rawStructUrl = joinURL(`/${system.toLowerCase()}`, struct?.structPath ?? '')
                 const { refinedUrl: structImgHref } = useRefinedUrl(rawImgUrl)
diff --git a/types/structure.ts b/types/structure.ts
index 7e90fde5..e7d08dcb 100644
--- a/types/structure.ts
+++ b/types/structure.ts
@@ -4,6 +4,8 @@ export interface StructureOperonGene {
     subsystem: string
     version: string
     system: string
+    exchangeables: string[]
+
 }
 
 export interface StructureOperonGeneWithImg extends StructureOperonGene {
-- 
GitLab