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>({
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 () => {
......@@ -46,10 +63,10 @@ onMounted(async () => {
if (error.value) {
throw createError("Error while getting structure pdocks")
}
})
const computedSystem = computed(() => {
const toValPage = toValue(page)
const toValSystem = toValue(system)
......@@ -64,33 +81,35 @@ const computedSystem = computed(() => {
const groupedPdocks = computed(() => {
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) {
const sanitizedSystemGenes = system_genes.map(d => d.split("__")[1])
const sanitizedProteins = proteins_in_the_prediction.map(d => d.split("__")[1])
const setProteins = new Set(sanitizedProteins)
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 setProteins = new Set(sanitizedProteins)
if (setProteins.size === 2) {
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] }
}
else {
return { System_name_ok, system_genes: sanitizedSystemGenes, pDockQ, pdb, nb_sys, proteins_in_the_prediction: sanitizedProteins, protX: prot, protY: sanitizedProteins[i - 1] }
}
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] }
}
else {
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 {
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 {
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 [] }
})
......@@ -128,19 +147,19 @@ const computedPDocksMatrixPlotOptions = computed(() => {
})
})
const { data, error } = await useAsyncMeiliSearch({
index: toValue(dbName), query: "", params: {
facets: ["*"],
filter: [
`System='${toValue(computedSystem)}'`,
...toValue(filterBase)
],
}
})
if (error.value) {
throw createError("Error while getting structure pdocks")
}
// const { data, error } = await useAsyncMeiliSearch({
// index: toValue(dbName), query: "", params: {
// facets: ["*"],
// filter: [
// `System='${toValue(computedSystem)}'`,
// ...toValue(filterBase)
// ],
// }
// })
// if (error.value) {
// throw createError("Error while getting structure pdocks")
// }
</script>
<template>
<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