From 632c9e9523083c450876f545fc672637c883d301 Mon Sep 17 00:00:00 2001 From: Remi PLANEL <rplanel@pasteur.fr> Date: Thu, 21 Mar 2024 16:33:13 +0100 Subject: [PATCH] handle case where cannot remove prefix using __ as separator --- components/content/pdockqMatrix.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/components/content/pdockqMatrix.vue b/components/content/pdockqMatrix.vue index 540fa6b3..f32f1ceb 100644 --- a/components/content/pdockqMatrix.vue +++ b/components/content/pdockqMatrix.vue @@ -81,18 +81,22 @@ const computedSystem = computed(() => { const groupedPdocks = computed(() => { const toValData = toValue(data) + const getSeqName = (d) => { + if (d.includes("__")) { + return d.split("__")[1] + } else { + return d + } + } if (toValData?.hits) { return d3.groups(toValData.hits.flatMap(({ System_name_ok, pDockQ, pdb, nb_sys, proteins_in_the_prediction, system_genes }) => { if (proteins_in_the_prediction.length === 2) { - const sanitizedSystemGenes = system_genes.map(d => d.split("__")[1]) - const sanitizedProteins = proteins_in_the_prediction.map(d => d.split("__")[1]) + const sanitizedSystemGenes = system_genes.map(getSeqName) + const sanitizedProteins = proteins_in_the_prediction.map(getSeqName) const setProteins = new Set(sanitizedProteins) - - if (setProteins.size === 2) { - return sanitizedProteins.map((prot, i) => { if (i === 0) { return { System_name_ok, system_genes: sanitizedSystemGenes, pDockQ, pdb, nb_sys, proteins_in_the_prediction: sanitizedProteins, protX: prot, protY: sanitizedProteins[i + 1] } @@ -108,7 +112,7 @@ const groupedPdocks = computed(() => { } else { throw createError(`More than 2 proteins in a dimer structure for system ${computedSystem.value} !`) } - }), d => d.system_genes.sort().join("--")) + }), d => d.system_genes.sort().join(" / ")) } else { return [] } }) -- GitLab