aboutsummaryrefslogtreecommitdiff
path: root/gn3/api
diff options
context:
space:
mode:
authorAlexander Kabui2021-04-04 13:33:34 +0300
committerAlexander Kabui2021-04-04 13:33:34 +0300
commit2301b11e8a975f2e6dc7e5144e4b26c34b186501 (patch)
tree3e6815b89bd92fba3be0d339d0205a62f0772616 /gn3/api
parent3dd25f77952f4829af5c19a0b40d221df308a185 (diff)
downloadgenenetwork3-2301b11e8a975f2e6dc7e5144e4b26c34b186501.tar.gz
refactor code for trait data
modify unittest and integration tests for datasets
Diffstat (limited to 'gn3/api')
-rw-r--r--gn3/api/datasets.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/gn3/api/datasets.py b/gn3/api/datasets.py
index d15aad7..70ee3a1 100644
--- a/gn3/api/datasets.py
+++ b/gn3/api/datasets.py
@@ -3,6 +3,8 @@ from flask import Blueprint
from flask import jsonify
from gn3.computations.datasets import create_dataset
+from gn3.computations.datasets import get_traits_data
+from gn3.experimental_db import database_connector
dataset = Blueprint("dataset", __name__)
@@ -33,7 +35,17 @@ def fetch_traits_data(dataset_name, dataset_type):
"""endpoints fetches sample for each trait in\
a dataset"""
# what actually brings speed issues in correlation
- _query_values = dataset_name, dataset_type
-
- return jsonify({})
- \ No newline at end of file
+ sample_ids = [4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15,
+ 17, 18, 19, 20, 21, 22, 24, 25, 26, 28, 29, 30, 31,
+ 35, 36, 37, 39, 98, 99, 100, 103, 487, 105, 106, 110, 115,
+ 116, 117, 118, 119, 120, 919, 147,
+ 121, 40, 41, 124, 125, 128, 135, 129, 130, 131,
+ 132, 134, 138, 139, 140, 141, 142, 144,
+ 145, 148, 149, 920, 922, 2, 3, 1, 1100]
+
+ conn, _cursor = database_connector()
+ results = get_traits_data(sample_ids=sample_ids, database_instance=conn,
+ dataset_name=dataset_name, dataset_type=dataset_type)
+ conn.close()
+
+ return jsonify({"results": results})