From 6d3273fd1925cae2502b81d312e6b296813a5579 Mon Sep 17 00:00:00 2001
From: Remi  PLANEL <rplanel@pasteur.fr>
Date: Thu, 8 Feb 2024 17:54:55 +0100
Subject: [PATCH] Remove some dead code

---
 components/content/RefseqDb.vue    | 153 ++++-------------------------
 components/content/StructureDb.vue |   1 -
 2 files changed, 19 insertions(+), 135 deletions(-)

diff --git a/components/content/RefseqDb.vue b/components/content/RefseqDb.vue
index cff70486..08ca0836 100644
--- a/components/content/RefseqDb.vue
+++ b/components/content/RefseqDb.vue
@@ -225,15 +225,6 @@ const computedDistriSystemOptions = computed(() => {
                 },
 
             ),
-            // Plot.barY(
-            //     toValNormalizePerAssembly,
-            //     Plot.groupX({ y: "sum" }, {
-            //         x: 'system', tip: true,
-            //         sort: { x: "-y" },
-            //     }),
-
-
-            // ),
         ],
     };
 });
@@ -309,7 +300,24 @@ const binPlotOptions = ref({
 const binPlotGroup = computed(() => {
     return Plot.group(
         {
-            fill: "count"
+            fill: {
+                label: `Normalize by ${selectedTaxoRank.value} clade`,
+                reduceIndex: function (I, X) {
+                    const toValAssemblyPerRank = toValue(assemblyPerRank)
+                    if (toValAssemblyPerRank?.size > 0) {
+                        const clade = X[I[0]][selectedTaxoRank.value]
+                        const system = X[I[0]].type
+                        // Get the list of item for this group
+                        const itemsPerGroup = d3.rollup(I.map(index => {
+                            return X[index]
+                        }), D => D.length, d => d.type, d => d.Assembly)
+                        const countForClade = toValAssemblyPerRank.get(clade).size
+                        const frequency = (itemsPerGroup.get(system).size / countForClade) * 100
+                        return frequency
+                    }
+                    return I.length
+                }
+            }
         },
         {
             x: "type",
@@ -335,96 +343,12 @@ const binPlotDataOptions = computed(() => {
 
         },
         marks: [
-            Plot.cell(data, Plot.group(
-                {
-                    fill: {
-                        label: `Normalize by ${selectedTaxoRank.value} clade`,
-                        reduceIndex: function (I, X) {
-                            const toValAssemblyPerRank = toValue(assemblyPerRank)
-                            if (toValAssemblyPerRank?.size > 0) {
-                                const clade = X[I[0]][selectedTaxoRank.value]
-                                const system = X[I[0]].type
-                                console.log(I)
-                                console.log(X)
-                                // Get the list of item for this group
-                                const itemsPerGroup = d3.rollup(I.map(index => {
-                                    return X[index]
-                                }), D => D.length, d => d.type, d => d.Assembly)
-                                console.log(itemsPerGroup)
-                                // console.log(clade)
-                                // console.log(toValAssemblyPerRank.get(clade))
-                                const countForClade = toValAssemblyPerRank.get(clade).size
-                                // console.log(countForClade)
-                                // console.log(I);
-                                // console.log(X);
-
-                                const frequency = (itemsPerGroup.get(system).size / countForClade) * 100
-                                console.log(frequency)
-                                return frequency
-                            }
-                            return I.length
-                        }
-                    }
-                },
-                {
-                    x: "type",
-                    y: selectedTaxoRank.value,
-                    tip: true,
-                    inset: 0.5,
-                    sort: { y: "fill" }
-                }))
+            Plot.cell(data, toValue(binPlotGroup))
         ]
 
     } : null
-
-    // const toValNormalizePerAssembly = toValue(normalizePerAssembly)
-    // return toValNormalizePerAssembly?.length > 0 ? {
-    //     ...binPlotOptions.value,
-    //     width: width.value,
-
-    //     color: {
-    //         ...binPlotOptions.value.color,
-    //         type: scaleType.value,
-    //         tickFormat: '~s',
-    //         ticks: scaleType.value === 'symlog' ? 3 : 5,
-    //     },
-    //     marks: [
-    //         Plot.cell(
-    //             toValNormalizePerAssembly ?? [],
-    //             Plot.group({
-    //                 fill: "count"
-    //             }, {
-    //                 x: "system",
-    //                 y: "rank",
-    //                 tip: true,
-    //                 inset: 0.5,
-    //                 sort: { y: "fill" }
-    //             })),
-    //     ]
-
-    // } : null
-
 })
 
-const systemPerAssemblyPerRank = computed(() => {
-    const toValueAllHits = toValue(allHits)
-    console.log("all hits dans system per...")
-    console.log(toValueAllHits)
-    if (toValueAllHits && toValueAllHits?.hits?.length > 0) {
-        return d3.rollup(toValueAllHits.hits, D => D.length, d => d[toValue(selectedTaxoRank)], d => d.Assembly, d => d.type)
-    }
-})
-
-const systemPerRankPerAssembly = computed(() => {
-    const toValueAllHits = toValue(allHits)
-    console.log("all hits dans system per...")
-    console.log(toValueAllHits)
-    if (toValueAllHits && toValueAllHits?.hits?.length > 0) {
-        return d3.rollup(toValueAllHits.hits, D => D.length, d => d[toValue(selectedTaxoRank)], d => d.type, d => d.Assembly)
-    }
-})
-
-
 const assemblyPerRank = computed(() => {
     const toValueAllHits = toValue(allHitsDb)
 
@@ -433,46 +357,7 @@ const assemblyPerRank = computed(() => {
     }
 })
 
-const ranks = computed(() => {
 
-    const toValAssemblyPerRank = toValue(assemblyPerRank)
-    console.log("dans le ranks computed")
-    console.log(toValAssemblyPerRank)
-    if (toValAssemblyPerRank && toValAssemblyPerRank?.size > 0) {
-        console.log(toValAssemblyPerRank.keys())
-
-        return [...toValAssemblyPerRank.keys()]
-    }
-})
-
-const normalizePerAssembly = computed(() => {
-    const toValRanks = toValue(ranks)
-    const toValAssemblyPerRank = toValue(assemblyPerRank)
-    const toValSystemPerAssemblyPerRank = toValue(systemPerAssemblyPerRank)
-    const normalizedSystemCount = []
-
-    console.log("dans computed normalize per assembly")
-    console.log(toValRanks)
-    console.log(toValAssemblyPerRank)
-    console.log(toValSystemPerAssemblyPerRank)
-    if (toValRanks && toValAssemblyPerRank && toValSystemPerAssemblyPerRank) {
-        for (const rank of toValRanks) {
-            // get list assembly for this rank
-            console.log(rank)
-            const assemblies = [...toValAssemblyPerRank.get(rank).keys()]
-            for (const assembly of assemblies) {
-                // get list 
-                const countAssemblyPerRank = toValAssemblyPerRank.get(rank).get(assembly)
-                const systems = toValSystemPerAssemblyPerRank.get(rank).get(assembly).keys()
-                for (const system of systems) {
-                    const countSystem = toValSystemPerAssemblyPerRank.get(rank).get(assembly).get(system)
-                    normalizedSystemCount.push({ rank, assembly, system, frequency: countSystem / countAssemblyPerRank })
-                }
-            }
-        }
-    }
-    return normalizedSystemCount
-})
 
 const scaleType = ref("linear")
 const systemsDistributionPlot = ref<ComponentPublicInstance | null>(null)
diff --git a/components/content/StructureDb.vue b/components/content/StructureDb.vue
index 27e5c74d..10805d56 100644
--- a/components/content/StructureDb.vue
+++ b/components/content/StructureDb.vue
@@ -124,7 +124,6 @@ const dataTableServerProps = computed(() => {
 function toFolseekUrl(item: Item) {
     const url = joinURL("/" + item.System_name_ok, item.Foldseek_name)
     const { refinedUrl } = useRefinedUrl(url)
-    console.log(toValue(refinedUrl))
     return toValue(refinedUrl)
 }
 
-- 
GitLab