aboutsummaryrefslogtreecommitdiff
path: root/quality_control
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-04-27 17:37:22 +0300
committerFrederick Muriuki Muriithi2022-04-27 17:37:22 +0300
commit903af1c0b1f2cc695ea4e0c31438f9205571d15d (patch)
tree08b32ee9676bd8ed2456b39895333fdff45b0dd2 /quality_control
parentea70b7a7db42d51fa7f22f3dcb6d2aca6d8a795d (diff)
downloadgn-uploader-903af1c0b1f2cc695ea4e0c31438f9205571d15d.tar.gz
Implement command-line interface for QC of files
Diffstat (limited to 'quality_control')
-rw-r--r--quality_control/average.py2
-rw-r--r--quality_control/parsing.py3
-rw-r--r--quality_control/standard_error.py2
3 files changed, 3 insertions, 4 deletions
diff --git a/quality_control/average.py b/quality_control/average.py
index 3261e1c..2907b9c 100644
--- a/quality_control/average.py
+++ b/quality_control/average.py
@@ -8,6 +8,6 @@ def valid_value(val):
if re.search(r"^[0-9]+\.[0-9]{3}$", val):
return float(val)
raise InvalidCellValue(
- f"Invalid value '{val}'.\n"
+ f"Invalid value '{val}'. "
"Expected string representing a number with exactly three decimal "
"places.")
diff --git a/quality_control/parsing.py b/quality_control/parsing.py
index a4edb0f..9fe88f1 100644
--- a/quality_control/parsing.py
+++ b/quality_control/parsing.py
@@ -62,7 +62,7 @@ def parse_file(filepath: str, filetype: FileType, strains: list):
with open(filepath, encoding="utf-8") as input_file:
for line_number, line in enumerate(input_file):
if line_number == 0:
- yield __parse_header(line, strains)
+ yield __parse_header(line, strains), seek_pos + len(line)
seek_pos = seek_pos + len(line)
continue
@@ -83,7 +83,6 @@ def parse_file(filepath: str, filetype: FileType, strains: list):
def parse_errors(filepath: str, filetype: FileType, strains: list,
seek_pos: int = 0) -> Generator:
"""Retrieve ALL the parse errors"""
- print(f"seek_pos: {seek_pos}, {type(seek_pos)}")
assert seek_pos >= 0, "The seek position must be at least zero (0)"
def __error_type(error):
diff --git a/quality_control/standard_error.py b/quality_control/standard_error.py
index 805c30e..f1e33c4 100644
--- a/quality_control/standard_error.py
+++ b/quality_control/standard_error.py
@@ -8,6 +8,6 @@ def valid_value(val):
if re.search(r"^[0-9]+\.[0-9]{6,}$", val):
return float(val)
raise InvalidCellValue(
- f"Invalid value '{val}'.\n"
+ f"Invalid value '{val}'. "
"Expected string representing a number with at least six decimal "
"places.")