Skip to content

Commit b8a9883

Browse files
committed
fix annotation and adjust logging level of a few messages
1 parent 36e9b13 commit b8a9883

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

bactopia/cli/summary.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,14 +404,14 @@ def summary(
404404
dfs.append(df)
405405
logging.debug(f"\tRank: {rank} ({reason})")
406406
else:
407-
logging.debug(
407+
logging.info(
408408
f"Skipping {sample['id']} ({sample['path']}) due to missing files. Missing:"
409409
)
410410
for missing_file in parsable_files:
411-
logging.debug(f"\t{missing_file}")
411+
logging.info(f"\t{missing_file}")
412412
increment_and_append("ignore-unknown", sample["id"])
413413
else:
414-
logging.debug(
414+
logging.info(
415415
f"Skipping {sample['id']} ({sample['path']}), incomplete or not a Bactopia directory"
416416
)
417417
increment_and_append("ignore-unknown", sample["id"])

bactopia/parsers/annotator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def _parse_annotation(path: str, name: str) -> dict:
5757
with open(path, "rt") as fh:
5858
for line in fh:
5959
line = line.rstrip()
60-
key, val = line.split(":")
61-
if key in COLS:
62-
results[f"annotator_total_{key}"] = int(val.lstrip())
60+
if ":" in line:
61+
key, val = line.split(":")
62+
if key in COLS:
63+
results[f"annotator_total_{key}"] = int(val.lstrip())
6364
return results

bactopia/parsers/parsables.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
A list of files that can be parsed by Bactopia
33
"""
4+
import logging
45
from pathlib import Path
56

67
EXCLUDE_COLUMNS = [
@@ -24,8 +25,6 @@
2425
def get_parsable_files(path: str, name: str) -> list:
2526
parsable_files = {
2627
# main
27-
# annotator
28-
f"{path}/main/annotator/prokka/{name}.txt": "annotator",
2928
# assembler
3029
f"{path}/main/assembler/{name}.tsv": "assembler",
3130
# gather
@@ -49,14 +48,23 @@ def get_parsable_files(path: str, name: str) -> list:
4948

5049
# Check annotation files seperately, since Prokka or Bakta can be used
5150
if Path(f"{path}/main/annotator/bakta/{name}.txt").exists():
51+
logging.debug(
52+
f"Found Bakta annotation file: {path}/main/annotator/bakta/{name}.txt"
53+
)
5254
parsable_files[f"{path}/main/annotator/bakta/{name}.txt"] = "annotator"
5355
elif Path(f"{path}/main/annotator/prokka/{name}.txt").exists():
56+
logging.debug(
57+
f"Found Prokka annotation file: {path}/main/annotator/prokka/{name}.txt"
58+
)
5459
parsable_files[f"{path}/main/annotator/prokka/{name}.txt"] = "annotator"
5560
else:
5661
is_complete = False
5762
missing_files.append(f"{path}/main/annotator/prokka/{name}.txt")
5863
missing_files.append(f"{path}/main/annotator/bakta/{name}.txt")
5964

65+
logging.debug(f"Missing Files: {missing_files}")
66+
logging.debug(f"Is Complete: {is_complete}")
67+
6068
if is_complete:
6169
parsable_files[f"{path}/main/qc/summary/{name}-original.json"] = "qc"
6270
parsable_files[f"{path}/main/qc/summary/{name}-final.json"] = "qc"

0 commit comments

Comments
 (0)