Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Cosy-Bio
Drugst.One
backend
Commits
e44fee44
Commit
e44fee44
authored
2 years ago
by
AndiMajore
Browse files
Options
Downloads
Patches
Plain Diff
added get_datasets route
Former-commit-id:
17a5c932
parent
763031b2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
drugstone/serializers.py
+11
-0
11 additions, 0 deletions
drugstone/serializers.py
drugstone/urls.py
+3
-5
3 additions, 5 deletions
drugstone/urls.py
drugstone/views.py
+9
-1
9 additions, 1 deletion
drugstone/views.py
with
23 additions
and
6 deletions
drugstone/serializers.py
+
11
−
0
View file @
e44fee44
...
...
@@ -17,6 +17,17 @@ class PPIDatasetSerializer(serializers.ModelSerializer):
model
=
models
.
PPIDataset
fields
=
'
__all__
'
class
PDisDatasetSerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
model
=
models
.
PDisDataset
fields
=
'
__all__
'
class
DrDisDatasetSerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
model
=
models
.
DrDiDataset
fields
=
'
__all__
'
class
ProteinNodeSerializer
(
serializers
.
ModelSerializer
):
drugstone_id
=
serializers
.
SerializerMethodField
()
uniprot_ac
=
serializers
.
SerializerMethodField
()
...
...
This diff is collapsed.
Click to expand it.
drugstone/urls.py
+
3
−
5
View file @
e44fee44
...
...
@@ -17,23 +17,21 @@ from django.contrib import admin
from
django.urls
import
path
from
drugstone.views
import
map_nodes
,
tasks_view
,
result_view
,
\
graph_export
,
query_proteins
,
TissueView
,
TissueExpressionView
,
query_tissue_proteins
,
TaskView
,
\
adjacent_drugs
,
adjacent_disorders
,
fetch_edges
,
create_network
,
load_network
,
get_license
graph_export
,
TissueView
,
TissueExpressionView
,
query_tissue_proteins
,
TaskView
,
\
adjacent_drugs
,
adjacent_disorders
,
fetch_edges
,
create_network
,
load_network
,
get_license
,
get_datasets
# cache time is 6 hours
urlpatterns
=
[
#
path('
n
et
work/', cache_page(21600)(ProteinViralInteractionView.as_view())
),
path
(
'
g
et
_datasets/
'
,
get_datasets
),
path
(
'
map_nodes/
'
,
map_nodes
),
path
(
'
fetch_edges/
'
,
fetch_edges
),
path
(
'
task/
'
,
TaskView
.
as_view
()),
path
(
'
tasks/
'
,
tasks_view
),
path
(
'
task_result/
'
,
result_view
),
path
(
'
graph_export/
'
,
graph_export
),
# path('query_proteins/', query_proteins),
path
(
'
query_tissue_proteins/
'
,
query_tissue_proteins
),
path
(
'
adjacent_drugs/
'
,
adjacent_drugs
),
path
(
'
adjacent_disorders/
'
,
adjacent_disorders
),
# path('drug_interactions/', ProteinDrugInteractionView.as_view()),
path
(
'
tissue_expression/
'
,
TissueExpressionView
.
as_view
()),
path
(
'
tissues/
'
,
TissueView
.
as_view
()),
path
(
'
admin/
'
,
admin
.
site
.
urls
),
...
...
This diff is collapsed.
Click to expand it.
drugstone/views.py
+
9
−
1
View file @
e44fee44
...
...
@@ -231,6 +231,15 @@ def create_network(request) -> Response:
return
Response
(
id
)
@api_view
([
'
GET
'
])
def
get_datasets
(
request
)
->
Response
:
datasets
=
{}
datasets
[
'
protein-protein
'
]
=
PPIDatasetSerializer
(
many
=
True
).
to_representation
(
PPIDataset
.
objects
.
all
())
datasets
[
'
protein-drug
'
]
=
PDIDatasetSerializer
(
many
=
True
).
to_representation
(
PDIDataset
.
objects
.
all
())
datasets
[
'
protein-disorder
'
]
=
PDisDatasetSerializer
(
many
=
True
).
to_representation
(
PDisDataset
.
objects
.
all
())
datasets
[
'
drug-disorder
'
]
=
DrDisDatasetSerializer
(
many
=
True
).
to_representation
(
DrDiDataset
.
objects
.
all
())
return
Response
(
datasets
)
@api_view
([
'
GET
'
])
def
load_network
(
request
)
->
Response
:
network
=
NetworkSerializer
().
to_representation
(
Network
.
objects
.
get
(
id
=
request
.
query_params
.
get
(
'
id
'
)))
...
...
@@ -620,7 +629,6 @@ class TissueView(APIView):
tissues
=
Tissue
.
objects
.
all
()
return
Response
(
TissueSerializer
(
many
=
True
).
to_representation
(
tissues
))
class
TissueExpressionView
(
APIView
):
"""
Expression of host proteins in tissues.
...
...
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