aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--quality_control/headers.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/quality_control/headers.py b/quality_control/headers.py
index b8ff160..59d3d77 100644
--- a/quality_control/headers.py
+++ b/quality_control/headers.py
@@ -4,4 +4,13 @@ from quality_control.errors import InvalidHeaderValue
def valid_header(strains, headers):
"Return the valid headers with reference to strains or throw an error"
- return None
+ if not bool(headers[1:]):
+ raise InvalidHeaderValue(
+ "The header MUST contain at least 2 columns")
+ invalid_headers = tuple(
+ header for header in headers[1:] if header not in strains)
+ if invalid_headers:
+ raise InvalidHeaderValue(
+ *(f"'{header}' not a valid strain." for header in invalid_headers))
+
+ return headers