diff options
| author | Alexander_Kabui | 2025-01-23 13:55:00 +0300 |
|---|---|---|
| committer | BonfaceKilz | 2025-02-06 12:43:15 +0300 |
| commit | c708837c622645091ca4e34b2bf2e462052ab47d (patch) | |
| tree | 8ec7cd0789852d173e809b6de05737e9858c541d /gn3/computations/rqtl2.py | |
| parent | 39f0fe344eb63d70b3dde4065694fbe94f0fc2e9 (diff) | |
| download | genenetwork3-c708837c622645091ca4e34b2bf2e462052ab47d.tar.gz | |
feat: Add function to validate list of keys in object.
Diffstat (limited to 'gn3/computations/rqtl2.py')
| -rw-r--r-- | gn3/computations/rqtl2.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gn3/computations/rqtl2.py b/gn3/computations/rqtl2.py index 4e72322..6e8e06a 100644 --- a/gn3/computations/rqtl2.py +++ b/gn3/computations/rqtl2.py @@ -40,3 +40,12 @@ def write_to_csv(work_dir, file_name, data:list[dict], for row in data: writer.writerow(row) return file_path + + +def validate_required_keys(required_keys:list, data:dict) -> tuple[bool, str]: + """Check for missing keys in data object""" + missing_keys = [key for key in required_keys if key not in data] + if missing_keys: + return False, f"Required key(s) missing: {', '.join(missing_keys)}" + return True, "" + |
