Skip to content

Conversation

@rohan-ibn-tariq
Copy link
Contributor

@rohan-ibn-tariq rohan-ibn-tariq commented Nov 27, 2025

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

While the contributions guidelines are more extensive, please particularly ensure that:

  • test.py was updated to call any added or updated example rules in a Snakefile -> test_wrappers.py
  • input: and output: file paths in the rules can be chosen arbitrarily
  • wherever possible, command line arguments are inferred and set automatically (e.g. based on file extensions in input: or output:)
  • temporary files are either written to a unique hidden folder in the working directory, or (better) stored where the Python function tempfile.gettempdir() points to -> wrapper wasn't creating temp file, as for underlying tool I didn't changed the default behaviour
  • the meta.yaml contains a link to the documentation of the respective tool or command under url:
  • conda environments use a minimal amount of channels and packages, in recommended ordering

Summary by CodeRabbit

  • New Features

    • Added PyTRF wrappers for extract, findstr (SSR), findatr (approximate), and findgtr (generic) with configurable parameters and multiple output formats (TSV/CSV/FASTA/BED/GFF).
  • Documentation

    • Added user-facing manifest files describing inputs, outputs, parameters, examples, and known limitations for each tool.
  • Tests

    • Added demo test data and PyTRF test cases covering all wrappers (one extract test skipped due to upstream issue).
  • Chores

    • Added reproducible environment manifests for setup.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
