From 1f9f4590185613a70546f8421bd38576d1e0418c Mon Sep 17 00:00:00 2001
From: Remi  PLANEL <rplanel@pasteur.fr>
Date: Fri, 12 Apr 2024 14:16:57 +0200
Subject: [PATCH] use structure basket

---
 components/content/ArticleStructure.vue       |  8 +++++---
 components/content/PdockqMatrix.vue           | 13 ++++++++-----
 components/content/StructureDb.vue            | 19 ++++++++++---------
 .../df_wiki_cli/meilisearch/update/main.py    |  2 --
 4 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/components/content/ArticleStructure.vue b/components/content/ArticleStructure.vue
index c4615559..5cf16951 100644
--- a/components/content/ArticleStructure.vue
+++ b/components/content/ArticleStructure.vue
@@ -5,16 +5,18 @@ import * as d3 from "d3";
 import SystemOperonStructure from './SystemOperonStructure.vue';
 import type { StructureItem } from '~/types/structure';
 import type { SearchParams, SearchResponse } from 'meilisearch';
+import { useStructuresBasket } from '~/stores/structuresBasket';
 
 
 const { page } = useContent();
 const client = useMeiliSearchRef()
+const structureBasket = useStructuresBasket()
 
 // get the structures
 const structures = ref<SearchResponse<StructureItem, SearchParams> | undefined>()
 const structureTitle = ref("Structure")
 const msIndexName = ref<string>("structure")
