diff options
author | Frederick Muriuki Muriithi | 2024-08-09 14:20:17 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-08-12 09:47:19 -0500 |
commit | 321cb85283dc0a182e86d0ee509cae9ced4e39cd (patch) | |
tree | a05a9cbd98f14d9a27139f99ea4b7f6b0daefcee /r_qtl | |
parent | d29a205d83a3eeba49483cc2f3fd372e461b5a9c (diff) | |
download | gn-uploader-321cb85283dc0a182e86d0ee509cae9ced4e39cd.tar.gz |
Rename module: Module contains exceptions classes.
Diffstat (limited to 'r_qtl')
-rw-r--r-- | r_qtl/exceptions.py (renamed from r_qtl/errors.py) | 2 | ||||
-rw-r--r-- | r_qtl/r_qtl2.py | 6 | ||||
-rw-r--r-- | r_qtl/r_qtl2_qc.py | 6 |
3 files changed, 7 insertions, 7 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}'.") |