aboutsummaryrefslogtreecommitdiff
path: root/r_qtl/r_qtl2_qc.py
diff options
context:
space:
mode:
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))