aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-08-09 14:20:17 -0500
committerFrederick Muriuki Muriithi2024-08-12 09:47:19 -0500
commit321cb85283dc0a182e86d0ee509cae9ced4e39cd (patch)
treea05a9cbd98f14d9a27139f99ea4b7f6b0daefcee
parentd29a205d83a3eeba49483cc2f3fd372e461b5a9c (diff)
downloadgn-uploader-321cb85283dc0a182e86d0ee509cae9ced4e39cd.tar.gz
Rename module: Module contains exceptions classes.
-rw-r--r--r_qtl/exceptions.py (renamed from r_qtl/errors.py)2
-rw-r--r--r_qtl/r_qtl2.py6
-rw-r--r--r_qtl/r_qtl2_qc.py6
-rw-r--r--scripts/process_rqtl2_bundle.py2
-rw-r--r--scripts/qc_on_rqtl2_bundle.py4
5 files changed, 10 insertions, 10 deletions
diff --git a/r_qtl/errors.py b/r_qtl/exceptions.py
index 417eb58..9620cf4 100644
--- a/r_qtl/errors.py
+++ b/r_qtl/exceptions.py
@@ -6,7 +6,7 @@ class RQTLError(Exception):
class InvalidFormat(RQTLError):
"""Raised when the format of the file(s) is invalid."""
-class MissingFileError(InvalidFormat):
+class MissingFileException(InvalidFormat):
"""
Raise when at least one file listed in the control file is missing from the
R/qtl2 bundle.
diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py
index c2e1148..c6282c5 100644
--- a/r_qtl/r_qtl2.py
+++ b/r_qtl/r_qtl2.py
@@ -11,7 +11,7 @@ import yaml
from functional_tools import take, chain
-from r_qtl.errors import InvalidFormat, MissingFileError
+from r_qtl.exceptions import InvalidFormat, MissingFileException
FILE_TYPES = (
"geno", "founder_geno", "pheno", "covar", "phenocovar", "gmap", "pmap",
@@ -157,7 +157,7 @@ def control_data(control_src: Union[Path, ZipFile]) -> dict:
Raises
------
- r_qtl.errors.InvalidFormat
+ r_qtl.exceptions.InvalidFormat
"""
if isinstance(control_src, ZipFile):
return __control_data_from_zipfile__(control_src)
@@ -382,7 +382,7 @@ def file_data(zfile: ZipFile,
zfile, member_key, cdata, process_transposed_value):
yield row
except KeyError as exc:
- raise MissingFileError(*exc.args) from exc
+ raise MissingFileException(*exc.args) from exc
def cross_information(zfile: ZipFile, cdata: dict) -> Iterator[dict]:
"""Load cross information where present."""
diff --git a/r_qtl/r_qtl2_qc.py b/r_qtl/r_qtl2_qc.py
index be1eac4..7e93d23 100644
--- a/r_qtl/r_qtl2_qc.py
+++ b/r_qtl/r_qtl2_qc.py
@@ -3,8 +3,8 @@ from zipfile import ZipFile
from functools import reduce, partial
from typing import Union, Iterator, Optional, Callable
-from r_qtl import errors as rqe
from r_qtl import r_qtl2 as rqtl2
+from r_qtl import exceptions as rqe
from r_qtl.r_qtl2 import FILE_TYPES
from r_qtl.fileerrors import MissingFile
@@ -59,7 +59,7 @@ def validate_bundle(zfile: ZipFile):
"""Ensure the R/qtl2 bundle is valid."""
missing = missing_files(zfile)
if len(missing) > 0:
- raise rqe.MissingFileError(
+ raise rqe.MissingFileException(
"The following files do not exist in the bundle: " +
", ".join(mfile[1] for mfile in missing))
@@ -111,6 +111,6 @@ def retrieve_errors(zfile: ZipFile, filetype: str, checkers: tuple[Callable]) ->
if value is not None:
for checker in checkers:
yield checker(lineno=lineno, field=field, value=value)
- except rqe.MissingFileError:
+ except rqe.MissingFileException:
fname = cdata.get(filetype)
yield MissingFile(filetype, fname, f"Missing '{filetype}' file '{fname}'.")
diff --git a/scripts/process_rqtl2_bundle.py b/scripts/process_rqtl2_bundle.py
index a7e169d..20cfd3b 100644
--- a/scripts/process_rqtl2_bundle.py
+++ b/scripts/process_rqtl2_bundle.py
@@ -13,9 +13,9 @@ from redis import Redis
from functional_tools import take
-import r_qtl.errors as rqe
import r_qtl.r_qtl2 as rqtl2
import r_qtl.r_qtl2_qc as rqc
+import r_qtl.exceptions as rqe
from uploader import jobs
from uploader.db_utils import database_connection
diff --git a/scripts/qc_on_rqtl2_bundle.py b/scripts/qc_on_rqtl2_bundle.py
index 7784c06..fc95d13 100644
--- a/scripts/qc_on_rqtl2_bundle.py
+++ b/scripts/qc_on_rqtl2_bundle.py
@@ -20,9 +20,9 @@ from uploader import jobs
from uploader.db_utils import database_connection
from uploader.check_connections import check_db, check_redis
-from r_qtl import errors as rqe
from r_qtl import r_qtl2 as rqtl2
from r_qtl import r_qtl2_qc as rqc
+from r_qtl import exceptions as rqe
from r_qtl import fileerrors as rqfe
from scripts.process_rqtl2_bundle import parse_job
@@ -105,7 +105,7 @@ def retrieve_errors_with_progress(rconn: Redis,#pylint: disable=[too-many-locals
__update_processed__(value)
rconn.hset(fqjobid, f"{filetype}-linecount", count)
- except rqe.MissingFileError:
+ except rqe.MissingFileException:
fname = cdata.get(filetype)
yield rqfe.MissingFile(filetype, fname, (
f"The file '{fname}' does not exist in the bundle despite it being "