Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Wiki
Manage
Activity
Members
Labels
Plan
Issues
53
Issue boards
Milestones
Wiki
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MDM Lab
Wiki
Commits
86ec5c81
Commit
86ec5c81
authored
1 year ago
by
Remi PLANEL
Browse files
Options
Downloads
Patches
Plain Diff
WIP: Normalize with number total assembly
parent
7d3ba931
No related branches found
No related tags found
1 merge request
!222
Refseq no sys
Pipeline
#122107
waiting for manual action with stages
in 5 minutes and 46 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/content/RefseqDb.vue
+84
-10
84 additions, 10 deletions
components/content/RefseqDb.vue
with
84 additions
and
10 deletions
components/content/RefseqDb.vue
+
84
−
10
View file @
86ec5c81
<
script
setup
lang=
"ts"
>
import
*
as
d3
from
"
d3
"
;
import
*
as
Plot
from
"
@observablehq/plot
"
;
import
PlotFigure
from
"
~/components/PlotFigure
"
;
import
{
useDisplay
}
from
"
vuetify
"
;
...
...
@@ -149,10 +151,7 @@ const allHits: Ref<Record<string, any> | undefined> = ref(undefined)
const
pendingAllHits
=
ref
(
false
)
async
function
getAllHits
(
params
:
{
index
:
string
,
params
:
Record
<
string
,
any
>
,
query
:
string
})
{
console
.
log
(
params
.
index
)
if
(
params
.
index
===
toValue
(
dbName
))
{
console
.
log
(
"
get all hits in function
"
)
console
.
log
(
params
)
pendingAllHits
.
value
=
true
try
{
const
{
data
,
error
}
=
await
useAsyncMeiliSearch
(
params
)
...
...
@@ -205,6 +204,8 @@ const computedSystemDistribution = computed(() => {
})
const
computedDistriSystemOptions
=
computed
(()
=>
{
const
toValNormalizePerAssembly
=
toValue
(
normalizePerAssembly
)
return
{
...
defaultBarPlotOptions
.
value
,
marginBottom
:
100
,
...
...
@@ -214,11 +215,13 @@ const computedDistriSystemOptions = computed(() => {
marks
:
[
// Plot.frame(),
Plot
.
barY
(
toVal
ue
(
computedSystemDistribution
)
,
{
y
:
"
count
"
,
x
:
'
type
'
,
tip
:
true
,
toVal
NormalizePerAssembly
,
Plot
.
groupX
({
y
:
"
sum
"
},
{
x
:
'
system
'
,
tip
:
true
,
sort
:
{
x
:
"
-y
"
},
},
)
// toValue(computedSystemDistribution),
),
],
...
...
@@ -228,7 +231,8 @@ const computedDistriSystemOptions = computed(() => {
// Taxo distri
const
computedTaxonomyDistribution
=
computed
(()
=>
{
if
(
toValue
(
msResult
)?.
facetDistribution
?.[
selectedTaxoRank
.
value
])
{
const
toValNormalizePerAssembly
=
toValue
(
normalizePerAssembly
)
if
(
toValNormalizePerAssembly
?.
length
>
0
)
{
return
Object
.
entries
(
toValue
(
msResult
).
facetDistribution
[
selectedTaxoRank
.
value
]).
map
(([
key
,
value
])
=>
{
return
{
[
selectedTaxoRank
.
value
]:
key
,
...
...
@@ -248,6 +252,7 @@ const computedDistriTaxoOptions = computed(() => {
width
:
computedWidth
.
value
,
marks
:
[
Plot
.
barY
(
toValue
(
computedTaxonomyDistribution
),
{
y
:
"
count
"
,
...
...
@@ -291,7 +296,8 @@ const binPlotOptions = ref({
const
binPlotDataOptions
=
computed
(()
=>
{
const
toValueAllHits
=
toValue
(
allHits
)
return
toValueAllHits
?.
hits
?.
length
>
0
?
{
const
toValNormalizePerAssembly
=
toValue
(
normalizePerAssembly
)
return
toValNormalizePerAssembly
?.
length
>
0
?
{
...
binPlotOptions
.
value
,
width
:
width
.
value
,
...
...
@@ -302,12 +308,81 @@ const binPlotDataOptions = computed(() => {
ticks
:
scaleType
.
value
===
'
symlog
'
?
3
:
5
,
},
marks
:
[
Plot
.
cell
(
toValueAllHits
?.
hits
??
[],
Plot
.
group
({
fill
:
"
count
"
},
{
x
:
"
type
"
,
y
:
selectedTaxoRank
.
value
,
tip
:
true
,
inset
:
0.5
,
sort
:
{
y
:
"
fill
"
}
})),
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
assemblyPerRank
=
computed
(()
=>
{
const
toValueAllHits
=
toValue
(
allHits
)
if
(
toValueAllHits
&&
toValueAllHits
?.
hits
?.
length
>
0
)
{
return
d3
.
rollup
(
toValueAllHits
.
hits
,
D
=>
D
.
length
,
d
=>
d
[
toValue
(
selectedTaxoRank
)],
d
=>
d
.
Assembly
)
}
})
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
)
const
taxonomicDistributionPlot
=
ref
<
ComponentPublicInstance
|
null
>
(
null
)
...
...
@@ -466,7 +541,6 @@ async function downloadPng(component: ComponentPublicInstance | null, filename:
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
<ServerDbTable
title=
"RefSeq"
:sortBy=
"sortBy"
:autocomplete-meili-facets-props=
"computedAutocompleteMeiliFacetsProps"
:data-table-server-props=
"dataTableServerProps"
@
refresh:search=
"(params) => getAllHits(params)"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment