Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
metagenedb
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
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
Metagenomics
metagenedb
Commits
1c69e764
Commit
1c69e764
authored
5 years ago
by
Kenzo-Hugo Hillion
Browse files
Options
Downloads
Patches
Plain Diff
Start improving gene list
parent
1332e720
No related branches found
Branches containing commit
No related tags found
2 merge requests
!59
Prod
,
!36
Improve gene list on frontend and API optimization
Pipeline
#21471
passed with stages
Stage:
Stage:
in 2 minutes and 48 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/metagenedb/api/catalog/views/gene.py
+1
-1
1 addition, 1 deletion
backend/metagenedb/api/catalog/views/gene.py
frontend/src/views/Genes.vue
+72
-12
72 additions, 12 deletions
frontend/src/views/Genes.vue
with
73 additions
and
13 deletions
backend/metagenedb/api/catalog/views/gene.py
+
1
−
1
View file @
1c69e764
...
...
@@ -7,7 +7,7 @@ from .base import BulkViewSet
class
GeneViewSet
(
BulkViewSet
):
queryset
=
Gene
.
objects
.
select_related
(
'
taxonomy
'
).
prefetch_related
(
'
functions
'
)
.
all
()
queryset
=
Gene
.
objects
.
select_related
(
'
taxonomy
'
).
prefetch_related
(
'
functions
'
)
serializer_class
=
GeneSerializer
filterset_class
=
GeneFilter
query_params_parser
=
GeneQueryParams
...
...
This diff is collapsed.
Click to expand it.
frontend/src/views/Genes.vue
+
72
−
12
View file @
1c69e764
...
...
@@ -4,9 +4,10 @@
<v-layout
row
wrap
>
<v-flex
xs12
>
<v-toolbar
class=
"secondary"
d
ark
class=
"secondary
darken-1 white--text
"
d
ense
>
<v-icon
class=
"white--text"
>
format_list_bulleted
</v-icon>
<v-toolbar-title>
Catalog content
</v-toolbar-title>
</v-toolbar>
<v-list>
...
...
@@ -15,15 +16,40 @@
</v-subheader>
<v-data-table
:rows-per-page-items=
"rowsPerPageItems"
:pagination.sync=
"pagination"
:headers=
"headers"
:items=
"genes"
hide-actions
>
<template
v-slot:items=
"props"
>
<td><a
:href=
"/gene-detail/ + props.item.gene_id"
>
{{
props
.
item
.
gene_id
}}
</a></td>
<td>
{{
props
.
item
.
gene_id
}}
<v-btn
:to=
"/gene-detail/ + props.item.gene_id"
icon
flat
small
target=
"_blank"
class=
"primary--text mt-1 ml-0"
>
<v-icon
small
>
open_in_new
</v-icon>
</v-btn>
</td>
<td>
{{
props
.
item
.
name
}}
</td>
<td
class=
"text-xs"
>
{{
props
.
item
.
length
}}
</td>
<td
class=
"text-xs"
></td>
<td
class=
"text-xs"
>
{{
props
.
item
.
functions
}}
</td>
<td
class=
"text-xs"
>
{{
props
.
item
.
taxonomy
}}
<v-btn
:href=
"props.item.tax_url"
icon
flat
small
target=
"_blank"
class=
"taxonomy--text mt-1 ml-0"
v-if=
"props.item.taxonomy"
>
<v-icon
small
>
open_in_new
</v-icon>
</v-btn>
</td>
<td
class=
"text-xs"
>
{{
props
.
item
.
kegg
}}
<v-btn
:href=
"props.item.kegg_url"
icon
flat
small
target=
"_blank"
class=
"kegg--text mt-1 ml-0"
v-if=
"props.item.kegg"
>
<v-icon
small
>
open_in_new
</v-icon>
</v-btn>
</td>
<td
class=
"text-xs"
>
{{
props
.
item
.
eggnog
}}
</td>
</
template
>
</v-data-table>
</v-list>
...
...
@@ -42,7 +68,16 @@ export default {
return
{
genes
:
[],
count
:
0
,
headers
:
[
page
:
1
,
rowsPerPageItems
:
[
25
],
pagination
:
{
rowsPerPage
:
25
},
};
},
computed
:
{
headers
()
{
return
[
{
text
:
'
Gene ID
'
,
align
:
'
left
'
,
...
...
@@ -56,23 +91,48 @@ export default {
value
:
'
name
'
,
},
{
text
:
'
Length
'
,
value
:
'
length
'
},
{
text
:
'
Taxo
'
,
sortable
:
false
},
{
text
:
'
Functions
'
,
value
:
'
functions
'
,
sortable
:
false
},
],
};
{
text
:
'
Taxonomy
'
,
value
:
'
taxonomy
'
,
sortable
:
false
},
{
text
:
'
KEGG
'
,
value
:
'
kegg
'
,
sortable
:
false
},
{
text
:
'
EggNOG
'
,
value
:
'
eggnog
'
,
sortable
:
false
},
];
},
},
mounted
()
{
this
.
getGenes
();
},
methods
:
{
getGenes
()
{
axios
.
get
(
'
/api/catalog/v1/genes/
'
,
{
axios
.
get
(
'
/api/catalog/v1/genes
'
,
{
params
:
{
page_size
:
25
},
headers
:
{
Accept
:
'
application/json
'
,
},
})
.
then
((
response
)
=>
{
this
.
genes
=
response
.
data
.
results
;
const
ncbi_tax_url
=
'
https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?name=
'
;
const
kegg_url
=
'
https://www.genome.jp/dbget-bin/www_bget?ko:
'
;
var
genes
=
response
.
data
.
results
;
genes
.
forEach
(
function
(
item
,
index
)
{
if
(
item
.
taxonomy
)
{
item
.
tax_url
=
ncbi_tax_url
+
item
.
taxonomy
.
name
;
item
.
taxonomy
=
item
.
taxonomy
.
name
;
};
if
(
item
.
functions
)
{
var
functions
=
item
.
functions
;
functions
.
forEach
(
function
(
fun
,
ind
)
{
if
(
fun
.
source
==
'
kegg
'
)
{
item
.
kegg_url
=
kegg_url
+
fun
.
function_id
;
item
.
kegg
=
fun
.
function_id
;
}
else
if
(
fun
.
source
==
'
eggnog
'
)
{
item
.
eggnog
=
fun
.
function_id
;
};
});
}
});
this
.
genes
=
genes
;
this
.
count
=
response
.
data
.
count
;
})
.
catch
((
error
)
=>
{
...
...
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