From 2ffe49c0f7f4aa45cd24bf63d107ec55fd81bbeb Mon Sep 17 00:00:00 2001 From: Remi PLANEL <rplanel@pasteur.fr> Date: Fri, 26 Apr 2024 11:51:07 +0200 Subject: [PATCH] fix bug when matrix one prot (need to look at multimer(homodimer)) --- components/content/PdockqMatrix.vue | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/components/content/PdockqMatrix.vue b/components/content/PdockqMatrix.vue index aa22e4f0..04552690 100644 --- a/components/content/PdockqMatrix.vue +++ b/components/content/PdockqMatrix.vue @@ -17,7 +17,7 @@ const { mobile } = useDisplay(); const { page } = useContent(); const dbName = "structure" const filterBase = ref<string[]>([ - "prediction_type='multimer(dimer)'", + "prediction_type='multimer(dimer)' OR prediction_type='multimer(homodimer)'", "completed='true'" ]) const structureTitle = ref("Structure") @@ -77,15 +77,9 @@ function extractGeneName(name: string) { 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, pDockQ, pdb, nb_sys, proteins_in_the_prediction, system_genes }) => { + + const flattenMap = toValData.hits.flatMap(({ system, pDockQ, pdb, nb_sys, proteins_in_the_prediction, system_genes }) => { if (proteins_in_the_prediction.length === 2) { const sanitizedSystemGenes = system_genes.map(extractGeneName) const sanitizedProteins = proteins_in_the_prediction.map(extractGeneName) @@ -102,12 +96,14 @@ const groupedPdocks = computed(() => { }) } else { - return { key, system, system_genes: sanitizedSystemGenes, pDockQ, pdb, nb_sys, proteins_in_the_prediction: sanitizedProteins, protX: sanitizedProteins[0], protY: sanitizedProteins[1] } + return [{ key, system, system_genes: sanitizedSystemGenes, pDockQ, pdb, nb_sys, proteins_in_the_prediction: sanitizedProteins, protX: sanitizedProteins[0], protY: sanitizedProteins[1] }] } } else { throw createError(`More than 2 proteins in a dimer structure for system ${computedSystem.value} !`) } - }), d => d.system_genes.sort().join(" / ")) + }) + const groups = d3.groups(flattenMap, d => d.system_genes.sort().join(" / ")) + return groups } else { return [] } }) -- GitLab