PyTRF extract module
bio/pytrf/extract/{environment.yaml,environment.linux-64.pin.txt,meta.yaml,wrapper.py}, bio/pytrf/extract/test/{Snakefile,demo_data/small_test.fasta}
Added Conda environment specs (yaml + explicit pin), meta.yaml describing inputs/outputs/params (repeat_file, out_format, flank_length), Snakemake wrapper that validates inputs/params and executes pytrf extract, test Snakefile and demo FASTA.
PyTRF findatr module
bio/pytrf/findatr/{environment.yaml,environment.linux-64.pin.txt,meta.yaml,wrapper.py}, bio/pytrf/findatr/test/{Snakefile,demo_data/small_test.fasta}
Added Conda environment specs, meta.yaml for approximate tandem repeat detection (motif/seed/identity/extend params), wrapper building pytrf findatr command from params and executing it, test Snakefile and demo FASTA.
PyTRF findgtr module
bio/pytrf/findgtr/{environment.yaml,environment.linux-64.pin.txt,meta.yaml,wrapper.py}, bio/pytrf/findgtr/test/{Snakefile,demo_data/small_test.fasta}
Added Conda environment specs, meta.yaml for generic tandem repeat finder (motif/repeat/length params), wrapper constructing pytrf findgtr command and executing it, test Snakefile and demo FASTA.
PyTRF findstr module
bio/pytrf/findstr/{environment.yaml,environment.linux-64.pin.txt,meta.yaml,wrapper.py}, bio/pytrf/findstr/test/{Snakefile,test.smk,demo_data/small_test.fasta}
Added Conda environment specs, meta.yaml for simple sequence repeat detection (repeats array, out_format), wrapper handling repeats list/format params and executing pytrf findstr, two test entries (parameterized and defaults) and demo FASTA.
Pinned environment files
bio/pytrf/*/environment.linux-64.pin.txt
Added explicit Conda pin files listing exact package URLs/hashes for each module (platform/linux-64 snapshots).
Test infrastructure
test_wrappers.py
Added tests: test_pytrf_findstr, test_pytrf_findstr_defaults, test_pytrf_findgtr, test_pytrf_findatr, test_pytrf_extract (marked skipped with pytest.mark.skip).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Areas needing attention:
    • Parameter parsing/validation logic in each wrapper (differences in repeats list handling, numeric params, out_format).
    • Error handling and logging behavior in wrapper scripts.
    • Consistency between meta.yaml documentation and wrapper parameter handling.
    • Pin files are large static manifests — verify channel/source alignment if needed.

Suggested reviewers

  • fgvieira
  • johanneskoester

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding individual Snakemake wrappers for pytrf sub-commands (findstr, findgtr, findatr, extract), which aligns with the changeset's primary focus.
Description check ✅ Passed The description follows the template structure, includes a clear explanation of the changes, and provides a completed QC checklist addressing all required contribution guidelines.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e93f085 and c0f2aaf.

📒 Files selected for processing (1)
  • bio/pytrf/findatr/meta.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • bio/pytrf/findatr/meta.yaml
⏰ 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: testing
  • GitHub Check: docs
  • GitHub Check: Summary

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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.4 pin 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 on pyfastx (or explain in the PR description why =2.2 is required for pytrf 1.4).

For example:

 dependencies:
   - pytrf =1.4
-  - pyfastx =2.2
+  - pyfastx

As 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.4 are in line with the documented conventions. If there is no strict compatibility reason, you could consider unpinning pyfastx here as well to follow the “only pin main tool” guideline, for example:

 dependencies:
   - pytrf =1.4
-  - pyfastx =2.2
+  - pyfastx

If 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.4 follows the documented pattern. As with the other PyTRF envs, you may want to unpin pyfastx unless =2.2 is required, to better follow the “only pin the main package” convention.

 dependencies:
   - pytrf =1.4
-  - pyfastx =2.2
+  - pyfastx

Based on the shared environment.yaml guidelines for this repo.

bio/pytrf/findgtr/environment.yaml (1)

1-8: Consider relaxing the pyfastx version pin

The channels and pytrf pin look good. Given the wrapper guidelines for environment.yaml, it might be better to only pin the main tool (pytrf) and either (a) drop pyfastx entirely or (b) at least omit its explicit version (- pyfastx) so bioconda can manage the dependency, unless you know =2.2 is strictly required.

bio/pytrf/findgtr/wrapper.py (1)

13-23: Wrapper works, but you can simplify path handling and error wrapping

Overall the wrapper is functionally sound and matches how the test Snakefile and meta.yaml describe findgtr. Two (optional) simplifications you might consider:

  1. Avoid Path(...).resolve() for inputs/outputs (lines 15–16, 22).
    Using the raw snakemake.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.

  2. Drop most of the try/except wrapping (lines 13–18, 27–43, 53–56).
    Snakemake already surfaces clear errors if snakemake.input/params are mis-specified or if shell() fails, so the extra ValueError/RuntimeError layers 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

📥 Commits

Reviewing files that changed from the base of the PR and between 12f2191 and e93f085.

⛔ Files ignored due to path filters (5)
  • bio/pytrf/extract/test/demo_data/small_test.tsv is excluded by !**/*.tsv
  • bio/pytrf/extract/test/expected/extract_basic.tsv is excluded by !**/*.tsv
  • bio/pytrf/findatr/test/expected/findatr_basic.tsv is excluded by !**/*.tsv
  • bio/pytrf/findgtr/test/expected/findgtr_basic.tsv is excluded by !**/*.tsv
  • bio/pytrf/findstr/test/expected/findstr_basic.csv is 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 the self argument of methods.
Do not suggest type annotation of the cls argument of classmethods.
Do not suggest return type annotation if a function or method does not contain a return statement.

Files:

  • bio/pytrf/findstr/wrapper.py
  • bio/pytrf/findatr/wrapper.py
  • bio/pytrf/findgtr/wrapper.py
  • bio/pytrf/extract/wrapper.py
  • test_wrappers.py
**/wrapper.py

⚙️ CodeRabbit configuration file

Do not complain about use of undefined variable called snakemake.

