-
Notifications
You must be signed in to change notification settings - Fork 202
feat: add pytrf sub-commands as individual Snakemake-Wrappers #4745
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
base: master
Are you sure you want to change the base?
Conversation
…to glue with enviroment and pass basic test
…imal and doc comments
📝 WalkthroughWalkthroughAdds four PyTRF Snakemake wrapper modules (extract, findatr, findgtr, findstr) with environment manifests, meta.yaml descriptors, wrapper scripts, tests, and demo FASTA data; also adds/updates top-level tests in test_wrappers.py (extract test skipped for a known delimiter bug). Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (6)
bio/pytrf/findstr/environment.yaml (1)
1-8: Env spec looks good; consider relaxing the pyfastx pin.Channels and the
pytrf =1.4pin match the environment.yaml guidelines. Since those guidelines recommend only pinning the main tool and avoiding version constraints for dependencies unless necessary, you might want to drop the version onpyfastx(or explain in the PR description why=2.2is required for pytrf 1.4).For example:
dependencies: - pytrf =1.4 - - pyfastx =2.2 + - pyfastxAs per environment.yaml guidelines in snakemake-wrappers.
bio/pytrf/findatr/environment.yaml (1)
1-8: Consistent env; same optional note about pyfastx version pin.This mirrors the findstr environment: channels and
pytrf =1.4are in line with the documented conventions. If there is no strict compatibility reason, you could consider unpinningpyfastxhere as well to follow the “only pin main tool” guideline, for example:dependencies: - pytrf =1.4 - - pyfastx =2.2 + - pyfastxIf pytrf 1.4 is known to require exactly pyfastx 2.2, keeping the pin is fine—just worth double-checking.
bio/pytrf/extract/environment.yaml (1)
1-8: Minimal env is good; optionally reconsider pyfastx version pin here too.This environment matches the others: channels look right and
pytrf =1.4follows the documented pattern. As with the other PyTRF envs, you may want to unpinpyfastxunless=2.2is required, to better follow the “only pin the main package” convention.dependencies: - pytrf =1.4 - - pyfastx =2.2 + - pyfastxBased on the shared environment.yaml guidelines for this repo.
bio/pytrf/findgtr/environment.yaml (1)
1-8: Consider relaxing thepyfastxversion pinThe channels and
pytrfpin look good. Given the wrapper guidelines forenvironment.yaml, it might be better to only pin the main tool (pytrf) and either (a) droppyfastxentirely or (b) at least omit its explicit version (- pyfastx) so bioconda can manage the dependency, unless you know=2.2is strictly required.bio/pytrf/findgtr/wrapper.py (1)
13-23: Wrapper works, but you can simplify path handling and error wrappingOverall the wrapper is functionally sound and matches how the test Snakefile and meta.yaml describe
findgtr. Two (optional) simplifications you might consider:
Avoid
Path(...).resolve()for inputs/outputs (lines 15–16, 22).
Using the rawsnakemake.input[0]/snakemake.output[0]strings is usually enough and keeps the wrapper friendlier to non-local or non-standard file backends. For local-file-only wrappers, it’s also fine but not strictly needed.Drop most of the
try/exceptwrapping (lines 13–18, 27–43, 53–56).
Snakemake already surfaces clear errors ifsnakemake.input/paramsare mis-specified or ifshell()fails, so the extraValueError/RuntimeErrorlayers can be removed to keep the wrapper minimal.If you’d like, I can sketch a trimmed-down version that keeps the same CLI flags but removes
resolve()and the extra exception wrapping.Also applies to: 27-56
bio/pytrf/findatr/meta.yaml (1)
36-36: Consider clarifying the example label.The line "Row in record:" could be more explicit as "Example row in record:" or "Sample row:" to make it clearer that this is an illustrative example.
Apply this diff:
- Row in record: 0 1 32 T 1 32.0 32 1 1 1 1 10 22 0 0 31.25 |nl| + Example row in record: 0 1 32 T 1 32.0 32 1 1 1 1 10 22 0 0 31.25 |nl|
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (5)
bio/pytrf/extract/test/demo_data/small_test.tsvis excluded by!**/*.tsvbio/pytrf/extract/test/expected/extract_basic.tsvis excluded by!**/*.tsvbio/pytrf/findatr/test/expected/findatr_basic.tsvis excluded by!**/*.tsvbio/pytrf/findgtr/test/expected/findgtr_basic.tsvis excluded by!**/*.tsvbio/pytrf/findstr/test/expected/findstr_basic.csvis excluded by!**/*.csv
📒 Files selected for processing (26)
bio/pytrf/extract/environment.linux-64.pin.txt(1 hunks)bio/pytrf/extract/environment.yaml(1 hunks)bio/pytrf/extract/meta.yaml(1 hunks)bio/pytrf/extract/test/Snakefile(1 hunks)bio/pytrf/extract/test/demo_data/small_test.fasta(1 hunks)bio/pytrf/extract/wrapper.py(1 hunks)bio/pytrf/findatr/environment.linux-64.pin.txt(1 hunks)bio/pytrf/findatr/environment.yaml(1 hunks)bio/pytrf/findatr/meta.yaml(1 hunks)bio/pytrf/findatr/test/Snakefile(1 hunks)bio/pytrf/findatr/test/demo_data/small_test.fasta(1 hunks)bio/pytrf/findatr/wrapper.py(1 hunks)bio/pytrf/findgtr/environment.linux-64.pin.txt(1 hunks)bio/pytrf/findgtr/environment.yaml(1 hunks)bio/pytrf/findgtr/meta.yaml(1 hunks)bio/pytrf/findgtr/test/Snakefile(1 hunks)bio/pytrf/findgtr/test/demo_data/small_test.fasta(1 hunks)bio/pytrf/findgtr/wrapper.py(1 hunks)bio/pytrf/findstr/environment.linux-64.pin.txt(1 hunks)bio/pytrf/findstr/environment.yaml(1 hunks)bio/pytrf/findstr/meta.yaml(1 hunks)bio/pytrf/findstr/test/Snakefile(1 hunks)bio/pytrf/findstr/test/demo_data/small_test.fasta(1 hunks)bio/pytrf/findstr/test/test.smk(1 hunks)bio/pytrf/findstr/wrapper.py(1 hunks)test_wrappers.py(3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py
⚙️ CodeRabbit configuration file
**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.
Files:
bio/pytrf/findstr/wrapper.pybio/pytrf/findatr/wrapper.pybio/pytrf/findgtr/wrapper.pybio/pytrf/extract/wrapper.pytest_wrappers.py
**/wrapper.py
⚙️ CodeRabbit configuration file
Do not complain about use of undefined variable called
snakemake.
Files:
bio/pytrf/findstr/wrapper.pybio/pytrf/findatr/wrapper.pybio/pytrf/findgtr/wrapper.pybio/pytrf/extract/wrapper.py
🧠 Learnings (27)
📓 Common learnings
Learnt from: johanneskoester
Repo: snakemake/snakemake-wrappers PR: 3478
File: bio/varlociraptor/estimate-alignment-properties/wrapper.py:5-12
Timestamp: 2024-11-21T10:23:03.427Z
Learning: In the Snakemake wrappers project, avoid suggesting extensive error handling or temporary file management in simple wrapper scripts when it may be unnecessary, to prevent overcomplicating the code.
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3501
File: meta/bio/varscan2_snpeff/test/Snakefile:58-71
Timestamp: 2024-11-26T10:49:54.765Z
Learning: In test Snakefiles within the snakemake-wrappers repository, it is acceptable to use simplified paths and logging configurations that may differ from real-life pipelines.
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3499
File: bio/ngscheckmate/makesnvpattern/test/Snakefile:14-22
Timestamp: 2024-11-26T09:16:39.570Z
Learning: In the `snakemake-wrappers` repository, when writing test `Snakefile`s (e.g., `bio/ngscheckmate/makesnvpattern/test/Snakefile`), hardcoded input/output paths are acceptable because these are examples and the IO can be chosen freely.
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3496
File: bio/mtnucratio/test/Snakefile:2-6
Timestamp: 2024-11-26T08:31:00.099Z
Learning: In test files for Snakemake wrappers, such as `bio/mtnucratio/test/Snakefile`, hard-coded input and output paths are acceptable as examples and do not need to use wildcards to make paths flexible.
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3502
File: bio/ngsbits/sampleancestry/wrapper.py:1-23
Timestamp: 2024-11-26T15:01:13.202Z
Learning: The NGS-bits SampleAncestry wrapper in `bio/ngsbits/sampleancestry/` includes a test Snakefile, sample VCF files, and tests available in the `test/` directory.
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3496
File: bio/mtnucratio/wrapper.py:27-28
Timestamp: 2024-11-26T08:30:23.818Z
Learning: In Snakemake wrappers (e.g., `wrapper.py` files), it's unnecessary to verify the availability of tools like `mtnucratio` within the code, because Snakemake with Conda ensures that the required tools are installed and available.
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3502
File: bio/ngsbits/sampleancestry/wrapper.py:18-23
Timestamp: 2024-11-26T14:59:03.678Z
Learning: In Snakemake wrapper scripts, Snakemake validates input and output paths, so explicit shell quoting is not necessary.
Learnt from: johanneskoester
Repo: snakemake/snakemake-wrappers PR: 3123
File: utils/datavzrd/wrapper.py:31-32
Timestamp: 2024-08-21T08:30:42.757Z
Learning: In `wrapper.py` scripts, do not flag the use of an undefined variable called `snakemake`.
Learnt from: johanneskoester
Repo: snakemake/snakemake-wrappers PR: 3123
File: utils/datavzrd/wrapper.py:31-32
Timestamp: 2024-10-08T17:41:54.542Z
Learning: In `wrapper.py` scripts, do not flag the use of an undefined variable called `snakemake`.
Learnt from: johanneskoester
Repo: snakemake/snakemake-wrappers PR: 3478
File: bio/varlociraptor/call-variants/wrapper.py:15-23
Timestamp: 2024-11-15T18:36:04.660Z
Learning: In the Snakemake wrappers repository, using `shell=True` and redirecting within shell commands is acceptable.
📚 Learning: 2024-11-26T08:31:00.099Z
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3496
File: bio/mtnucratio/test/Snakefile:2-6
Timestamp: 2024-11-26T08:31:00.099Z
Learning: In test files for Snakemake wrappers, such as `bio/mtnucratio/test/Snakefile`, hard-coded input and output paths are acceptable as examples and do not need to use wildcards to make paths flexible.
Applied to files:
bio/pytrf/findgtr/test/Snakefilebio/pytrf/extract/test/Snakefilebio/pytrf/findstr/test/test.smkbio/pytrf/findstr/test/Snakefiletest_wrappers.py
📚 Learning: 2024-11-26T09:16:39.570Z
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3499
File: bio/ngscheckmate/makesnvpattern/test/Snakefile:14-22
Timestamp: 2024-11-26T09:16:39.570Z
Learning: In the `snakemake-wrappers` repository, when writing test `Snakefile`s (e.g., `bio/ngscheckmate/makesnvpattern/test/Snakefile`), hardcoded input/output paths are acceptable because these are examples and the IO can be chosen freely.
Applied to files:
bio/pytrf/findgtr/test/Snakefilebio/pytrf/extract/test/Snakefilebio/pytrf/findstr/test/test.smkbio/pytrf/findstr/test/Snakefiletest_wrappers.py
📚 Learning: 2024-11-21T10:23:03.427Z
Learnt from: johanneskoester
Repo: snakemake/snakemake-wrappers PR: 3478
File: bio/varlociraptor/estimate-alignment-properties/wrapper.py:5-12
Timestamp: 2024-11-21T10:23:03.427Z
Learning: In the Snakemake wrappers project, avoid suggesting extensive error handling or temporary file management in simple wrapper scripts when it may be unnecessary, to prevent overcomplicating the code.
Applied to files:
bio/pytrf/findgtr/test/Snakefilebio/pytrf/findstr/test/test.smkbio/pytrf/findstr/wrapper.pybio/pytrf/findatr/wrapper.pybio/pytrf/findgtr/wrapper.pybio/pytrf/extract/wrapper.py
📚 Learning: 2024-11-26T15:01:13.202Z
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3502
File: bio/ngsbits/sampleancestry/wrapper.py:1-23
Timestamp: 2024-11-26T15:01:13.202Z
Learning: The NGS-bits SampleAncestry wrapper in `bio/ngsbits/sampleancestry/` includes a test Snakefile, sample VCF files, and tests available in the `test/` directory.
Applied to files:
bio/pytrf/findgtr/test/Snakefilebio/pytrf/findstr/test/Snakefile
📚 Learning: 2024-11-26T10:49:54.765Z
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3501
File: meta/bio/varscan2_snpeff/test/Snakefile:58-71
Timestamp: 2024-11-26T10:49:54.765Z
Learning: In test Snakefiles within the snakemake-wrappers repository, it is acceptable to use simplified paths and logging configurations that may differ from real-life pipelines.
Applied to files:
bio/pytrf/findgtr/test/Snakefilebio/pytrf/findstr/test/test.smkbio/pytrf/findstr/test/Snakefiletest_wrappers.py
📚 Learning: 2024-11-26T10:49:04.406Z
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3501
File: meta/bio/varscan2_snpeff/test/Snakefile:1-10
Timestamp: 2024-11-26T10:49:04.406Z
Learning: Using generic output filenames like "genome.fasta" is acceptable in the `snakemake-wrappers` project.
Applied to files:
bio/pytrf/findgtr/test/Snakefile
📚 Learning: 2024-11-26T09:16:24.981Z
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3499
File: bio/ngscheckmate/makesnvpattern/test/Snakefile:1-13
Timestamp: 2024-11-26T09:16:24.981Z
Learning: In test `Snakefile`s (e.g., `test/Snakefile`), it's acceptable to use fixed input and output file names instead of wildcards.
Applied to files:
bio/pytrf/findgtr/test/Snakefilebio/pytrf/findstr/test/Snakefiletest_wrappers.py
📚 Learning: 2025-04-17T09:24:51.738Z
Learnt from: dlaehnemann
Repo: snakemake/snakemake-wrappers PR: 0
File: :0-0
Timestamp: 2025-04-17T09:24:51.738Z
Learning: In snakemake-wrappers repository, environment.yaml files should follow these conventions:
1. Use whitespace before the equal sign in version specifications (e.g., "datavzrd =2.53.1")
2. Only specify the exact version for the main software package
3. Don't add version constraints for dependencies unless absolutely necessary
4. See full guidelines at: https://snakemake-wrappers.readthedocs.io/en/stable/contributing.html#environment-yaml-file
Applied to files:
bio/pytrf/findgtr/environment.yamlbio/pytrf/findatr/environment.yamlbio/pytrf/extract/environment.yamlbio/pytrf/findstr/environment.yaml
📚 Learning: 2025-04-17T09:24:51.738Z
Learnt from: dlaehnemann
Repo: snakemake/snakemake-wrappers PR: 0
File: :0-0
Timestamp: 2025-04-17T09:24:51.738Z
Learning: In snakemake-wrappers repository, environment.yaml files should follow these conventions:
1. Use whitespace before the equal sign in version specifications (e.g., "datavzrd =2.53.1")
2. Only specify the exact version for the main software package
3. Don't add version constraints for dependencies unless absolutely necessary
4. See guidelines at: https://snakemake-wrappers.readthedocs.io/en/stable/contributing.html#environment-yaml-file
Applied to files:
bio/pytrf/findgtr/environment.yamlbio/pytrf/findatr/environment.yamlbio/pytrf/extract/environment.yamlbio/pytrf/findstr/environment.yaml
📚 Learning: 2025-02-11T12:24:22.592Z
Learnt from: dlaehnemann
Repo: snakemake/snakemake-wrappers PR: 3648
File: bio/nanosim/simulator/environment.yaml:6-6
Timestamp: 2025-02-11T12:24:22.592Z
Learning: In the nanosim bioconda recipe, dependencies are carefully managed with specific version pins (e.g., scikit-learn ~=0.23.2) to ensure compatibility with pre-trained models. These dependencies don't need to be explicitly added to environment.yaml files when the main package is listed as a dependency, as they are handled through the bioconda recipe system.
Applied to files:
bio/pytrf/findgtr/environment.yamlbio/pytrf/findatr/environment.linux-64.pin.txtbio/pytrf/findstr/environment.linux-64.pin.txtbio/pytrf/findatr/environment.yamlbio/pytrf/extract/environment.yamlbio/pytrf/extract/environment.linux-64.pin.txtbio/pytrf/findstr/environment.yamlbio/pytrf/findgtr/environment.linux-64.pin.txt
📚 Learning: 2025-06-02T07:56:35.854Z
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 4159
File: bio/pyfaidx/environment.yaml:6-6
Timestamp: 2025-06-02T07:56:35.854Z
Learning: In the Snakemake-wrapper repository, conda dependency version pinning in environment.yaml files uses spaces around the equals sign (e.g., `- pyfaidx =0.8.1.4`) as the established coding standard, even though conda itself doesn't require the spaces.
Applied to files:
bio/pytrf/findgtr/environment.yamlbio/pytrf/findatr/environment.linux-64.pin.txtbio/pytrf/findatr/environment.yamlbio/pytrf/extract/environment.yamlbio/pytrf/findstr/environment.yaml
📚 Learning: 2025-02-11T12:24:22.592Z
Learnt from: dlaehnemann
Repo: snakemake/snakemake-wrappers PR: 3648
File: bio/nanosim/simulator/environment.yaml:6-6
Timestamp: 2025-02-11T12:24:22.592Z
Learning: For bioconda packages like nanosim, dependencies like scikit-learn are managed through the bioconda recipe and don't need to be explicitly added to the environment.yaml file when the main package is listed as a dependency.
Applied to files:
bio/pytrf/findgtr/environment.yamlbio/pytrf/findatr/environment.yamlbio/pytrf/extract/environment.yamlbio/pytrf/findstr/environment.yaml
📚 Learning: 2025-06-15T07:54:36.475Z
Learnt from: tedil
Repo: snakemake/snakemake-wrappers PR: 4274
File: bio/mehari/download-clinvar-db/wrapper.py:29-33
Timestamp: 2025-06-15T07:54:36.475Z
Learning: The conda-packaged tar 1.34 has default settings that include `-f -`, so explicit specification of `-f -` is not required when piping input to tar in conda environments, unlike standard system tar which requires it explicitly.
Applied to files:
bio/pytrf/findatr/environment.linux-64.pin.txtbio/pytrf/findstr/environment.linux-64.pin.txtbio/pytrf/extract/environment.linux-64.pin.txtbio/pytrf/findgtr/environment.linux-64.pin.txt
📚 Learning: 2024-08-21T08:30:42.757Z
Learnt from: johanneskoester
Repo: snakemake/snakemake-wrappers PR: 3123
File: utils/datavzrd/wrapper.py:31-32
Timestamp: 2024-08-21T08:30:42.757Z
Learning: In `wrapper.py` scripts, do not flag the use of an undefined variable called `snakemake`.
Applied to files:
bio/pytrf/findstr/wrapper.pybio/pytrf/findatr/wrapper.pybio/pytrf/findgtr/wrapper.pybio/pytrf/extract/wrapper.py
📚 Learning: 2024-11-26T14:59:03.678Z
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3502
File: bio/ngsbits/sampleancestry/wrapper.py:18-23
Timestamp: 2024-11-26T14:59:03.678Z
Learning: In Snakemake wrapper scripts, Snakemake validates input and output paths, so explicit shell quoting is not necessary.
Applied to files:
bio/pytrf/findstr/wrapper.pybio/pytrf/findatr/wrapper.pybio/pytrf/findgtr/wrapper.pybio/pytrf/extract/wrapper.py
📚 Learning: 2024-11-15T13:44:18.810Z
Learnt from: johanneskoester
Repo: snakemake/snakemake-wrappers PR: 3478
File: bio/varlociraptor/estimate-alignment-properties/wrapper.py:5-12
Timestamp: 2024-11-15T13:44:18.810Z
Learning: In the snakemake-wrappers repository, it is acceptable to use f-strings with `shell=True` in wrapper scripts (e.g., `wrapper.py` files), as these wrappers are under full control of the user. Potential command injection vulnerabilities are not considered an issue in this context.
Applied to files:
bio/pytrf/findstr/wrapper.pybio/pytrf/findatr/wrapper.pybio/pytrf/findgtr/wrapper.py
📚 Learning: 2024-11-15T18:31:15.447Z
Learnt from: johanneskoester
Repo: snakemake/snakemake-wrappers PR: 3478
File: bio/varlociraptor/estimate-alignment-properties/test/Snakefile:7-10
Timestamp: 2024-11-15T18:31:15.447Z
Learning: In the Snakemake wrappers repository, avoid suggesting refactoring that involves using `tempfile.gettempdir()` or changing output paths to temporary directories.
Applied to files:
bio/pytrf/findstr/wrapper.pybio/pytrf/findatr/wrapper.pybio/pytrf/findgtr/wrapper.py
📚 Learning: 2025-06-15T07:43:03.263Z
Learnt from: tedil
Repo: snakemake/snakemake-wrappers PR: 4274
File: bio/mehari/annotate-seqvars/wrapper.py:11-19
Timestamp: 2025-06-15T07:43:03.263Z
Learning: In Snakemake wrappers, a common pattern is to have flag variables that are either empty strings "" or the actual flag strings (e.g., "--keep-intergenic") for direct interpolation in shell commands. This avoids conditionals in the shell expression and keeps the command construction clean.
Applied to files:
bio/pytrf/findstr/wrapper.py
📚 Learning: 2024-11-15T13:48:33.759Z
Learnt from: johanneskoester
Repo: snakemake/snakemake-wrappers PR: 3478
File: bio/varlociraptor/preprocess-variants/wrapper.py:0-0
Timestamp: 2024-11-15T13:48:33.759Z
Learning: In Snakemake wrappers, security considerations like input sanitization are unnecessary, as the wrappers are under full control of the user.
Applied to files:
bio/pytrf/findstr/wrapper.pybio/pytrf/findatr/wrapper.pybio/pytrf/extract/wrapper.py
📚 Learning: 2024-11-26T08:30:23.818Z
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3496
File: bio/mtnucratio/wrapper.py:27-28
Timestamp: 2024-11-26T08:30:23.818Z
Learning: In Snakemake wrappers (e.g., `wrapper.py` files), it's unnecessary to verify the availability of tools like `mtnucratio` within the code, because Snakemake with Conda ensures that the required tools are installed and available.
Applied to files:
bio/pytrf/findstr/wrapper.pybio/pytrf/findatr/wrapper.pybio/pytrf/findgtr/wrapper.pybio/pytrf/extract/wrapper.py
📚 Learning: 2024-11-15T18:36:04.660Z
Learnt from: johanneskoester
Repo: snakemake/snakemake-wrappers PR: 3478
File: bio/varlociraptor/call-variants/wrapper.py:15-23
Timestamp: 2024-11-15T18:36:04.660Z
Learning: In the Snakemake wrappers repository, using `shell=True` and redirecting within shell commands is acceptable.
Applied to files:
bio/pytrf/findstr/wrapper.pybio/pytrf/findatr/wrapper.pybio/pytrf/findgtr/wrapper.pybio/pytrf/extract/wrapper.py
📚 Learning: 2025-01-30T14:19:53.384Z
Learnt from: dlaehnemann
Repo: snakemake/snakemake-wrappers PR: 3432
File: bio/reference/ensembl-sequence/wrapper.py:79-87
Timestamp: 2025-01-30T14:19:53.384Z
Learning: In Snakemake wrappers, error reporting should use `print(..., file=sys.stderr)` for direct error messages, while `snakemake.log_fmt_shell()` is used for capturing command output and errors.
Applied to files:
bio/pytrf/findstr/wrapper.py
📚 Learning: 2025-06-04T06:32:20.090Z
Learnt from: rohan-ibn-tariq
Repo: snakemake/snakemake-wrappers PR: 4160
File: bio/trf/wrapper.py:18-26
Timestamp: 2025-06-04T06:32:20.090Z
Learning: For Snakemake wrappers, it's preferable to keep parameter dictionaries and constants directly visible in wrapper.py files rather than importing from config modules, to maintain minimal, self-documenting code that doc viewers can understand at a glance.
Applied to files:
bio/pytrf/findatr/wrapper.py
📚 Learning: 2024-10-08T17:41:54.542Z
Learnt from: johanneskoester
Repo: snakemake/snakemake-wrappers PR: 3123
File: utils/datavzrd/wrapper.py:31-32
Timestamp: 2024-10-08T17:41:54.542Z
Learning: The `snakemake` variable is inserted via a preamble during execution in `wrapper.py` scripts, so it doesn't need to be explicitly defined.
Applied to files:
bio/pytrf/findatr/wrapper.py
📚 Learning: 2024-08-20T19:23:34.259Z
Learnt from: fgvieira
Repo: snakemake/snakemake-wrappers PR: 3071
File: bio/paraphase/wrapper.py:84-86
Timestamp: 2024-08-20T19:23:34.259Z
Learning: In Snakemake wrappers, a try/except block is unnecessary because Snakemake will handle exceptions if the wrapper fails.
Applied to files:
bio/pytrf/findgtr/wrapper.pybio/pytrf/extract/wrapper.py
📚 Learning: 2024-11-26T09:08:06.041Z
Learnt from: tdayris
Repo: snakemake/snakemake-wrappers PR: 3499
File: bio/ngscheckmate/makesnvpattern/wrapper.py:18-24
Timestamp: 2024-11-26T09:08:06.041Z
Learning: In Snakemake wrappers, input file validation is managed by Snakemake, so manual validation in the wrapper code is unnecessary.
Applied to files:
bio/pytrf/extract/wrapper.py
🪛 Ruff (0.14.6)
bio/pytrf/findstr/wrapper.py
11-11: Undefined name snakemake
(F821)
15-15: Undefined name snakemake
(F821)
17-17: Avoid specifying long messages outside the exception class
(TRY003)
21-21: Undefined name snakemake
(F821)
22-22: Undefined name snakemake
(F821)
28-28: Undefined name snakemake
(F821)
29-29: Undefined name snakemake
(F821)
31-31: Undefined name snakemake
(F821)
32-32: Undefined name snakemake
(F821)
37-37: Avoid specifying long messages outside the exception class
(TRY003)
50-50: Avoid specifying long messages outside the exception class
(TRY003)
bio/pytrf/findatr/wrapper.py
11-11: Undefined name snakemake
(F821)
15-15: Undefined name snakemake
(F821)
17-17: Avoid specifying long messages outside the exception class
(TRY003)
21-21: Undefined name snakemake
(F821)
22-22: Undefined name snakemake
(F821)
28-28: Undefined name snakemake
(F821)
29-29: Undefined name snakemake
(F821)
31-31: Undefined name snakemake
(F821)
32-32: Undefined name snakemake
(F821)
34-34: Undefined name snakemake
(F821)
35-35: Undefined name snakemake
(F821)
37-37: Undefined name snakemake
(F821)
38-38: Undefined name snakemake
(F821)
40-40: Undefined name snakemake
(F821)
41-41: Undefined name snakemake
(F821)
43-43: Undefined name snakemake
(F821)
44-44: Undefined name snakemake
(F821)
46-46: Undefined name snakemake
(F821)
47-47: Undefined name snakemake
(F821)
49-49: Undefined name snakemake
(F821)
50-50: Undefined name snakemake
(F821)
52-52: Avoid specifying long messages outside the exception class
(TRY003)
65-65: Avoid specifying long messages outside the exception class
(TRY003)
bio/pytrf/findgtr/wrapper.py
11-11: Undefined name snakemake
(F821)
15-15: Undefined name snakemake
(F821)
17-17: Avoid specifying long messages outside the exception class
(TRY003)
21-21: Undefined name snakemake
(F821)
22-22: Undefined name snakemake
(F821)
28-28: Undefined name snakemake
(F821)
29-29: Undefined name snakemake
(F821)
31-31: Undefined name snakemake
(F821)
32-32: Undefined name snakemake
(F821)
34-34: Undefined name snakemake
(F821)
35-35: Undefined name snakemake
(F821)
37-37: Undefined name snakemake
(F821)
38-38: Undefined name snakemake
(F821)
40-40: Undefined name snakemake
(F821)
41-41: Undefined name snakemake
(F821)
43-43: Avoid specifying long messages outside the exception class
(TRY003)
56-56: Avoid specifying long messages outside the exception class
(TRY003)
bio/pytrf/extract/wrapper.py
11-11: Undefined name snakemake
(F821)
15-15: Undefined name snakemake
(F821)
17-17: Avoid specifying long messages outside the exception class
(TRY003)
21-21: Undefined name snakemake
(F821)
22-22: Undefined name snakemake
(F821)
26-26: Undefined name snakemake
(F821)
27-27: Abstract raise to an inner function
(TRY301)
27-27: Avoid specifying long messages outside the exception class
(TRY003)
28-28: Undefined name snakemake
(F821)
30-30: Avoid specifying long messages outside the exception class
(TRY003)
36-36: Undefined name snakemake
(F821)
37-37: Undefined name snakemake
(F821)
39-39: Undefined name snakemake
(F821)
40-40: Undefined name snakemake
(F821)
42-42: Avoid specifying long messages outside the exception class
(TRY003)
55-55: Avoid specifying long messages outside the exception class
(TRY003)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: docs
- GitHub Check: testing
- GitHub Check: Summary
🔇 Additional comments (21)
bio/pytrf/findgtr/test/demo_data/small_test.fasta (1)
1-2: FASTA test data looks valid and minimal.Single-record FASTA is correctly formatted and suitable as demo input for the findgtr test.
bio/pytrf/extract/test/demo_data/small_test.fasta (1)
1-6: Multi-record FASTA is well-formed and appropriate for tests.Headers and sequences are correctly formatted; having three entries is useful to test extract behavior on multiple sequences.
bio/pytrf/findatr/test/demo_data/small_test.fasta (1)
1-2: Valid single-record FASTA; consistent with other PyTRF demo inputs.Formatting is correct, and reusing the same test sequence across tools helps keep tests comparable.
bio/pytrf/findstr/test/demo_data/small_test.fasta (1)
1-2: FASTA fixture is correct and reuses the shared test sequence.This is a clean, minimal test input and aligns with the other PyTRF wrapper demos.
bio/pytrf/findgtr/environment.linux-64.pin.txt (1)
1-37: Explicit linux-64 pin file looks like a clean solver export.The structure and package URLs match a standard
conda list --explicitexport and line up with the PyTRF-related packages you reference elsewhere. Just ensure this was generated from the final intended environment so it stays in sync withenvironment.yaml.bio/pytrf/findstr/meta.yaml (1)
1-33: Clear, consistent tool metadataThe input/output description, parameter docs, and notes (including defaults and example) are coherent and align with the intended wrapper behavior; nothing to change here.
bio/pytrf/findgtr/meta.yaml (1)
1-37: Metadata and parameter descriptions look consistentThe param names and defaults (min_motif, max_motif, min_repeat, min_length, out_format) align with the wrapper and test usage, and the notes clearly describe the output schema. No changes needed.
bio/pytrf/findstr/test/test.smk (1)
1-16: Good minimal example for default behaviorThe sample rule cleanly demonstrates running
findstrwith all defaults and logging stdout, which is exactly what’s useful for wrapper documentation/tests; looks good as-is.bio/pytrf/findatr/environment.linux-64.pin.txt (1)
1-37: Explicit environment snapshot looks fineThe explicit linux-64 pin file appears to be a standard
conda list --explicitstyle export includingpytrfandpyfastx; nothing stands out that would need manual adjustment.bio/pytrf/extract/environment.linux-64.pin.txt (1)
1-37: Explicit environment snapshot is consistentThis explicit pin file matches the pattern used for the other PyTRF environments and encodes a concrete, reproducible environment; no changes needed.
bio/pytrf/findgtr/test/Snakefile (1)
1-21: Test rule wiring matches the wrapper contractThe rule’s input/output/log and params (min_motif, min_repeat) line up with the findgtr wrapper and metadata, giving a good functional test example for this sub-command.
bio/pytrf/extract/wrapper.py (1)
1-55: Wrapper logic and parameter handling look solidInput/output resolution, required
repeat_fileenforcement, optionalout_format/flank_lengthhandling, and command/log construction all follow established Snakemake-wrapper patterns and appear correct.bio/pytrf/findatr/wrapper.py (1)
1-65: Clean, explicit mapping of PyTRF findatr optionsThe wrapper cleanly resolves input/output, conditionally adds the documented parameters (
out_format, motif/seed/identity/extend thresholds), and executes with standard logging and error propagation; this looks correct and easy to maintain.bio/pytrf/findatr/test/Snakefile (1)
1-20: Test rule is well-wired to the findatr wrapperSample rule uses sensible demo paths, provides a log file, and passes parameters (
min_motif,max_motif) that the wrapper consumes, so it should exercise the wrapper as intended.bio/pytrf/findstr/test/Snakefile (1)
1-23: Example rule correctly exercises findstr with custom parametersThe rule’s input/output/log paths and
repeats/out_formatparams line up with the wrapper implementation, giving a clear, minimal example for testing and documentation.bio/pytrf/findstr/environment.linux-64.pin.txt (1)
1-37: Explicit Conda pin file appears consistent and machine‑generatedThe linux‑64 explicit environment file cleanly pins pytrf, pyfastx, Python, and core libraries; this is appropriate as a reproducible snapshot alongside the higher‑level environment.yaml.
bio/pytrf/extract/meta.yaml (1)
1-28: Metadata aligns with wrapper behavior and tool limitationsThe meta file accurately describes inputs/outputs, required and optional parameters, and clearly flags the upstream extract bug and skipped tests, which should help users understand the wrapper’s current status.
bio/pytrf/findstr/wrapper.py (1)
1-50: findstr wrapper is consistent and matches the test usageInput/output resolution, optional
out_format, and list/tuple‑basedrepeatshandling map cleanly to thepytrf findstrCLI, with standard logging and error reporting consistent with other wrappers in this PR.bio/pytrf/extract/test/Snakefile (1)
1-17: Extract test rule correctly wires repeat_file and outputThe
pytrf_extractrule uses the expectedrepeat_fileparam, output target, and log configuration for the wrapper, matching the documented interface and supporting future un‑skipped tests once the upstream bug is fixed.test_wrappers.py (2)
7243-7245: Good practice: documenting the skipped test with a clear reason.Properly using
@pytest.mark.skipwith a detailed reason and GitHub issue link is excellent. This makes it clear why the test is skipped and provides a reference for when the upstream bug might be fixed.
7170-7240: The repository clone failed in the sandbox environment. Let me analyze the original review comment to assess its correctness and determine the appropriate action.Looking at the original review comment:
Structure and reasoning: The comment correctly identifies that the new PyTRF test functions depend on:
- Expected output files for comparison (findstr_basic.csv, findgtr_basic.tsv, findatr_basic.tsv)
- Snakefile rule names (pytrf_findstr, pytrf_findgtr, pytrf_findatr)
- Test input data files
Test pattern analysis: The code snippet shows three test functions that follow a standard pattern:
test_pytrf_findstr- comparesresults/small_test.csvwithexpected/findstr_basic.csvtest_pytrf_findgtr- comparesresults/small_test.tsvwithexpected/findgtr_basic.tsvtest_pytrf_findatr- comparesresults/small_test.tsvwithexpected/findatr_basic.tsvVerification script quality: The suggested verification script is well-formed and uses appropriate tools (fd, rg) to check for:
- Expected output files in
bio/pytrf/*/test/expected/directories- Rule definitions in Snakefiles
- Demo data files
Learning context: From the retrieved learnings, I note that:
- Hardcoded input/output paths in test Snakefiles are acceptable (PR 3499)
- Test files can use simplified paths as examples (PR 3496)
- Snakemake with Conda ensures required tools are available (PR 3496)
The original review comment is requesting verification that test dependencies exist. This is a reasonable and standard review request for test code. However, since I cannot directly verify the files due to the clone failure, and the verification script provided in the comment is sound and can be executed by the repository maintainers, the review comment itself appears to be correct and actionable.
The original review comment is well-formed and provides a clear, actionable request for verification of test dependencies.
| if hasattr(snakemake.params, "out_format"): | ||
| params.append(f"-f {snakemake.params.out_format}") | ||
|
|
||
| if hasattr(snakemake.params, "flank_length"): | ||
| params.append(f"-l {snakemake.params.flank_length}") |
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.
Are these parameters mandatory?
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.
Flank length and output format are not mandatory
Add individual Snakemake-Wrappers for pytrf sub-commands (findstr, findgtr, findatr, extract) to enable modular execution and parameter handling within Snakemake workflows. Each wrapper handles optional parameters, output files, and logging in a clean and minimalistic way.
QC
snakemake-wrappers.While the contributions guidelines are more extensive, please particularly ensure that:
test.pywas updated to call any added or updated example rules in aSnakefile-> test_wrappers.pyinput:andoutput:file paths in the rules can be chosen arbitrarilyinput:oroutput:)tempfile.gettempdir()points to -> wrapper wasn't creating temp file, as for underlying tool I didn't changed the default behaviourmeta.yamlcontains a link to the documentation of the respective tool or command underurl:Summary by CodeRabbit
New Features
Documentation
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.