Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle empty inputs gracefully #19

Merged
merged 4 commits into from
Dec 30, 2021
Merged

Handle empty inputs gracefully #19

merged 4 commits into from
Dec 30, 2021

Conversation

standage
Copy link
Member

@standage standage commented Dec 30, 2021

Most taxonkit operations accept a list of input values. When the list passed to the corresponding pytaxonkit function is empty, pytaxonkit still attempts to run taxonkit, with predictably poor results. This PR updates the code to intercept these cases, emit a warning message, and exit the function before any attempt to run taxonkit.

Also included are some minor changes to expected test results that are needed on a roughly monthly basis due to updates to the NCBI Taxonomy database.

Closes #18.

pytaxonkit.py Outdated
assert result.TaxID.equals(pandas.Series([1082657, 265720, 1191594, 106649, 2868953]))
assert result.Code.equals(pandas.Series([1082657, 265720, 1191594, 106649, 2868953]))
assert result.Lineage.equals(pandas.Series([
print(result)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this print statement was left here accidentally.

Copy link
Collaborator

@RyanBerger98 RyanBerger98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Only thing I have to say is my previous comment about the print statement.

@standage standage merged commit e435480 into master Dec 30, 2021
@standage standage deleted the empty branch December 30, 2021 21:55
@standage
Copy link
Member Author

Thanks @RyanBerger98!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: should not attempt to run taxonkit with empty input
2 participants