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

beforemount as well :(

parent bf2cbc83
No related branches found
No related tags found
1 merge request!226Resolve "Design of the structure section in a system's page"
Pipeline #126760 waiting for manual action with stages
in 5 minutes and 59 seconds
...@@ -30,6 +30,23 @@ const margin = ref<PlotMargin>({ ...@@ -30,6 +30,23 @@ const margin = ref<PlotMargin>({
marginLeft: 150 marginLeft: 150
}) })
const data = ref()
onBeforeMount(async () => {
const { data: d, error } = await useAsyncMeiliSearch({
index: toValue(dbName), query: "", params: {
facets: ["*"],
filter: [
`System='${toValue(computedSystem)}'`,
...toValue(filterBase)
],
}
})
data.value = d.value
if (error.value) {
throw createError("Error while getting structure pdocks")
}
})
onMounted(async () => { onMounted(async () => {
...@@ -46,10 +63,10 @@ onMounted(async () => { ...@@ -46,10 +63,10 @@ onMounted(async () => {
if (error.value) { if (error.value) {
throw createError("Error while getting structure pdocks") throw createError("Error while getting structure pdocks")
} }
}) })
const computedSystem = computed(() => { const computedSystem = computed(() => {
const toValPage = toValue(page) const toValPage = toValue(page)
const toValSystem = toValue(system) const toValSystem = toValue(system)
...@@ -64,33 +81,35 @@ const computedSystem = computed(() => { ...@@ -64,33 +81,35 @@ const computedSystem = computed(() => {
const groupedPdocks = computed(() => { const groupedPdocks = computed(() => {
const toValData = toValue(data) const toValData = toValue(data)
return d3.groups(toValData.hits.flatMap(({ System_name_ok, pDockQ, pdb, nb_sys, proteins_in_the_prediction, system_genes }) => { 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) { if (proteins_in_the_prediction.length === 2) {
const sanitizedSystemGenes = system_genes.map(d => d.split("__")[1]) const sanitizedSystemGenes = system_genes.map(d => d.split("__")[1])
const sanitizedProteins = proteins_in_the_prediction.map(d => d.split("__")[1]) const sanitizedProteins = proteins_in_the_prediction.map(d => d.split("__")[1])
const setProteins = new Set(sanitizedProteins) const setProteins = new Set(sanitizedProteins)
if (setProteins.size === 2) { if (setProteins.size === 2) {
return sanitizedProteins.map((prot, i) => { return sanitizedProteins.map((prot, i) => {
if (i === 0) { 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] } return { System_name_ok, system_genes: sanitizedSystemGenes, pDockQ, pdb, nb_sys, proteins_in_the_prediction: sanitizedProteins, protX: prot, protY: sanitizedProteins[i + 1] }
} }
else { else {
return { System_name_ok, system_genes: sanitizedSystemGenes, pDockQ, pdb, nb_sys, proteins_in_the_prediction: sanitizedProteins, protX: prot, protY: sanitizedProteins[i - 1] } return { System_name_ok, system_genes: sanitizedSystemGenes, pDockQ, pdb, nb_sys, proteins_in_the_prediction: sanitizedProteins, protX: prot, protY: sanitizedProteins[i - 1] }
} }
}) })
} else {
return { System_name_ok, system_genes: sanitizedSystemGenes, pDockQ, pdb, nb_sys, proteins_in_the_prediction: sanitizedProteins, protX: sanitizedProteins[0], protY: sanitizedProteins[1] }
}
} else { } else {
return { System_name_ok, system_genes: sanitizedSystemGenes, pDockQ, pdb, nb_sys, proteins_in_the_prediction: sanitizedProteins, protX: sanitizedProteins[0], protY: sanitizedProteins[1] } throw createError(`More than 2 proteins in a dimer structure for system ${computedSystem.value} !`)
} }
} else { }), d => d.system_genes.sort().join("--"))
throw createError(`More than 2 proteins in a dimer structure for system ${computedSystem.value} !`) } else { return [] }
}
}), d => d.system_genes.sort().join("--"))
}) })
...@@ -128,19 +147,19 @@ const computedPDocksMatrixPlotOptions = computed(() => { ...@@ -128,19 +147,19 @@ const computedPDocksMatrixPlotOptions = computed(() => {
}) })
}) })
const { data, error } = await useAsyncMeiliSearch({ // const { data, error } = await useAsyncMeiliSearch({
index: toValue(dbName), query: "", params: { // index: toValue(dbName), query: "", params: {
facets: ["*"], // facets: ["*"],
filter: [ // filter: [
`System='${toValue(computedSystem)}'`, // `System='${toValue(computedSystem)}'`,
...toValue(filterBase) // ...toValue(filterBase)
], // ],
} // }
}) // })
if (error.value) { // if (error.value) {
throw createError("Error while getting structure pdocks") // throw createError("Error while getting structure pdocks")
} // }
</script> </script>
<template> <template>
<v-card flat color="transparent"> <v-card flat color="transparent">
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment