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
4ae5d2b0
Commit
4ae5d2b0
authored
2 years ago
by
AndiMajore
Browse files
Options
Downloads
Patches
Plain Diff
remove unconnected nodes from gt files
parent
a3dc5740
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
drugstone/management/commands/make_graphs.py
+13
-2
13 additions, 2 deletions
drugstone/management/commands/make_graphs.py
scripts/docker-entrypoint.sh
+2
-3
2 additions, 3 deletions
scripts/docker-entrypoint.sh
with
15 additions
and
5 deletions
drugstone/management/commands/make_graphs.py
+
13
−
2
View file @
4ae5d2b0
...
...
@@ -13,6 +13,7 @@ django.setup()
KERNEL
=
6
def
_internal_expression_scores
(
drugstone_id
:
str
)
->
dict
:
"""
Looks up the tissue specific expression scores for a given protein.
The scores are loaded from the django database.
...
...
@@ -38,6 +39,7 @@ def _internal_expression_scores(drugstone_id: str) -> dict:
return
tissue_scores
def
_internal_pdis
(
dataset_name
:
str
)
->
List
[
dict
]:
"""
Fetches all internal protein-drug interactions for a given dataset.
Interactions are taken from the django database.
...
...
@@ -57,6 +59,7 @@ def _internal_pdis(dataset_name: str) -> List[dict]:
return
node_node_interactions
def
_internal_ppis
(
dataset_name
:
str
)
->
List
[
dict
]:
"""
Fetches all internal protein-protein interactions for a given dataset.
Interactions are taken from the django database.
...
...
@@ -92,7 +95,7 @@ def create_gt(params: Tuple[str, str]) -> None:
print
(
f
'
loading nodes
'
)
data
[
'
nodes
'
]
=
serializers
.
ProteinSerializer
(
many
=
True
).
to_representation
(
models
.
Protein
.
objects
.
all
()
)
)
print
(
f
'
loading edges/
{
ppi_dataset
}
'
)
data
[
'
edges
'
]
=
_internal_ppis
(
ppi_dataset
)
...
...
@@ -100,7 +103,7 @@ def create_gt(params: Tuple[str, str]) -> None:
print
(
f
'
loading drugs
'
)
data
[
'
drugs
'
]
=
serializers
.
DrugSerializer
(
many
=
True
).
to_representation
(
models
.
Drug
.
objects
.
all
()
)
)
print
(
f
'
loading drug_edges/
{
pdi_dataset
}
'
)
data
[
'
drug_edges
'
]
=
_internal_pdis
(
pdi_dataset
)
...
...
@@ -175,6 +178,14 @@ def create_gt(params: Tuple[str, str]) -> None:
e_type
[
e
]
=
'
drug-protein
'
print
(
"
done with drug edges
"
)
# remove unconnected nodes
delete_vertices
=
set
()
for
vertex
in
g
.
iter_vertices
():
if
vertex
.
out_degree
()
==
0
:
delete_vertices
.
add
(
vertex
)
g
.
remove_vertex
(
reversed
(
sorted
(
delete_vertices
)),
fast
=
True
)
# save graph
filename
=
f
"
./data/Networks/internal_
{
ppi_dataset
}
_
{
pdi_dataset
}
.gt
"
g
.
save
(
filename
)
...
...
This diff is collapsed.
Click to expand it.
scripts/docker-entrypoint.sh
+
2
−
3
View file @
4ae5d2b0
...
...
@@ -4,8 +4,7 @@ python3 manage.py makemigrations drugstone
python3 manage.py migrate
python3 manage.py createfixtures
python3 manage.py cleanuptasks
python3 manage.py populate_db
--update
-p
#python3 manage.py populate_db --update -a
#python3 manage.py make_graphs
python3 manage.py populate_db
--update
-a
python3 manage.py make_graphs
/usr/bin/supervisord
-c
"/etc/supervisor/conf.d/supervisord.conf"
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