pha4ge/hAMRonization

hamronize summarize - local variable 'parsed_report' reference before assignment

Closed this issue · 3 comments

Describe the bug
Summarize function failed when no genes were present in the input files. This should be caught and handled by summarize function.

this bug is still present in the latest version (1.0.4)

I would like to report the same issue, which is a problem for pipelines when we try to automate a lot of these. We are using hAMRonization heavily (because it's an awesome tool, thank you for it!) in nf-core/funcscan, but when testing this in a large pipeline run with ~126 samples, it caused the whole pipeline to fail due to this error.

The actual error arguably comes from the upstream per-tool subcommands, which produce 'nonsense' output of a single ]

Example, for abrigate output:

$ cat ABM006-megahit.txt
#FILE	SEQUENCE	START	END	STRAND	GENE	COVERAGE	COVERAGE_MAP	GAPS	%COVERAGE	%IDENTITY	DATABASE	ACCESSION	PRODUCT	RESISTANCE
$ hamronize \
    abricate \
    ABM006-megahit.txt \
     \
    --format json \
    --analysis_software_version 1.0.1 \
    --reference_database_version 2021-Mar-27 \
    > ABM006-megahit.txt.abricate.json
$ cat ABM006-megahit.txt.abricate.json 
]

So from a pipeline perspective, alternatively, it would also work at pipeline levels to have the check/failure at the tool specific subcommand. If it could produce an error message and a exit code other than 0 or 1, it would allow us to 'ignore' if the tool-level command fails.

Sorry about the delay, didn't realise people were actually running into this issue in the wild!
This should now work as intended (release to follow imminently).