From deca94c7b473ec79c5e5cee3d6caeb3c3885bd74 Mon Sep 17 00:00:00 2001
From: Arun Isaac
Date: Thu, 23 Dec 2021 13:40:31 +0530
Subject: db: Fix wrong continued indentation.
* gn3/db/datasets.py (dataset_metadata): Fix wrong continued indentation.
---
gn3/db/datasets.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'gn3/db')
diff --git a/gn3/db/datasets.py b/gn3/db/datasets.py
index c50e148..788e9cf 100644
--- a/gn3/db/datasets.py
+++ b/gn3/db/datasets.py
@@ -328,7 +328,7 @@ WHERE {
OPTIONAL { ?dataset gn:geoSeries ?geo_series } .
}
""",
- """
+ """
PREFIX gn:
SELECT ?platform_name ?normalization_name ?species_name ?inbred_set_name ?tissue_name
WHERE {
@@ -341,7 +341,7 @@ WHERE {
OPTIONAL { ?dataset gn:datasetOfPlatform / gn:name ?platform_name } .
}
""",
- """
+ """
PREFIX gn:
SELECT ?specifics ?summary ?about_cases ?about_tissue ?about_platform
?about_data_processing ?notes ?experiment_design ?contributors
--
cgit v1.2.3
From 36cc8b1f837406d7002246c00d6054573687c472 Mon Sep 17 00:00:00 2001
From: Arun Isaac
Date: Thu, 23 Dec 2021 13:57:04 +0530
Subject: db: Fix sparql_query return type.
* gn3/db/datasets.py: Import List from typing.
(sparql_query): Set return type to List[Dict[str, Any]].
---
gn3/db/datasets.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'gn3/db')
diff --git a/gn3/db/datasets.py b/gn3/db/datasets.py
index 788e9cf..ca48156 100644
--- a/gn3/db/datasets.py
+++ b/gn3/db/datasets.py
@@ -3,7 +3,7 @@ This module contains functions relating to specific trait dataset manipulation
"""
import re
from string import Template
-from typing import Any, Dict, Optional
+from typing import Any, Dict, List, Optional
from SPARQLWrapper import JSON, SPARQLWrapper
from gn3.settings import SPARQL_ENDPOINT
@@ -297,7 +297,7 @@ def retrieve_trait_dataset(trait_type, trait, threshold, conn):
**group
}
-def sparql_query(query: str) -> Dict[str, Any]:
+def sparql_query(query: str) -> List[Dict[str, Any]]:
"""Run a SPARQL query and return the bound variables."""
sparql = SPARQLWrapper(SPARQL_ENDPOINT)
sparql.setQuery(query)
--
cgit v1.2.3
From fa227ea35710658c7d8314315ee072a641c163f9 Mon Sep 17 00:00:00 2001
From: Arun Isaac
Date: Thu, 23 Dec 2021 13:58:07 +0530
Subject: db: Assist mypy with explicit type declaration.
* gn3/db/datasets.py (dataset_metadata): Assist mypy by explicitly declaring
type of return dictionary.
---
gn3/db/datasets.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'gn3/db')
diff --git a/gn3/db/datasets.py b/gn3/db/datasets.py
index ca48156..a41e228 100644
--- a/gn3/db/datasets.py
+++ b/gn3/db/datasets.py
@@ -362,8 +362,8 @@ WHERE {
OPTIONAL { ?dataset gn:acknowledgment ?acknowledgment . }
}
"""]
- result = {'accession_id': accession_id,
- 'investigator': {}}
+ result: Dict[str, Any] = {'accession_id': accession_id,
+ 'investigator': {}}
query_result = {}
for query in queries:
if sparql_result := sparql_query(Template(query).substitute(accession_id=accession_id)):
--
cgit v1.2.3