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

fix: Correctly handle non str index list for bwa-mem2/mem #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bio/bwa-mem2/mem/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
bwa_threads = snakemake.threads
samtools_threads = snakemake.threads - 1

index = snakemake.input.get("index", "")
if isinstance(index, str):
index = path.splitext(snakemake.input.idx)[0]
idx = snakemake.input.get("idx", "")
if isinstance(idx, str):
index = path.splitext(idx)[0]
else:
index = path.splitext(snakemake.input.idx[0])[0]
index = path.splitext(idx[0])[0]
Comment on lines +30 to +34
Copy link
Author

Choose a reason for hiding this comment

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

category Functionality

The changes you've made to use 'idx' instead of 'index' are good and address the reported issue. However, I suggest adding an explicit check for when 'idx' is not provided. Currently, if 'idx' is an empty string, it might lead to unexpected behavior. Consider adding a check like this:

idx = snakemake.input.get("idx", "")
if not idx:
    raise ValueError("No index file provided. Please specify 'idx' in the input.")

This will ensure that the wrapper fails early with a clear error message if the required index is not provided.

Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews.



# Check inputs/arguments.
Expand Down
Loading