From 6d1ed0fd6aed2d7143b52d435cabec1cdc9009bc Mon Sep 17 00:00:00 2001 From: "Dr. K. D. Murray" <1560490+kdm9@users.noreply.github.com> Date: Tue, 11 Apr 2023 10:13:37 +0200 Subject: [PATCH] Report errors mapping amino acids Hi Heng, Thanks for yet another brilliant tool! This patch reports errors mapping amino acid files to the reference. AFAICT, the only non-zero exit code of mp_map_file() is for errors opening the faa file(s). I hit this due to a stupid error on my part: giving `query.faa.gz` when only `query.faa` existed on disk. Miniprot ran fine but of course gave an empty gff. Now, the user should at least get a warning and a non-zero exit code in case of stupidity :) Best, Kevin --- main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index b646f06..18d61d3 100644 --- a/main.c +++ b/main.c @@ -175,8 +175,13 @@ int main(int argc, char *argv[]) if (set_I && !set_G) mp_mapopt_set_max_intron(&mo, mi->nt->l_seq); if (mp_verbose >= 3) mp_idx_print_stat(mi, mo.max_occ); if (fn_idx != 0) mp_idx_dump(fn_idx, mi); - for (i = o.ind + 1; i < argc; ++i) - mp_map_file(mi, argv[i], &mo, n_threads); + for (i = o.ind + 1; i < argc; ++i) { + int32_t res = mp_map_file(mi, argv[i], &mo, n_threads); + if (res != 0) { + fprintf(stderr, "[M::%s] ERROR during mapping %s (check files exists and is amino acid fasta)\n", __func__, argv[i]); + return 1; + } + } mp_idx_destroy(mi); if (mp_verbose >= 3) {