diff --git a/bactopia/cli/summary.py b/bactopia/cli/summary.py index 42d08a6..cfa2e87 100644 --- a/bactopia/cli/summary.py +++ b/bactopia/cli/summary.py @@ -404,14 +404,14 @@ def summary( dfs.append(df) logging.debug(f"\tRank: {rank} ({reason})") else: - logging.debug( + logging.info( f"Skipping {sample['id']} ({sample['path']}) due to missing files. Missing:" ) for missing_file in parsable_files: - logging.debug(f"\t{missing_file}") + logging.info(f"\t{missing_file}") increment_and_append("ignore-unknown", sample["id"]) else: - logging.debug( + logging.info( f"Skipping {sample['id']} ({sample['path']}), incomplete or not a Bactopia directory" ) increment_and_append("ignore-unknown", sample["id"]) diff --git a/bactopia/parsers/annotator.py b/bactopia/parsers/annotator.py index 47335ec..38c4d07 100644 --- a/bactopia/parsers/annotator.py +++ b/bactopia/parsers/annotator.py @@ -57,7 +57,8 @@ def _parse_annotation(path: str, name: str) -> dict: with open(path, "rt") as fh: for line in fh: line = line.rstrip() - key, val = line.split(":") - if key in COLS: - results[f"annotator_total_{key}"] = int(val.lstrip()) + if ":" in line: + key, val = line.split(":") + if key in COLS: + results[f"annotator_total_{key}"] = int(val.lstrip()) return results diff --git a/bactopia/parsers/parsables.py b/bactopia/parsers/parsables.py index 510d545..99f00ac 100644 --- a/bactopia/parsers/parsables.py +++ b/bactopia/parsers/parsables.py @@ -1,6 +1,7 @@ """ A list of files that can be parsed by Bactopia """ +import logging from pathlib import Path EXCLUDE_COLUMNS = [ @@ -24,8 +25,6 @@ def get_parsable_files(path: str, name: str) -> list: parsable_files = { # main - # annotator - f"{path}/main/annotator/prokka/{name}.txt": "annotator", # assembler f"{path}/main/assembler/{name}.tsv": "assembler", # gather @@ -49,14 +48,23 @@ def get_parsable_files(path: str, name: str) -> list: # Check annotation files seperately, since Prokka or Bakta can be used if Path(f"{path}/main/annotator/bakta/{name}.txt").exists(): + logging.debug( + f"Found Bakta annotation file: {path}/main/annotator/bakta/{name}.txt" + ) parsable_files[f"{path}/main/annotator/bakta/{name}.txt"] = "annotator" elif Path(f"{path}/main/annotator/prokka/{name}.txt").exists(): + logging.debug( + f"Found Prokka annotation file: {path}/main/annotator/prokka/{name}.txt" + ) parsable_files[f"{path}/main/annotator/prokka/{name}.txt"] = "annotator" else: is_complete = False missing_files.append(f"{path}/main/annotator/prokka/{name}.txt") missing_files.append(f"{path}/main/annotator/bakta/{name}.txt") + logging.debug(f"Missing Files: {missing_files}") + logging.debug(f"Is Complete: {is_complete}") + if is_complete: parsable_files[f"{path}/main/qc/summary/{name}-original.json"] = "qc" parsable_files[f"{path}/main/qc/summary/{name}-final.json"] = "qc"