From 5893cd260bb58c420275bc7bfe100b7e783fb3cd Mon Sep 17 00:00:00 2001 From: jvfe Date: Sat, 30 Mar 2024 20:31:01 -0300 Subject: [PATCH] refactor: Fix schema validation when using txt files --- microview/file_finder.py | 4 ++-- microview/schemas/kaiju_report.schema.json | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/microview/file_finder.py b/microview/file_finder.py index 8c2ec55..24d3193 100644 --- a/microview/file_finder.py +++ b/microview/file_finder.py @@ -96,7 +96,7 @@ def detect_report_type(report_paths: List[Path], console) -> List[Sample]: one the report path, the other a string specifying the report type. """ kaiju_validated = [ - get_validation_dict(report, schema=kaiju_report_schema) + get_validation_dict(report, format="tsv", schema=kaiju_report_schema) for report in report_paths ] kaiju_reports = [ @@ -107,7 +107,7 @@ def detect_report_type(report_paths: List[Path], console) -> List[Sample]: # TODO: Improve Kraken validation kraken_validated = [ - get_validation_dict(report, checks=[checks.table_dimensions(num_fields=6)]) + get_validation_dict(report, format="tsv", checks=[checks.table_dimensions(num_fields=6)]) for report in report_paths ] kraken_reports = [ diff --git a/microview/schemas/kaiju_report.schema.json b/microview/schemas/kaiju_report.schema.json index e42a531..7ec9012 100644 --- a/microview/schemas/kaiju_report.schema.json +++ b/microview/schemas/kaiju_report.schema.json @@ -10,25 +10,25 @@ "format": "default", "name": "percent", "type": "number", - "required": false + "required": true }, { "format": "default", "name": "reads", "type": "integer", - "required": false + "required": true }, { "format": "default", "name": "taxon_id", "type": "integer", - "required": false + "required": true }, { "format": "default", "name": "taxon_name", "type": "string", - "required": false + "required": true } ], "missingValues": ["NA"]