about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--quality_control/checks.py12
-rw-r--r--scripts/load_phenotypes_to_db.py3
-rw-r--r--scripts/rqtl2/phenotypes_qc.py3
3 files changed, 13 insertions, 5 deletions
diff --git a/quality_control/checks.py b/quality_control/checks.py
index bb05e31..f01bdd4 100644
--- a/quality_control/checks.py
+++ b/quality_control/checks.py
@@ -4,7 +4,11 @@ from typing import Optional
 
 from .errors import InvalidValue
 
-def decimal_places_pattern(mini: int, maxi: Optional[int] = None) -> re.Pattern:
+def decimal_places_pattern(
+        mini: int,
+        maxi: Optional[int] = None,
+        allow_negative_values: bool = False
+) -> re.Pattern:
     """
     Generate a regular expression for checking numbers
 
@@ -40,8 +44,10 @@ def decimal_places_pattern(mini: int, maxi: Optional[int] = None) -> re.Pattern:
         raise ValueError(*exc.args) from exc
 
     return re.compile(
-        r"^("
-        r"0+" # All zeroes, no decimal places
+        r"^"
+        + (r"-?" if allow_negative_values else r"")
+        + r"("
+        + r"0+" # All zeroes, no decimal places
         + r"|0+\.0+" # 0.00…
         + r"|[0-9]+\.?0*" # Whole numbers, or all zeroes after decimal point
         + r"|[0-9]+\.[0-9]{"
diff --git a/scripts/load_phenotypes_to_db.py b/scripts/load_phenotypes_to_db.py
index 31eb715..72cd641 100644
--- a/scripts/load_phenotypes_to_db.py
+++ b/scripts/load_phenotypes_to_db.py
@@ -212,7 +212,8 @@ def update_auth(# pylint: disable=[too-many-locals,too-many-positional-arguments
     _delay = 1
     headers = {
         "Authorization": f"Bearer {token}",
-        "Content-Type": "application/json"
+        "Content-Type": "application/json",
+        "Accept": "application/json"
     }
     def authserveruri(endpoint):
         return urljoin(authserver, endpoint)
diff --git a/scripts/rqtl2/phenotypes_qc.py b/scripts/rqtl2/phenotypes_qc.py
index 084c876..e65bbcc 100644
--- a/scripts/rqtl2/phenotypes_qc.py
+++ b/scripts/rqtl2/phenotypes_qc.py
@@ -252,7 +252,8 @@ def decimal_points_error(# pylint: disable=[too-many-arguments,too-many-position
         decimal_places: int = 1
 ) -> Optional[InvalidValue]:
     """Returns an error if the value does not meet the checks."""
-    if not bool(decimal_places_pattern(decimal_places).match(cellvalue)):
+    if not bool(decimal_places_pattern(
+            decimal_places, allow_negative_values=True).match(cellvalue)):
         return InvalidValue(filename, rowtitle, coltitle, cellvalue, message)
     return None