Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Metagenomics
metagenedb
Commits
65ee2b07
Commit
65ee2b07
authored
Aug 07, 2019
by
Kenzo-Hugo Hillion
♻
Browse files
make gene length positive only
parent
65eab49d
Changes
3
Hide whitespace changes
Inline
Side-by-side
backend/metagenedb/api/catalog/views/gene.py
View file @
65ee2b07
...
...
@@ -16,7 +16,7 @@ from metagenedb.apps.catalog.serializers import GeneSerializer
window_size_param
=
openapi
.
Parameter
(
'window_size'
,
in_
=
openapi
.
IN_QUERY
,
description
=
'Size of the window.'
,
type
=
openapi
.
TYPE_INTEGER
,
default
=
10000
)
gene_length_schema
=
openapi
.
Schema
(
"pouet"
,
{},
type
=
{
'hihi'
:
'haha'
})
gene_length_response
=
openapi
.
Response
(
'
r
et
urn JSON content
'
,
schema
=
gene_length_schema
)
gene_length_response
=
openapi
.
Response
(
'
G
et
the distribution of gene length for a given window size
'
,
schema
=
gene_length_schema
)
class
GeneViewSet
(
mixins
.
ListModelMixin
,
...
...
@@ -47,13 +47,12 @@ class GeneViewSet(mixins.ListModelMixin,
@
swagger_auto_schema
(
manual_parameters
=
[
window_size_param
],
responses
=
{
responses
=
{
'200'
:
gene_length_response
,
'204'
:
'no content'
},
},
security
=
[],
operation_id
=
'List of categories'
,
operation_description
=
'Get the distribution of gene length for a given window size.'
,
)
@
action
(
methods
=
[
'get'
],
detail
=
False
)
def
gene_length
(
self
,
request
,
window_size
=
10000
):
...
...
backend/metagenedb/apps/catalog/migrations/0007_gene_length_positive.py
0 → 100644
View file @
65ee2b07
# Generated by Django 2.2.1 on 2019-08-07 13:20
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'catalog'
,
'0006_gene_taxonomy'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'gene'
,
name
=
'gene_length'
,
field
=
models
.
PositiveIntegerField
(),
),
]
backend/metagenedb/apps/catalog/models/gene.py
View file @
65ee2b07
...
...
@@ -5,7 +5,7 @@ from .function import Function
class
Gene
(
models
.
Model
):
gene_id
=
models
.
CharField
(
max_length
=
100
,
unique
=
True
,
db_index
=
True
)
gene_length
=
models
.
IntegerField
()
gene_length
=
models
.
Positive
IntegerField
()
functions
=
models
.
ManyToManyField
(
Function
)
taxonomy
=
models
.
ForeignKey
(
'Taxonomy'
,
related_name
=
'genes'
,
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment