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

sort heatmap X with no system found first

parent 69db719c
No related branches found
No related tags found
No related merge requests found
Pipeline #124438 failed
...@@ -323,13 +323,30 @@ function namesToAccessionChips(names: string[]) { ...@@ -323,13 +323,30 @@ function namesToAccessionChips(names: string[]) {
} }
const systemPanel: Ref<string[]> = ref([]) const systemPanel: Ref<string[]> = ref([])
const layoutPlot: Ref<string> = ref("grid") const layoutPlot: Ref<string> = ref("grid")
function compareBySystem(a, b) {
if (a === "No system found") {
return -1
}
if (b === "No system found") {
return 1
}
return a - b
}
const sortedCellDomain = computed(() => {
const toValueAllHits = toValue(allHits)
if (toValueAllHits && toValueAllHits?.hits?.length > 0) {
return toValueAllHits.hits.map(d => d.type).sort(compareBySystem)
}
})
const binPlotOptions = computed(() => { const binPlotOptions = computed(() => {
return { return {
marginLeft: 150, marginLeft: 150,
marginBottom: 200, marginBottom: 200,
padding: 0, padding: 0,
grid: true, grid: true,
x: { tickRotate: 90, label: "Systems" }, x: { tickRotate: 90, label: "Systems", domain: toValue(sortedCellDomain) },
// y: { tickFormat: 's' }, // y: { tickFormat: 's' },
color: { scheme: "plasma", legend: true, label: `Proportion per ${selectedTaxoRank.value}`, domain: [0, 100] }, color: { scheme: "plasma", legend: true, label: `Proportion per ${selectedTaxoRank.value}`, domain: [0, 100] },
} }
...@@ -351,13 +368,12 @@ const binPlotGroup = computed(() => { ...@@ -351,13 +368,12 @@ const binPlotGroup = computed(() => {
return X[index] return X[index]
}), D => D.length, d => d.type, d => d.Assembly) }), D => D.length, d => d.type, d => d.Assembly)
const countForClade = toValTaxonomyFacet[selectedTaxoRank.value][clade] const countForClade = toValTaxonomyFacet[selectedTaxoRank.value][clade]
console.log(`${itemsPerGroup.get(system).size} / ${countForClade}`)
const frequency = (itemsPerGroup.get(system).size / countForClade) * 100 const frequency = (itemsPerGroup.get(system).size / countForClade) * 100
return frequency return frequency
} }
return I.length return I.length
} }
} },
}, },
{ {
x: "type", x: "type",
...@@ -365,9 +381,14 @@ const binPlotGroup = computed(() => { ...@@ -365,9 +381,14 @@ const binPlotGroup = computed(() => {
tip: true, tip: true,
inset: 0.5, inset: 0.5,
sort: { y: "fill" } sort: { y: "fill" }
}) }
)
}) })
const binPlotDataOptions = computed(() => { const binPlotDataOptions = computed(() => {
const toValueAllHits = toValue(allHits) const toValueAllHits = toValue(allHits)
const data = toValueAllHits?.hits ?? [] const data = toValueAllHits?.hits ?? []
...@@ -380,12 +401,12 @@ const binPlotDataOptions = computed(() => { ...@@ -380,12 +401,12 @@ const binPlotDataOptions = computed(() => {
type: scaleType.value, type: scaleType.value,
tickFormat: '~s', tickFormat: '~s',
ticks: scaleType.value === 'symlog' ? 3 : 5, ticks: scaleType.value === 'symlog' ? 3 : 5,
}, },
marks: [ marks: [
Plot.cell(data, toValue(binPlotGroup)), Plot.cell(data,
] toValue(binPlotGroup)
),
],
} : null } : null
}) })
......
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