diff --git a/docker-django.env.dev b/docker-django.env.dev index 6f5a0768cac65171888416141f73740ab006f0ad..91d6c04b8f6b37a168562414a91cbc79cff2a676 100644 --- a/docker-django.env.dev +++ b/docker-django.env.dev @@ -15,4 +15,4 @@ CELERY_BROKER_URL=redis://redis:6379/0 FLOWER_PORT=8888 FLOWER_BASIC_AUTH=drugstone:test GT_THREADS=2 -DB_UPDATE_ON_START=1 \ No newline at end of file +DB_UPDATE_ON_START=0 \ No newline at end of file diff --git a/drugstone/views.py b/drugstone/views.py index 878eb0bf6ca7145b385b33ace511cf5ed70d410c..e6b20cfde2604df02d5b31698c4daa8f3866e060 100755 --- a/drugstone/views.py +++ b/drugstone/views.py @@ -291,7 +291,9 @@ def result_view(request) -> Response: if not node_types: node_types = {} node_attributes['node_types'] = node_types + is_seed = node_attributes.get('is_seed') + print(result) if not is_seed: is_seed = {} node_attributes['is_seed'] = is_seed diff --git a/tasks/quick_task.py b/tasks/quick_task.py index 899674d8e327360e85b9844439d63300edaf2a0c..a49536e512c7479990cee36221f04dac77fda790 100755 --- a/tasks/quick_task.py +++ b/tasks/quick_task.py @@ -1,7 +1,8 @@ from tasks.task_hook import TaskHook + def quick_task(task_hook: TaskHook): - def run_closeness(parameters, network): + def run_closeness(parameters, network, original_seeds=None): from .closeness_centrality import closeness_centrality def closeness_progress(progress, status): @@ -9,6 +10,8 @@ def quick_task(task_hook: TaskHook): def closeness_set_result(result): result["network"]["edges"].extend(network["edges"]) + if original_seeds is not None: + result['node_attributes']['is_seed'] = original_seeds task_hook.set_results(result) # Prepare intermediate hook @@ -20,7 +23,6 @@ def quick_task(task_hook: TaskHook): # Run closeness centrality closeness_centrality(closeness_task_hook) - def run_multi_steiner(parameters): from .multi_steiner import multi_steiner @@ -35,7 +37,7 @@ def quick_task(task_hook: TaskHook): if len(seeds) == 0: task_hook.set_results({"network": {"nodes": [], "edges": []}}) return - + og_seeds = parameters.get('seeds') parameters.update({ "seeds": seeds, "result_size": 10, @@ -43,7 +45,11 @@ def quick_task(task_hook: TaskHook): "target": "drug", "include_non_approved_drugs": True }) - run_closeness(parameters, result["network"]) + is_seed = result.get('node_attributes') + run_closeness(parameters, result["network"], result['node_attributes']['is_seed']) + # parameters.update({ + # "seeds": og_seeds + # }) parameters["num_trees"] = 1 parameters["hub_penalty"] = 1