Skip to content
Snippets Groups Projects
Commit 11c248c1 authored by Hartung, Michael's avatar Hartung, Michael
Browse files

Merge branch 'master' into 'development'

Master

See merge request !1
parents 4e204083 334c448e
No related branches found
No related tags found
No related merge requests found
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}
%% Cell type:code id:f02bf93e tags:
``` python
from graph_tool.all import *
```
%% Cell type:code id:3f6e4401 tags:
``` python
g = load_graph("data-NetExpander/Networks/internal_STRING_DrugBank.gt")
```
%% Cell type:code id:7caa2dad tags:
``` python
g
```
%% Output
<Graph object, undirected, with 24092 vertices and 226778 edges at 0x7fd1e8732ef0>
%% Cell type:code id:ec03761f tags:
``` python
ids = list(g.vertex_properties["netex_id"])
```
%% Cell type:code id:f7e03bff tags:
``` python
len(ids)
```
%% Output
24092
%% Cell type:code id:17b2813f tags:
``` python
len([x for x in ids if x.startswith('dr')])
```
%% Output
7601
%% Cell type:code id:4c35d260 tags:
``` python
len([x for x in ids if x.startswith('p')])
```
%% Output
16491
%% Cell type:code id:bc0c6ae6 tags:
``` python
'p12627' in list(g.vertex_properties["netex_id"])
```
%% Output
True
%% Cell type:code id:3900f9bb tags:
``` python
import requests
import json
header= { 'Content-Type': 'application/json' }
API = 'https://drugst.one/drugstone_api/'
response = requests.post(API+'map_nodes/', headers=header, verify=False, data=json.dumps({'nodes': [{'id': "APOLD1"}], 'identifier': "symbol"}))
response.json()
```
%% Output
/Users/michi/opt/anaconda3/envs/drugstone/lib/python3.6/site-packages/urllib3/connectionpool.py:1050: InsecureRequestWarning: Unverified HTTPS request is being made to host 'drugst.one'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
InsecureRequestWarning,
[{'id': 'APOLD1',
'netexId': 'p30505',
'uniprotAc': 'Q96LR9',
'symbol': 'APOLD1',
'proteinName': 'Apolipoprotein L domain-containing protein 1',
'entrez': '81575',
'ensg': ['ENSG00000178878']}]
%% Cell type:code id:6de8ed93 tags:
``` python
```
%% Cell type:code id:6407897a tags:
``` python
```
%% Cell type:code id:994c656a tags:
``` python
```
%% Cell type:code id:d7619c0e tags:
``` python
```
%% Cell type:code id:3161b301 tags:
``` python
```
docker build -t gitlab.rrz.uni-hamburg.de:4567/groups/cosy-bio/drugst.one/backend:dev -f ./Dockerfile .
docker push gitlab.rrz.uni-hamburg.de:4567/groups/cosy-bio/drugst.one/backend:dev
\ No newline at end of file
docker build -t gitlab.rrz.uni-hamburg.de:4567/cosy-bio/drugst.one/backend:prod -f ./Dockerfile .
docker push gitlab.rrz.uni-hamburg.de:4567/cosy-bio/drugst.one/backend:prod
\ No newline at end of file
......@@ -4,6 +4,5 @@ python3 manage.py migrate --run-syncdb
python3 manage.py createfixtures
python3 manage.py cleanuptasks
# sh import-data.sh
# python3 manage.py make_graphs
/usr/bin/supervisord -c "/etc/supervisor/conf.d/supervisord.conf"
......@@ -4,4 +4,4 @@ python3 manage.py populate_db -p .
python3 manage.py populate_db --data_dir . --exp_file gene_tissue_expression.gct
python3 manage.py populate_db --data_dir . --drug_file drug-file.txt
python3 manage.py populate_db -pp .
python3 manage.py populate_db -pd .
\ No newline at end of file
python3 manage.py populate_db -pdr .
\ No newline at end of file
......@@ -178,7 +178,6 @@ def fetch_edges(request) -> Response:
"""
dataset = request.data.get('dataset', 'STRING')
netex_ids = [node['netex_id'][1:] for node in request.data.get('nodes', '[]') if 'netex_id' in node]
dataset_object = models.PPIDataset.objects.get(name__iexact=dataset)
interaction_objects = models.ProteinProteinInteraction.objects.filter(
Q(ppi_dataset=dataset_object) & Q(from_protein__in=netex_ids) & Q(to_protein__in=netex_ids))
......
......@@ -37,9 +37,9 @@ def read_graph_tool_graph(file_path, seeds, max_deg, include_indirect_drugs=Fals
The graph indices for all drug nodes
"""
# Read the graph.
gg = gt.load_graph(file_path)
g = gtt.extract_largest_component(gg, directed=False, prune=True) # this line is added since we need to work with the LCC of the graphs for all algorithms
g = gt.load_graph(file_path)
# g = gtt.extract_largest_component(gg, directed=False, prune=True) # this line is added since we need to work with the LCC of the graphs for all algorithms
# drug_protein = "DrugHasTarget"
d_type = "drug"
......@@ -62,10 +62,8 @@ def read_graph_tool_graph(file_path, seeds, max_deg, include_indirect_drugs=Fals
is_matched = {protein: False for protein in seeds}
for node in range(g.num_vertices()):
node_type = g.vertex_properties["type"][node]
# if g.vertex_properties["name"][node] in seeds:
if g.vertex_properties[node_name_attribute][node] in seeds:
seed_ids.append(node)
# is_matched[g.vertex_properties["name"][node]] = True
is_matched[g.vertex_properties[node_name_attribute][node]] = True
if node_type == d_type:
if include_non_approved_drugs:
......@@ -78,7 +76,7 @@ def read_graph_tool_graph(file_path, seeds, max_deg, include_indirect_drugs=Fals
# Check that all seed seeds have been matched and throw error, otherwise.
for protein, found in is_matched.items():
if not found:
raise ValueError("Invalid seed protein {}. No node named {} in {}.".format(protein, protein, file_path))
raise ValueError("Invaliddd seed protein {}. No node named {} in {}.".format(protein, protein, file_path))
# Delete edges that should be ignored or are not contained in the selected dataset.
deleted_edges = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment