aboutsummaryrefslogtreecommitdiff
path: root/r_qtl/r_qtl2_qc.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-02-05 07:00:01 +0300
committerFrederick Muriuki Muriithi2024-02-05 07:00:01 +0300
commitab71b34b97f3f1eee52b5688f41644541535f281 (patch)
tree4ae94d1957a62bd739203eddc4c157d2701461e4 /r_qtl/r_qtl2_qc.py
parent635cf832f4717da6e8e7ef273a675a4ceea42ed0 (diff)
downloadgn-uploader-ab71b34b97f3f1eee52b5688f41644541535f281.tar.gz
Do general bundle validation and show errors
* Display any and all errors on the UI * Move `validate_bundle` to QC module and refactor to use `missing_files`
Diffstat (limited to 'r_qtl/r_qtl2_qc.py')
-rw-r--r--r_qtl/r_qtl2_qc.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/r_qtl/r_qtl2_qc.py b/r_qtl/r_qtl2_qc.py
index f666f40..261d300 100644
--- a/r_qtl/r_qtl2_qc.py
+++ b/r_qtl/r_qtl2_qc.py
@@ -3,6 +3,7 @@ from zipfile import ZipFile
from functools import reduce
from typing import Union, Sequence
+from r_qtl import errors as rqe
from r_qtl import r_qtl2 as rqtl2
from r_qtl.r_qtl2 import __FILE_TYPES__
@@ -45,3 +46,11 @@ def missing_files(zfile: ZipFile) -> tuple[str]:
return tuple(filter(__missing_p__,
bundle_files_list(zfile, rqtl2.control_data(zfile))))
+
+def validate_bundle(zfile: ZipFile):
+ """Ensure the R/qtl2 bundle is valid."""
+ missing = missing_files(zfile)
+ if len(missing) > 0:
+ raise rqe.MissingFileError(
+ "The following files do not exist in the bundle: " +
+ ", ".join(missing))