-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
Conversation
As reported in #522, currently this wrapper has issues if `idx` is a sequence is it incorrectly checked `input.index` to be as tring instead of `input.idx`. This is fixed now. While the discussin in #522 indicates, that there is an underlying issue with the concept of `input.idx` being as sequence of indices, this may need rework later. Until all the details are decided, having a correct version should be still valuable.
Clone of the PR snakemake/snakemake-wrappers#3101 |
My review is in progress 📖 - I will have feedback for you in a few minutes! |
1 similar comment
My review is in progress 📖 - I will have feedback for you in a few minutes! |
Warning Rate limit exceeded@furwellness has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 53 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reviewed your code and found 1 potential issue.
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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reviewed your code and did not find any issues!
Please note that I can make mistakes, and you should still encourage your team to review your code as well.
Mapping from the Github issue to the LangSmith prompt that generated the issue: |
System configuration at time of review:
|
@coderabbitai full review |
Actions performedFull review triggered. |
/review |
PR Reviewer Guide 🔍
|
@coderabbitai full review |
Actions performedFull review triggered. |
/review |
As reported in #522, currently the
bwa2-mem
wrapper has issues ifidx
is a sequence is it incorrectly checkedinput.index
to be as string instead ofinput.idx
.This bug was silent, as usually
snakemake.input.index
would always be a available asfunctools.partial(<function Namedlist._used_attribute at 0x73ac4dbc0c20>, _name='index')
or similar. Thus the predicate that it was not astr
was always true.Now with
snakemake=8.16.0
this changed and the bug becomes an error running the already existing tests.While the discussion in #522 indicates, that there is an underlying issue with the concept of
input.idx
being as sequence of indices, this may need rework later. Until all the details are decided, having a correct working version should be still valuable. With the current state any workflow using this wrapper usingsnakemake=8.16.0
is broken.QC
snakemake-wrappers
.While the contributions guidelines are more extensive, please particularly ensure that:
test.py
was updated to call any added or updated example rules in aSnakefile
input:
andoutput:
file paths in the rules can be chosen arbitrarilyinput:
oroutput:
)tempfile.gettempdir()
points tometa.yaml
contains a link to the documentation of the respective tool or command underurl:
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Description by Korbit AI
What change is being made?
Correctly handle non-string index list for bwa-mem2/mem by updating the variable name and its conditional checks.
Why are these changes being made?
The previous implementation incorrectly assumed the index input was always a string, leading to potential errors when a list was provided. This change ensures proper handling of both string and list inputs for the index.