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
6115cbe1
Commit
6115cbe1
authored
2 years ago
by
AndiMajore
Browse files
Options
Downloads
Patches
Plain Diff
small change
parent
1186a343
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
drugstone/views.py
+10
-9
10 additions, 9 deletions
drugstone/views.py
with
10 additions
and
9 deletions
drugstone/views.py
+
10
−
9
View file @
6115cbe1
import
csv
import
csv
import
json
import
random
import
random
import
string
import
string
import
time
import
time
...
@@ -7,7 +6,6 @@ import uuid
...
@@ -7,7 +6,6 @@ import uuid
from
collections
import
defaultdict
from
collections
import
defaultdict
import
pandas
as
pd
import
pandas
as
pd
from
typing
import
Tuple
import
networkx
as
nx
import
networkx
as
nx
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
...
@@ -232,7 +230,7 @@ def create_network(request) -> Response:
...
@@ -232,7 +230,7 @@ def create_network(request) -> Response:
@api_view
([
'
GET
'
])
@api_view
([
'
GET
'
])
def
get_datasets
(
request
)
->
Response
:
def
get_datasets
(
request
)
->
Response
:
datasets
=
{}
datasets
=
{}
datasets
[
'
protein-protein
'
]
=
PPIDatasetSerializer
(
many
=
True
).
to_representation
(
PPIDataset
.
objects
.
all
())
datasets
[
'
protein-protein
'
]
=
PPIDatasetSerializer
(
many
=
True
).
to_representation
(
PPIDataset
.
objects
.
all
())
datasets
[
'
protein-drug
'
]
=
PDIDatasetSerializer
(
many
=
True
).
to_representation
(
PDIDataset
.
objects
.
all
())
datasets
[
'
protein-drug
'
]
=
PDIDatasetSerializer
(
many
=
True
).
to_representation
(
PDIDataset
.
objects
.
all
())
...
@@ -240,6 +238,7 @@ def get_datasets(request)->Response:
...
@@ -240,6 +238,7 @@ def get_datasets(request)->Response:
datasets
[
'
drug-disorder
'
]
=
DrDisDatasetSerializer
(
many
=
True
).
to_representation
(
DrDiDataset
.
objects
.
all
())
datasets
[
'
drug-disorder
'
]
=
DrDisDatasetSerializer
(
many
=
True
).
to_representation
(
DrDiDataset
.
objects
.
all
())
return
Response
(
datasets
)
return
Response
(
datasets
)
@api_view
([
'
GET
'
])
@api_view
([
'
GET
'
])
def
load_network
(
request
)
->
Response
:
def
load_network
(
request
)
->
Response
:
network
=
NetworkSerializer
().
to_representation
(
Network
.
objects
.
get
(
id
=
request
.
query_params
.
get
(
'
id
'
)))
network
=
NetworkSerializer
().
to_representation
(
Network
.
objects
.
get
(
id
=
request
.
query_params
.
get
(
'
id
'
)))
...
@@ -366,7 +365,8 @@ def result_view(request) -> Response:
...
@@ -366,7 +365,8 @@ def result_view(request) -> Response:
detail
[
'
symbol
'
]
=
list
(
set
(
detail
[
'
symbol
'
]))
detail
[
'
symbol
'
]
=
list
(
set
(
detail
[
'
symbol
'
]))
detail
[
'
entrez
'
]
=
list
(
set
(
detail
[
'
entrez
'
]))
detail
[
'
entrez
'
]
=
list
(
set
(
detail
[
'
entrez
'
]))
detail
[
'
uniprot_ac
'
]
=
list
(
set
(
detail
[
'
uniprot_ac
'
]))
detail
[
'
uniprot_ac
'
]
=
list
(
set
(
detail
[
'
uniprot_ac
'
]))
detail
[
'
ensg
'
]
=
list
(
set
(
detail
[
'
ensg
'
]))
if
'
ensg
'
in
detail
:
detail
[
'
ensg
'
]
=
list
(
set
(
detail
[
'
ensg
'
]))
edges
=
parameters
[
'
input_network
'
][
'
edges
'
]
edges
=
parameters
[
'
input_network
'
][
'
edges
'
]
edge_endpoint_ids
=
set
()
edge_endpoint_ids
=
set
()
...
@@ -400,11 +400,11 @@ def result_view(request) -> Response:
...
@@ -400,11 +400,11 @@ def result_view(request) -> Response:
map
(
lambda
n
:
{
"
from
"
:
f
'
p
{
n
.
from_protein_id
}
'
,
"
to
"
:
f
'
p
{
n
.
to_protein_id
}
'
},
interaction_objects
))
map
(
lambda
n
:
{
"
from
"
:
f
'
p
{
n
.
from_protein_id
}
'
,
"
to
"
:
f
'
p
{
n
.
to_protein_id
}
'
},
interaction_objects
))
edges
.
extend
(
auto_edges
)
edges
.
extend
(
auto_edges
)
result
[
'
network
'
][
'
edges
'
].
extend
(
edges
)
result
[
'
network
'
][
'
edges
'
].
extend
(
edges
)
#
uniq_edges = dict()
uniq_edges
=
dict
()
#
for edge in result['network']['edges']:
for
edge
in
result
[
'
network
'
][
'
edges
'
]:
#
hash = edge['from'] + edge['to']
hash
=
edge
[
'
from
'
]
+
edge
[
'
to
'
]
#
uniq_edges[hash] = edge
uniq_edges
[
hash
]
=
edge
#
result['network']['edges']
=
list(uniq_edges.values())
result
[
'
network
'
][
'
edges
'
]
=
list
(
uniq_edges
.
values
())
# result['network']['nodes'] = list(identifier_nodes)
# result['network']['nodes'] = list(identifier_nodes)
if
'
scores
'
in
result
[
'
node_attributes
'
]:
if
'
scores
'
in
result
[
'
node_attributes
'
]:
del
result
[
'
node_attributes
'
][
'
scores
'
]
del
result
[
'
node_attributes
'
][
'
scores
'
]
...
@@ -629,6 +629,7 @@ class TissueView(APIView):
...
@@ -629,6 +629,7 @@ class TissueView(APIView):
tissues
=
Tissue
.
objects
.
all
()
tissues
=
Tissue
.
objects
.
all
()
return
Response
(
TissueSerializer
(
many
=
True
).
to_representation
(
tissues
))
return
Response
(
TissueSerializer
(
many
=
True
).
to_representation
(
tissues
))
class
TissueExpressionView
(
APIView
):
class
TissueExpressionView
(
APIView
):
"""
"""
Expression of host proteins in tissues.
Expression of host proteins in tissues.
...
...
This diff is collapsed.
Click to expand it.
Maier, Andreas
@bba1660
mentioned in commit
3940fd1a
·
1 year ago
mentioned in commit
3940fd1a
mentioned in commit 3940fd1ade6ee08bf78b05bad78e1f70e80e4322
Toggle commit list
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