From 11ef04abc5d63cfc1dd579ce515a5f75a487d3af Mon Sep 17 00:00:00 2001
From: Remi  PLANEL <rplanel@pasteur.fr>
Date: Thu, 25 Apr 2024 18:59:28 +0200
Subject: [PATCH] less restrictive research if cannot found mapping between DF
 model gene name and structure gene name

---
 components/content/SystemOperonStructure.vue | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/components/content/SystemOperonStructure.vue b/components/content/SystemOperonStructure.vue
index 092c3dc6..484fe363 100644
--- a/components/content/SystemOperonStructure.vue
+++ b/components/content/SystemOperonStructure.vue
@@ -63,7 +63,18 @@ const sanitizedHits = computed<StructureOperonGeneWithImg[]>(() => {
             const genesAndSynonymous = new Set([sanitizedGene, ...sanitizedExangeableGenes])
             if (monomerStructuresVal) {
                 const struct = monomerStructuresVal.find((struct) => {
-                    return genesAndSynonymous.has(struct.proteins_in_the_prediction[0])
+
+                    const hasInSet = genesAndSynonymous.has(struct.proteins_in_the_prediction[0])
+                    if (hasInSet) return hasInSet
+
+                    // try some less restrictive search
+                    return Array.from(genesAndSynonymous).find(dfModelGeneName => {
+                        if (dfModelGeneName !== undefined && struct?.proteins_in_the_prediction !== undefined) {
+                            const protName = struct.proteins_in_the_prediction[0]
+                            if (protName !== undefined) return dfModelGeneName.startsWith(protName)
+                        }
+                        return false
+                    }) !== undefined
                 })
                 const rawImgUrl = joinURL(`/${system.toLowerCase()}`, struct?.structImg ?? '')
                 const rawStructUrl = joinURL(`/${system.toLowerCase()}`, struct?.structPath ?? '')
-- 
GitLab