Skip to content

Commit

Permalink
Report errors mapping amino acids
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kdm9 authored Apr 11, 2023
1 parent 64e72b9 commit 6d1ed0f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6d1ed0f

Please sign in to comment.