ncbi / ncbi/datasets

`datasets summary genome taxon` should have exitcode of `0` when there are no genomes for a valid taxon

Open
#482 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Jupyter Notebook
Stars
559
Forks
70
Avg merge
1m
Merged PRs (30d)
2

Description

When looking up genomes for a taxon that exists but has no genomes on NCBI, the following error is given:

root@b9976d6ef296:/data# datasets summary genome taxon 97225
Error: The taxonomy ID '97225' is valid for 'Gomphonemataceae', but no genome data is currently available for this taxon.

Use datasets summary genome taxon <command> --help for detailed help about a command.

root@b9976d6ef296:/data# echo $?
1

The text of this is helpful, but it returns a "failure" exit code of 1. It seems to me that this is not actually a failed API call. It understood the request and returned what was asked, which in this case is nothing. I Think the exit code should be 0 in this case. This is important in automated pipelines because the exit code is used to check if a process failed or not. In the case of our Nextflow pipeline, I had to do this bash gymnastics in order to bypass this behavior:

# NOTE: This command errors when a taxon is found but has no data rather than just outputing an empty file,
#   so the below code forces it to not fail and then fails if any other error occur
datasets summary genome taxon ${args} ${taxon.toLowerCase()} 1> ${output_path} 2> >(tee error.txt >&2) || true
if [ -s error.txt ] && ! grep -q 'no genome data is currently available for this taxon.' error.txt; then
    exit 1
fi

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing datasets summary genome taxon 97225 and checking its output and exit status. Trace the CLI path for a valid taxon with no genome data, then verify that it retains the helpful message, returns exit code 0, and still reports genuine errors as failures.

Written by the indexing model from the issue text.

Assessment

Domain
bioinformatics, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.