-const stuctureUrls = ref<string[] | undefined>(undefined)
+// const stuctureUrls = ref<string[] | undefined>(undefined)
 const headers = ref<Record<string, any>[]>([
     { title: 'Structure', key: 'structure', sortable: false, removable: false, fixed: true, minWidth: "110px" },
 
@@ -56,7 +58,7 @@ function pdbNameToCif(pdbPath: string) {
     return `${cifPath}.cif`
 }
 function displayStructure(item) {
-    stuctureUrls.value = item.structuresUrls
+    structureBasket.set(item.structuresUrls)
     structureTitle.value = `${item.subsystem} - ${item.gene_name}`
 
 }
@@ -163,6 +165,6 @@ async function fetchStructures() {
                 </v-row>
             </template>
         </v-data-table>
-        <PdbeMolstarPlugin v-model="stuctureUrls" v-model:title="structureTitle" />
+        <PdbeMolstarPlugin v-model:title="structureTitle" />
     </v-card>
 </template>
\ No newline at end of file
diff --git a/components/content/PdockqMatrix.vue b/components/content/PdockqMatrix.vue
index b47a1c70..90fdc8da 100644
--- a/components/content/PdockqMatrix.vue
+++ b/components/content/PdockqMatrix.vue
@@ -6,6 +6,7 @@ import PlotFigure from "@/components/PlotFigure";
 import type { SearchResponse } from 'meilisearch'
 import { useRefinedUrl } from "@/composables/useRefinedUrl"
 import { useDisplay } from "vuetify";
+import { useStructuresBasket } from "~/stores/structuresBasket";
 
 interface Props {
     subsystem: string
@@ -20,8 +21,9 @@ const filterBase = ref<string[]>([
     "completed='true'"
 ])
 const structureTitle = ref("Structure")
-const structureUrls = ref<string[] | undefined>(undefined)
+// const structureUrls = ref<string[] | undefined>(undefined)
 const matrixElemSize = ref(50)
+const structureBasket = useStructuresBasket()
 
 export interface PlotMargin {
     marginTop: number,
@@ -183,9 +185,10 @@ function buildStructureUrl(item) {
 }
 
 function displayStructure(item) {
-    structureUrls.value = buildStructureUrl(item).map(url => {
-        return toValue(useRefinedUrl(url).refinedUrl)
-    })
+    structureBasket.set(
+        buildStructureUrl(item).map(url => {
+            return toValue(useRefinedUrl(url).refinedUrl)
+        }))
     structureTitle.value = item.proteins_in_the_prediction.join(" / ")
 
 }
@@ -200,7 +203,7 @@ function displayStructure(item) {
             </v-card-text>
 
         </v-card>
-        <PdbeMolstarPlugin v-model="structureUrls" v-model:title="structureTitle" />
+        <PdbeMolstarPlugin v-model:title="structureTitle" />
     </v-row>
     <v-card v-else flat color="transparent">
         <v-card-text>
diff --git a/components/content/StructureDb.vue b/components/content/StructureDb.vue
index 86b68c47..4ec306e7 100644
--- a/components/content/StructureDb.vue
+++ b/components/content/StructureDb.vue
@@ -4,7 +4,8 @@ import { useNumericalFilter } from "@/composables/useNumericalfilter"
 import { useRefinedUrl } from "@/composables/useRefinedUrl"
 import { ServerDbTable } from "#components"
 
-import { withQuery, joinURL, withTrailingSlash } from 'ufo'
+import { joinURL } from 'ufo'
+import { useStructuresBasket } from "~/stores/structuresBasket"
 
 interface Item {
     Foldseek_name: string
@@ -12,12 +13,12 @@ interface Item {
 }
 
 
-const sortBy: Ref<SortItem[]> = ref([{ key: 'System', order: "asc" }])
+const sortBy: Ref<SortItem[]> = ref([{ key: 'system', order: "asc" }])
 const itemValue = ref("id");
 const dbName = ref("structure")
 const client = useMeiliSearchRef()
 const structureTitle = ref("Structure")
-const stuctureUrls = ref<string[] | undefined>(undefined)
+const structureBasket = useStructuresBasket()
 
 
 onMounted(async () => {
@@ -48,7 +49,6 @@ const autocompleteMeiliFacetsProps = ref<AutocompleteMeiliFacetProps>({
         { title: "System", value: "System", type: "facet", icon: "i-tabler:virus-off", },
         { title: "Subsystem", value: "subtype", type: "facet", icon: "i-tabler:virus-off" },
         { type: "divider" },
-        { title: "Gene name", value: "gene_name", type: "facet", icon: "mdi-dna" },
         { title: "Completed", value: "completed", type: "facet", icon: "md:done" },
         { title: "Prediction type", value: "prediction_type", type: "facet", icon: "i-gravity-ui:molecule" },
     ],
@@ -83,9 +83,9 @@ const computedAutocompleteMeiliFacetsProps = computed(() => {
 const headers: Ref<Object[]> = ref([
     { title: 'Structure', key: 'structure', sortable: false, removable: false, fixed: true, minWidth: "110px" },
     { title: 'Foldseek', key: 'Foldseek_name', sortable: false },
-    { title: "System", key: "System", removable: false },
-    { title: "Gene name", key: "gene_name", removable: false },
-    { title: "Subtype", key: "subtype", removable: false },
+    { title: "System", key: "system", removable: false },
+    // { title: "Gene name", key: "gene_name", removable: false },
+    { title: "Sub-system", key: "subsystem", removable: false },
     // { title: "pdb file", key: "pdb" },
     // { title: "fasta", key: "fasta_file" },
     { title: "Proteins in structure", key: 'proteins_in_the_prediction', sortable: false, removable: true },
@@ -157,9 +157,10 @@ function buildStructureUrl(item) {
 }
 
 function displayStructure(item) {
-    stuctureUrls.value = buildStructureUrl(item).map(url => {
+
+    structureBasket.set(buildStructureUrl(item).map(url => {
         return toValue(useRefinedUrl(url).refinedUrl)
-    })
+    }))
     structureTitle.value = `${item.subtype} - ${item.gene_name}`
 
 }
diff --git a/packages/df-wiki-cli/df_wiki_cli/meilisearch/update/main.py b/packages/df-wiki-cli/df_wiki_cli/meilisearch/update/main.py
index 02f3965a..e23eae19 100644
--- a/packages/df-wiki-cli/df_wiki_cli/meilisearch/update/main.py
+++ b/packages/df-wiki-cli/df_wiki_cli/meilisearch/update/main.py
@@ -341,7 +341,6 @@ def structure(
         body=[
             "system",
             "subsystem",
-            "gene_name",
             "completed",
             "prediction_type",
             "plddts",
@@ -365,7 +364,6 @@ def structure(
         [
             "system",
             "subsystem",
-            "gene_name",
             "completed",
             "plddts",
             "nb_sys",
-- 
GitLab