Files:

  • bio/pytrf/findstr/wrapper.py
  • bio/pytrf/findatr/wrapper.py
  • bio/pytrf/findgtr/wrapper.py
  • bio/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/Snakefile
  • bio/pytrf/extract/test/Snakefile
  • bio/pytrf/findstr/test/test.smk
  • bio/pytrf/findstr/test/Snakefile
  • test_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/Snakefile
  • bio/pytrf/extract/test/Snakefile
  • bio/pytrf/findstr/test/test.smk
  • bio/pytrf/findstr/test/Snakefile
  • test_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/Snakefile
  • bio/pytrf/findstr/test/test.smk
  • bio/pytrf/findstr/wrapper.py
  • bio/pytrf/findatr/wrapper.py
  • bio/pytrf/findgtr/wrapper.py
  • bio/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/Snakefile
  • bio/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/Snakefile
  • bio/pytrf/findstr/test/test.smk
  • bio/pytrf/findstr/test/Snakefile
  • test_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/Snakefile
  • bio/pytrf/findstr/test/Snakefile
  • test_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.yaml
  • bio/pytrf/findatr/environment.yaml
  • bio/pytrf/extract/environment.yaml
  • bio/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.yaml
  • bio/pytrf/findatr/environment.yaml
  • bio/pytrf/extract/environment.yaml
  • bio/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.yaml
  • bio/pytrf/findatr/environment.linux-64.pin.txt
  • bio/pytrf/findstr/environment.linux-64.pin.txt
  • bio/pytrf/findatr/environment.yaml
  • bio/pytrf/extract/environment.yaml
  • bio/pytrf/extract/environment.linux-64.pin.txt
  • bio/pytrf/findstr/environment.yaml
  • bio/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.yaml
  • bio/pytrf/findatr/environment.linux-64.pin.txt
  • bio/pytrf/findatr/environment.yaml
  • bio/pytrf/extract/environment.yaml
  • bio/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.yaml
  • bio/pytrf/findatr/environment.yaml
  • bio/pytrf/extract/environment.yaml
  • bio/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.txt
  • bio/pytrf/findstr/environment.linux-64.pin.txt
  • bio/pytrf/extract/environment.linux-64.pin.txt
  • bio/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.py
  • bio/pytrf/findatr/wrapper.py
  • bio/pytrf/findgtr/wrapper.py
  • bio/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.py
  • bio/pytrf/findatr/wrapper.py
  • bio/pytrf/findgtr/wrapper.py
  • bio/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.py
  • bio/pytrf/findatr/wrapper.py
  • bio/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.py
  • bio/pytrf/findatr/wrapper.py
  • bio/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.py
  • bio/pytrf/findatr/wrapper.py
  • bio/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.py
  • bio/pytrf/findatr/wrapper.py
  • bio/pytrf/findgtr/wrapper.py
  • bio/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.py
  • bio/pytrf/findatr/wrapper.py
  • bio/pytrf/findgtr/wrapper.py
  • bio/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.py
  • bio/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 --explicit export 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 with environment.yaml.

bio/pytrf/findstr/meta.yaml (1)

1-33: Clear, consistent tool metadata

The 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 consistent

The 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 behavior

The sample rule cleanly demonstrates running findstr with 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 fine

The explicit linux-64 pin file appears to be a standard conda list --explicit style export including pytrf and pyfastx; nothing stands out that would need manual adjustment.

bio/pytrf/extract/environment.linux-64.pin.txt (1)

1-37: Explicit environment snapshot is consistent

This 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 contract

The 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 solid

Input/output resolution, required repeat_file enforcement, optional out_format/flank_length handling, 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 options

The 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 wrapper

Sample 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 parameters

The rule’s input/output/log paths and repeats/out_format params 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‑generated

The 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 limitations

The 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 usage

Input/output resolution, optional out_format, and list/tuple‑based repeats handling map cleanly to the pytrf findstr CLI, 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 output

The pytrf_extract rule uses the expected repeat_file param, 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.skip with 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:

  1. 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
  2. Test pattern analysis: The code snippet shows three test functions that follow a standard pattern:

    • test_pytrf_findstr - compares results/small_test.csv with expected/findstr_basic.csv
    • test_pytrf_findgtr - compares results/small_test.tsv with expected/findgtr_basic.tsv
    • test_pytrf_findatr - compares results/small_test.tsv with expected/findatr_basic.tsv
  3. Verification 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
  4. 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.

Comment on lines +36 to +40
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}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these parameters mandatory?

Copy link
Contributor Author

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

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.

2 participants