Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
metagenedb
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Metagenomics
metagenedb
Commits
8d6064a7
You need to sign in or sign up before continuing.
Commit
8d6064a7
authored
5 years ago
by
Kenzo-Hugo Hillion
Browse files
Options
Downloads
Patches
Plain Diff
add visualization for phylum annotation on db
parent
2fe3bd45
No related branches found
No related tags found
2 merge requests
!59
Prod
,
!23
Add more statistical graph about gene catalog
Pipeline
#19183
passed
5 years ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
frontend/src/components/Doughnut.vue
+78
-0
78 additions, 0 deletions
frontend/src/components/Doughnut.vue
frontend/src/components/Histogram.vue
+2
-2
2 additions, 2 deletions
frontend/src/components/Histogram.vue
frontend/src/views/Stats.vue
+29
-0
29 additions, 0 deletions
frontend/src/views/Stats.vue
with
109 additions
and
2 deletions
frontend/src/components/Doughnut.vue
0 → 100644
+
78
−
0
View file @
8d6064a7
<
template
>
<v-flex
xs12
md6
xl4
>
<v-toolbar
:class=
"doughnutData.class"
dark
v-if=
"doughnutData.data"
>
<v-icon
class=
"white--text"
>
{{
doughnutData
.
icon
}}
</v-icon>
<v-toolbar-title>
{{
doughnutData
.
title
}}
(
{{
doughnutData
.
level
}}
)
</v-toolbar-title>
</v-toolbar>
<v-card
class=
"pa-2"
>
<div
class=
"card-body"
>
<div
v-if=
"doughnutData.data"
>
<canvas
:id=
"this.doughnutData.chartId"
></canvas>
</div>
<div
class=
"text-xs-center"
v-else
>
<v-progress-circular
indeterminate
color=
"secondary"
></v-progress-circular>
</div>
</div>
</v-card>
</v-flex>
</
template
>
<
script
>
import
Chart
from
'
chart.js
'
;
export
default
{
props
:
{
doughnutData
:
{
type
:
Object
,
required
:
true
,
},
},
updated
()
{
this
.
createChart
(
this
.
doughnutData
.
chartId
);
},
methods
:
{
createChart
(
chartId
)
{
const
ctx
=
document
.
getElementById
(
chartId
);
const
colors
=
[];
for
(
var
i
=
0
;
i
<
Object
.
keys
(
this
.
doughnutData
.
data
).
length
;
i
++
)
{
colors
.
push
(
this
.
generateColor
())
}
const
data
=
{
labels
:
Object
.
keys
(
this
.
doughnutData
.
data
),
datasets
:
[
{
data
:
Object
.
values
(
this
.
doughnutData
.
data
),
backgroundColor
:
colors
,
},
],
};
const
options
=
{
legend
:
{
display
:
true
,
}
};
// eslint-disable-next-line
const
myChart
=
new
Chart
(
ctx
,
{
data
:
data
,
type
:
'
doughnut
'
,
options
:
options
,
});
},
generateColor
()
{
var
letters
=
'
0123456789ABCDEF
'
;
var
color
=
'
#
'
;
for
(
var
i
=
0
;
i
<
6
;
i
++
)
{
color
+=
letters
[
Math
.
floor
(
Math
.
random
()
*
16
)];
}
return
color
;
},
},
};
</
script
>
This diff is collapsed.
Click to expand it.
frontend/src/components/Histogram.vue
+
2
−
2
View file @
8d6064a7
...
...
@@ -40,7 +40,7 @@ export default {
methods
:
{
createChart
(
chartId
)
{
const
ctx
=
document
.
getElementById
(
chartId
);
const
histoD
ata
=
{
const
d
ata
=
{
labels
:
this
.
histoData
.
labels
,
datasets
:
[
{
...
...
@@ -54,7 +54,7 @@ export default {
// eslint-disable-next-line
const
myChart
=
new
Chart
(
ctx
,
{
type
:
'
bar
'
,
data
:
histoD
ata
,
data
:
d
ata
,
});
},
},
...
...
This diff is collapsed.
Click to expand it.
frontend/src/views/Stats.vue
+
29
−
0
View file @
8d6064a7
...
...
@@ -25,6 +25,7 @@
</v-layout>
<v-layout
row
wrap
>
<histogram
:histoData=
"geneLengthData"
></histogram>
<doughnut
:doughnutData=
"taxoCounts"
></doughnut>
</v-layout>
</v-container>
</v-card>
...
...
@@ -37,6 +38,7 @@
import
axios
from
'
axios
'
;
import
Histogram
from
'
@/components/Histogram.vue
'
;
import
CountCard
from
'
@/components/CountCard.vue
'
;
import
Doughnut
from
'
@/components/Doughnut.vue
'
;
export
default
{
name
:
'
home
'
,
...
...
@@ -49,6 +51,7 @@ export default {
geneCountFull
:
{},
geneLengthWindowSize
:
400
,
stopAt
:
5000
,
taxoCounts
:
{},
};
},
mounted
()
{
...
...
@@ -57,6 +60,7 @@ export default {
this
.
getGeneCountsFunctions
();
this
.
getGeneCountsTaxo
();
this
.
getGeneCountsFull
();
this
.
getTaxoCounts
(
'
phylum
'
);
},
methods
:
{
getGeneLength
(
geneLengthWindowSize
,
stopAt
)
{
...
...
@@ -168,10 +172,35 @@ export default {
console
.
log
(
error
);
});
},
getTaxoCounts
(
level
)
{
axios
.
get
(
'
/api/catalog/v1/genes/taxonomy_counts
'
,
{
params
:
{
level
:
level
,
},
headers
:
{
Accept
:
'
application/json
'
,
},
})
.
then
((
response
)
=>
{
this
.
taxoCounts
=
{
class
:
"
secondary
"
,
icon
:
"
account_tree
"
,
title
:
"
Taxonomical annotation
"
,
data
:
response
.
data
.
results
.
counts
,
level
:
response
.
data
.
results
.
level
,
backgroundColor
:
'
#f15152
'
,
chartId
:
'
taxo_distri
'
,
};
})
.
catch
((
error
)
=>
{
console
.
log
(
error
);
});
},
},
components
:
{
histogram
:
Histogram
,
countcard
:
CountCard
,
doughnut
:
Doughnut
,
},
};
</
script
>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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