-
Notifications
You must be signed in to change notification settings - Fork 203
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
Open
rohan-ibn-tariq
wants to merge
61
commits into
snakemake:master
Choose a base branch
from
rohan-ibn-tariq:feat/add-pytrf
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 53 commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
b89759c
feat/add_pytrf: add basic working code without complete wrapper just …
rohan-ibn-tariq f01dfd2
feat/add_pytrf: delete unified wrapper approach
rohan-ibn-tariq 4e1e6bb
feat/add_pytrf: add findstr basic wrapper
rohan-ibn-tariq 70294eb
feat/add_pytrf: add findgtr basic wrapper
rohan-ibn-tariq c2260fa
feat/add_pytrf: add in meta discalaimer note
rohan-ibn-tariq cfefde7
feat/add_pytrf: fix output docs
rohan-ibn-tariq ba3ca6f
feat/add_pytrf: add end line
rohan-ibn-tariq dcbefdf
feat/add_pytrf: add pytrf subcommand findatr
rohan-ibn-tariq 9daf5f1
feat/add_pytrf: black fmt for test_wrappers.py and basic pytrf tests …
rohan-ibn-tariq e4b5aa0
feat/add_pytrf: update with expected results test info and doc-comments
rohan-ibn-tariq 4c87765
feat/add_pytrf: update with expected results test info and defaults test
rohan-ibn-tariq 6e357ed
feat/add_pytrf: finalize findgtr with expected results very basic min…
rohan-ibn-tariq fd0b7f4
feat/add_pytrf: add comparison for findgtr minimal
rohan-ibn-tariq 0dd30f6
feat/add_pytrf: refactor doc
rohan-ibn-tariq 0fe268f
feat/add_pytrf: refactor doc
rohan-ibn-tariq 86adfd6
feat/add_pytrf: add expected test for findatr + doc refactor
rohan-ibn-tariq 653e9c5
feat/add_pytrf: remove python pins not required
rohan-ibn-tariq 5b505fe
feat/add_pytrf: fix extract test
rohan-ibn-tariq 55b31be
feat/add_pytrf: fix url and add additional note
rohan-ibn-tariq 6cc90bd
feat/add_pytrf: black fmt wrapper.py
rohan-ibn-tariq 8c2eb7d
feat/add_pytrf: snakefile fmt findatr findstr
rohan-ibn-tariq 59e569f
feat/add_pytrf: pylint fixes for pytrf findstr
rohan-ibn-tariq 8bbe890
feat/add_pytrf: pylint fixes for pytrf findgtr
rohan-ibn-tariq b29a28a
feat/add_pytrf: pylint fixes for pytrf findatr
rohan-ibn-tariq 19530be
feat/add_pytrf: add extract but test failing
rohan-ibn-tariq 718846c
feat/add_pytrf: add extract command issue in pytest skip and meta.yaml
rohan-ibn-tariq 7b43c71
feat/add_pytrf: refactor meta.yaml's of 4 commands
rohan-ibn-tariq 04b9263
feat/add_pytrf: refactor meta.yaml for findatr
rohan-ibn-tariq 75421c4
feat/add_pytrf: pin envoirnments for four subcommands
rohan-ibn-tariq e93f085
feat/add-pytrf: merge branch master
rohan-ibn-tariq c0f2aaf
feat/add-pytrf: refactor meta.yaml
rohan-ibn-tariq df84e32
Deleting the pinned environment
rohan-ibn-tariq 6da0812
feat/add_pytrf: remove pyfastx dependency due to upstream fix
rohan-ibn-tariq b4e02df
feat/add_pytrf: remove dead code in the four wrappers
rohan-ibn-tariq a786bc2
Merge remote-tracking branch 'upstream/master' into feat/add-pytrf
rohan-ibn-tariq e1f8ef3
feat/add_pytrf: pin four pytrf wrapper environments
rohan-ibn-tariq 2a54579
merge branch master
rohan-ibn-tariq 53705d5
feat/add-pytrf: format test_wrapperts.py with black
rohan-ibn-tariq 985a957
feat/add-pytrf: refactor findstr based on review
rohan-ibn-tariq 2b02651
feat/add-pytrf: refactor findgtr based on review
rohan-ibn-tariq 3e122b5
feat/add-pytrf: refactor findatr based on review
rohan-ibn-tariq bb1e68c
feat/add-pytrf: fix findstr default output call
rohan-ibn-tariq c0e19d3
feat/add-pytrf: fix extract based on review
rohan-ibn-tariq 8abd076
feat/add_pytrf: refactor and fix findstr command
rohan-ibn-tariq 2363ed2
feat/add_pytrf: refactor and fix findgtr command
rohan-ibn-tariq b45d897
feat/add_pytrf: refactor and fix findatr command
rohan-ibn-tariq 85c8961
feat/add_pytrf: refactor and fix extract command
rohan-ibn-tariq fc9e9c4
Merge remote-tracking branch 'upstream/master' into feat/add-pytrf
rohan-ibn-tariq e481bad
Small tweaks
fgvieira d7cb22a
Small tweak
fgvieira b5836e1
Combine tests
fgvieira 842f12d
Fix typo
fgvieira 37e8d18
Small tweak
fgvieira 8858332
Simplify shell command
fgvieira 4697659
Code format
fgvieira 427bd56
Code format
fgvieira d434dba
feat/add-pytrf: making shell block consistent with other pytrf wrappe…
rohan-ibn-tariq 30e7ccb
feat/add-pytrf: applying cr suggestion to block output file in extra …
rohan-ibn-tariq 1c81fbf
feat/add-pytrf: applying cr suggestion to block output file in extra …
rohan-ibn-tariq 4c54040
feat/add-pytrf: applying cr suggestion to block output file in extra …
rohan-ibn-tariq ca9d6af
feat/add-pytrf: updated pytrf findstr bed output format bug in meta
rohan-ibn-tariq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # This file may be used to create an environment using: | ||
| # $ conda create --name <env> --file <this file> | ||
| # platform: linux-64 | ||
| # created-by: conda 25.11.0 | ||
| @EXPLICIT | ||
| https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2#d7c89558ba9fa0495403155b64376d81 | ||
| https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.1.4-hbd8a1cb_0.conda#bddacf101bb4dd0e51811cb69c7790e2 | ||
| https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_16.conda#26c46f90d0e727e95c6c9498a33a09f3 | ||
| https://conda.anaconda.org/conda-forge/noarch/python_abi-3.12-8_cp312.conda#c3efd25ac4d74b1584d2f7a57195ddf1 | ||
| https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda#ad659d0a2b3e47e38d829aa8cad2d610 | ||
| https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-2_gnu.tar.bz2#73aaf86a425cc6e73fcf236a5a46396d | ||
| https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_16.conda#6d0363467e6ed84f11435eb309f2ff06 | ||
| https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_8.conda#51a19bba1b8ebfb60df25cde030b7ebc | ||
| https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.3-hecca717_0.conda#8b09ae86839581147ef2e5c5e229d164 | ||
| https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h9ec8514_0.conda#35f29eec58405aaf55e01cb470d8c26a | ||
| https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_16.conda#5a68259fac2da8f2ee6f7bfe49c9eb8b | ||
| https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.2-hb03c661_0.conda#c7c83eecbb72d88b940c249af56c8b17 | ||
| https://conda.anaconda.org/conda-forge/linux-64/libnsl-2.0.1-hb9d3cd8_1.conda#d864d34357c3b65a4b731f78c0801dc4 | ||
| https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_16.conda#68f68355000ec3f1d6f26ea13e8f525f | ||
| https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.3-h5347b49_0.conda#db409b7c1720428638e7c0d509d3e1b5 | ||
| https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda#edb0dca6bc32e4f4789199455a1dbeb8 | ||
| https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda#47e340acb35de30501a76c7c799c41d7 | ||
| https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.0-h26f9b46_0.conda#9ee58d5c534af06558933af3c845a780 | ||
| https://conda.anaconda.org/conda-forge/linux-64/icu-78.2-h33c6efd_0.conda#186a18e3ba246eccfc7cff00cd19a870 | ||
| https://conda.anaconda.org/conda-forge/linux-64/libxcrypt-4.4.36-hd590300_1.conda#5aa797f8787fe7a17d1b0821485b5adc | ||
| https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda#d7d95fc8287ea7bf33e0e7116d2b95ec | ||
| https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_ha0e22de_103.conda#86bc20552bf46075e3d92b67f089172d | ||
| https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda#4a13eeac0b5c8e5b8ab496e6c4ddd829 | ||
| https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45-default_hbd61a6d_105.conda#3ec0aa5037d39b06554109a01e6fb0c6 | ||
| https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.51.2-hf4e2dac_0.conda#da5be73701eecd0e8454423fd6ffcf30 | ||
| https://conda.anaconda.org/conda-forge/linux-64/python-3.12.12-hd63d673_1_cpython.conda#5c00c8cea14ee8d02941cab9121dce41 | ||
| https://conda.anaconda.org/conda-forge/noarch/packaging-26.0-pyhcf101f3_0.conda#b76541e68fea4d511b1ac46a28dcd2c6 | ||
| https://conda.anaconda.org/bioconda/linux-64/pyfastx-2.3.0-py312h4711d71_1.conda#9f9e697e132b8567f25c80673da5d4e8 | ||
| https://conda.anaconda.org/conda-forge/noarch/setuptools-80.10.1-pyh332efcf_0.conda#cb72cedd94dd923c6a9405a3d3b1c018 | ||
| https://conda.anaconda.org/bioconda/noarch/snakemake-wrapper-utils-0.8.0-pyhdfd78af_0.conda#1650e521333852f45468d97b1b2fdcce | ||
| https://conda.anaconda.org/bioconda/linux-64/pytrf-1.4.2-py312h0fa9677_1.conda#a0c079e205c567635a2b5f22054ffc62 | ||
| https://conda.anaconda.org/conda-forge/noarch/wheel-0.46.3-pyhd8ed1ab_0.conda#bdbd7385b4a67025ac2dba4ef8cb6a8f | ||
| https://conda.anaconda.org/conda-forge/noarch/pip-25.3-pyh8b19718_0.conda#c55515ca43c6444d2572e0f0d93cb6b9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| channels: | ||
| - conda-forge | ||
| - bioconda | ||
| - nodefaults | ||
| dependencies: | ||
| - pytrf =1.4 | ||
| - snakemake-wrapper-utils =0.8.0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| name: pytrf extract (NOT WORKING, see notes) | ||
| description: > | ||
| Extract tandem repeat sequences with flanking regions from DNA sequences. | ||
| Requires output from pytrf findstr, findgtr, or findatr as input. | ||
| url: https://pytrf.readthedocs.io/en/latest/usage.html#commandline-interface | ||
| authors: | ||
| - Muhammad Rohan Ali Asmat | ||
| input: | ||
| - ref: FASTA or FASTQ file (supports gzip compression) | ||
| - repeat: TSV or CSV file from pytrf findstr/findgtr/findatr | ||
| output: | ||
| - Output file (required). Format auto-detected from file extension. | ||
| params: | ||
| extra: > | ||
| Additional command-line arguments passed to pytrf extract. | ||
| See url for options. | ||
| notes: > | ||
| **Bioconda package:** https://bioconda.github.io/recipes/pytrf/README.html |nl| | ||
| **GitHub repository:** https://github.com/lmdu/pytrf |nl| | ||
| **License:** MIT License |nl| | ||
| **Disclaimer:** This is a minimal implementation supporting basic functionality. | ||
| pytrf is not a Python binding to TRF - it's an independent tool. |nl| | ||
| **Known issue:** PyTRF 1.4.2 has a bug in the `extract` command (delimiter error). |nl| | ||
| See: https://github.com/lmdu/pytrf/issues/6 |nl| | ||
| This wrapper skips extract tests until upstream patch is released. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # SAMPLE RULE: Custom parameters via extra | ||
| rule pytrf_extract: | ||
| input: | ||
| ref="demo_data/{sample}.fasta", # reference fasta | ||
| repeat="demo_data/{sample}.tsv", # repeat file from findstr/findgtr/findatr | ||
| output: | ||
| "results/{sample}_extract.tsv", | ||
| params: | ||
| extra="-l 150", # flank-length=150 | ||
| log: | ||
| "logs/{sample}.log", | ||
| wrapper: | ||
| "master/bio/pytrf/extract" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| >seq1 | ||
| TCATCGGTCATCGGTCATCGGTCATCGGTCATCGG | ||
| >seq2 | ||
| ACCCCTCAGGGTACCCCTCAGGGTACCCCTCAGGGTACCCCTCAGGGTACCCCTCAGGGTACCCCTCAGGGTACCCCTCAGGGT | ||
| >seq3 | ||
| TGACTATATCCGCAAATGAAGGCTGTTCTCTGACATGACTATATCCGCAAATGAAGGCTGTTCTCTGACATGACTATATCCGCAAATGAAGGCTGTTCTCTGACATGACTATATCCGCAAATGAAGGCTGTTCTCTGACA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| seq1 1 3 TCA 3 1 3 | ||
| seq1 4 6 TCG 3 1 3 | ||
| seq1 7 9 GTC 3 1 3 | ||
| seq1 10 12 ATC 3 1 3 | ||
| seq1 13 15 GGT 3 1 3 | ||
| seq1 16 18 CAT 3 1 3 | ||
| seq1 19 21 CGG 3 1 3 | ||
| seq1 22 24 TCA 3 1 3 | ||
| seq1 25 27 TCG 3 1 3 | ||
| seq1 28 30 GTC 3 1 3 | ||
| seq1 31 33 ATC 3 1 3 | ||
| seq1 34 36 GG 3 1 3 | ||
| seq2 1 3 ACC 3 1 3 | ||
| seq2 4 6 CCT 3 1 3 | ||
| seq2 7 9 CAG 3 1 3 | ||
| seq2 10 12 GGT 3 1 3 | ||
| seq2 13 15 ACC 3 1 3 | ||
| seq2 16 18 CCT 3 1 3 | ||
| seq2 19 21 CAG 3 1 3 | ||
| seq2 22 24 GGT 3 1 3 | ||
| seq2 25 27 ACC 3 1 3 | ||
| seq2 28 30 CCT 3 1 3 | ||
| seq2 31 33 CAG 3 1 3 | ||
| seq2 34 36 GGT 3 1 3 | ||
| seq2 37 39 ACC 3 1 3 | ||
| seq2 40 42 CCT 3 1 3 | ||
| seq2 43 45 CAG 3 1 3 | ||
| seq2 46 48 GGT 3 1 3 | ||
| seq2 49 51 ACC 3 1 3 | ||
| seq2 52 54 CCT 3 1 3 | ||
| seq2 55 57 CAG 3 1 3 | ||
| seq2 58 60 GGT 3 1 3 | ||
| seq2 61 63 ACC 3 1 3 | ||
| seq2 64 66 CCT 3 1 3 | ||
| seq2 67 69 CAG 3 1 3 | ||
| seq2 70 72 GGT 3 1 3 | ||
| seq2 73 75 ACC 3 1 3 | ||
| seq2 76 78 CCT 3 1 3 | ||
| seq2 79 81 CAG 3 1 3 | ||
| seq2 82 84 GGT 3 1 3 | ||
| seq3 1 3 TGA 3 1 3 | ||
| seq3 4 6 CTA 3 1 3 | ||
| seq3 7 9 TAT 3 1 3 | ||
| seq3 10 12 CCG 3 1 3 | ||
| seq3 13 15 CAA 3 1 3 | ||
| seq3 16 18 ATG 3 1 3 | ||
| seq3 19 21 AAG 3 1 3 | ||
| seq3 22 24 GCT 3 1 3 | ||
| seq3 25 27 GTT 3 1 3 | ||
| seq3 28 31 CT 2 2 4 | ||
| seq3 32 34 GAC 3 1 3 | ||
| seq3 35 37 ATG 3 1 3 | ||
| seq3 38 40 ACT 3 1 3 | ||
| seq3 41 44 AT 2 2 4 | ||
| seq3 45 47 CCG 3 1 3 | ||
| seq3 48 50 CAA 3 1 3 | ||
| seq3 51 53 ATG 3 1 3 | ||
| seq3 54 56 AAG 3 1 3 | ||
| seq3 57 59 GCT 3 1 3 | ||
| seq3 60 62 GTT 3 1 3 | ||
| seq3 63 66 CT 2 2 4 | ||
| seq3 67 69 GAC 3 1 3 | ||
| seq3 70 72 ATG 3 1 3 | ||
| seq3 73 75 ACT 3 1 3 | ||
| seq3 76 79 AT 2 2 4 | ||
| seq3 80 82 CCG 3 1 3 | ||
| seq3 83 85 CAA 3 1 3 | ||
| seq3 86 88 ATG 3 1 3 | ||
| seq3 89 91 AAG 3 1 3 | ||
| seq3 92 94 GCT 3 1 3 | ||
| seq3 95 97 GTT 3 1 3 | ||
| seq3 98 101 CT 2 2 4 | ||
| seq3 102 104 GAC 3 1 3 | ||
| seq3 105 107 ATG 3 1 3 | ||
| seq3 108 110 ACT 3 1 3 | ||
| seq3 111 114 AT 2 2 4 | ||
| seq3 115 117 CCG 3 1 3 | ||
| seq3 118 120 CAA 3 1 3 | ||
| seq3 121 123 ATG 3 1 3 | ||
| seq3 124 126 AAG 3 1 3 | ||
| seq3 127 129 GCT 3 1 3 | ||
| seq3 130 132 GTT 3 1 3 | ||
| seq3 133 136 CT 2 2 4 | ||
| seq3 137 139 GAC 3 1 3 | ||
| seq3 140 142 A 3 1 3 |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| """ | ||
| Snakemake Wrapper for PyTRF extract | ||
| ------------------------------------------------------ | ||
| Extract tandem repeat sequences with flanking regions. | ||
| """ | ||
|
|
||
| from pathlib import Path | ||
| from snakemake.shell import shell | ||
| from snakemake_wrapper_utils.snakemake import get_format, is_arg | ||
|
|
||
|
|
||
| # Logging | ||
| log = snakemake.log_fmt_shell(stdout=True, stderr=True) | ||
|
|
||
| # Get input file | ||
| try: | ||
| input_file = Path(snakemake.input.ref).resolve() | ||
| repeat_file = Path(snakemake.input.repeat).resolve() | ||
| except (AttributeError, TypeError) as e: | ||
| raise ValueError( | ||
| f"Input specification error: {e}. " | ||
| "Expected named inputs: ref=<fasta/fastq>, repeat=<tsv/csv>" | ||
| ) from e | ||
|
|
||
| # Get output file and determine format | ||
| try: | ||
| output_file = Path(snakemake.output[0]).resolve() | ||
| except (IndexError, TypeError) as e: | ||
| raise ValueError("Output file is required") from e | ||
|
|
||
| out_format = get_format(output_file) | ||
|
|
||
| supported_formats = {"tsv", "csv", "fasta"} | ||
|
|
||
| if out_format not in supported_formats: | ||
| raise ValueError( | ||
| f"Unsupported format '{out_format}' for pytrf extract. " | ||
| f"Supported formats: {', '.join(supported_formats)}" | ||
| ) | ||
rohan-ibn-tariq marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Additional parameters | ||
| extra = snakemake.params.get("extra", "") | ||
|
|
||
| if is_arg("-f", extra) or is_arg("--out-format", extra): | ||
| raise ValueError( | ||
| "Output format is automatically inferred from output file extension. " | ||
| "Do not specify -f/--out-format in params.extra. " | ||
| ) | ||
|
|
||
| if is_arg("-r", extra) or is_arg("--repeat-file", extra): | ||
| raise ValueError( | ||
| "Repeat file should be specified as an input. " | ||
| "Do not specify -r/--repeat-file in params.extra" | ||
| ) | ||
|
|
||
| # Build command | ||
| CMD = f"pytrf extract {input_file} -r {repeat_file} -f {out_format}" | ||
| if extra: | ||
| CMD += f" {extra}" | ||
| CMD += f" -o {output_file}" | ||
|
|
||
| # Execute | ||
| try: | ||
| shell(f"{CMD} {log}") | ||
fgvieira marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| except Exception as e: | ||
| raise RuntimeError(f"PyTRF extract execution failed: {e}") from e | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # This file may be used to create an environment using: | ||
| # $ conda create --name <env> --file <this file> | ||
| # platform: linux-64 | ||
| # created-by: conda 25.11.0 | ||
| @EXPLICIT | ||
| https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2#d7c89558ba9fa0495403155b64376d81 | ||
| https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.1.4-hbd8a1cb_0.conda#bddacf101bb4dd0e51811cb69c7790e2 | ||
| https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_16.conda#26c46f90d0e727e95c6c9498a33a09f3 | ||
| https://conda.anaconda.org/conda-forge/noarch/python_abi-3.12-8_cp312.conda#c3efd25ac4d74b1584d2f7a57195ddf1 | ||
| https://conda.anaconda.org/conda-forge/noarch/tzdata-2025c-hc9c84f9_1.conda#ad659d0a2b3e47e38d829aa8cad2d610 | ||
| https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-2_gnu.tar.bz2#73aaf86a425cc6e73fcf236a5a46396d | ||
| https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_16.conda#6d0363467e6ed84f11435eb309f2ff06 | ||
| https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_8.conda#51a19bba1b8ebfb60df25cde030b7ebc | ||
| https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.3-hecca717_0.conda#8b09ae86839581147ef2e5c5e229d164 | ||
| https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h9ec8514_0.conda#35f29eec58405aaf55e01cb470d8c26a | ||
| https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_16.conda#5a68259fac2da8f2ee6f7bfe49c9eb8b | ||
| https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.2-hb03c661_0.conda#c7c83eecbb72d88b940c249af56c8b17 | ||
| https://conda.anaconda.org/conda-forge/linux-64/libnsl-2.0.1-hb9d3cd8_1.conda#d864d34357c3b65a4b731f78c0801dc4 | ||
| https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-15.2.0-h934c35e_16.conda#68f68355000ec3f1d6f26ea13e8f525f | ||
| https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.3-h5347b49_0.conda#db409b7c1720428638e7c0d509d3e1b5 | ||
| https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda#edb0dca6bc32e4f4789199455a1dbeb8 | ||
| https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda#47e340acb35de30501a76c7c799c41d7 | ||
| https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.0-h26f9b46_0.conda#9ee58d5c534af06558933af3c845a780 | ||
| https://conda.anaconda.org/conda-forge/linux-64/icu-78.2-h33c6efd_0.conda#186a18e3ba246eccfc7cff00cd19a870 | ||
| https://conda.anaconda.org/conda-forge/linux-64/libxcrypt-4.4.36-hd590300_1.conda#5aa797f8787fe7a17d1b0821485b5adc | ||
| https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-h853b02a_0.conda#d7d95fc8287ea7bf33e0e7116d2b95ec | ||
| https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_ha0e22de_103.conda#86bc20552bf46075e3d92b67f089172d | ||
| https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_6.conda#4a13eeac0b5c8e5b8ab496e6c4ddd829 | ||
| https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.45-default_hbd61a6d_105.conda#3ec0aa5037d39b06554109a01e6fb0c6 | ||
| https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.51.2-hf4e2dac_0.conda#da5be73701eecd0e8454423fd6ffcf30 | ||
| https://conda.anaconda.org/conda-forge/linux-64/python-3.12.12-hd63d673_1_cpython.conda#5c00c8cea14ee8d02941cab9121dce41 | ||
| https://conda.anaconda.org/conda-forge/noarch/packaging-26.0-pyhcf101f3_0.conda#b76541e68fea4d511b1ac46a28dcd2c6 | ||
| https://conda.anaconda.org/bioconda/linux-64/pyfastx-2.3.0-py312h4711d71_1.conda#9f9e697e132b8567f25c80673da5d4e8 | ||
| https://conda.anaconda.org/conda-forge/noarch/setuptools-80.10.1-pyh332efcf_0.conda#cb72cedd94dd923c6a9405a3d3b1c018 | ||
| https://conda.anaconda.org/bioconda/noarch/snakemake-wrapper-utils-0.8.0-pyhdfd78af_0.conda#1650e521333852f45468d97b1b2fdcce | ||
| https://conda.anaconda.org/bioconda/linux-64/pytrf-1.4.2-py312h0fa9677_1.conda#a0c079e205c567635a2b5f22054ffc62 | ||
| https://conda.anaconda.org/conda-forge/noarch/wheel-0.46.3-pyhd8ed1ab_0.conda#bdbd7385b4a67025ac2dba4ef8cb6a8f | ||
| https://conda.anaconda.org/conda-forge/noarch/pip-25.3-pyh8b19718_0.conda#c55515ca43c6444d2572e0f0d93cb6b9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| channels: | ||
| - conda-forge | ||
| - bioconda | ||
| - nodefaults | ||
| dependencies: | ||
fgvieira marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - pytrf =1.4 | ||
| - snakemake-wrapper-utils =0.8.0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| name: pytrf findatr | ||
| description: > | ||
| Find approximate/imperfect tandem repeats from DNA sequences. | ||
| url: https://pytrf.readthedocs.io/en/latest/usage.html#commandline-interface | ||
| authors: | ||
| - Muhammad Rohan Ali Asmat | ||
| input: | ||
| - FASTA or FASTQ file (supports gzip compression) | ||
| output: | ||
| - Output file (required). Format auto-detected from file extension. | ||
| params: | ||
| extra: > | ||
| Additional command-line arguments passed to pytrf findatr. | ||
| See url for options. | ||
| notes: > | ||
| **Bioconda package:** https://bioconda.github.io/recipes/pytrf/README.html |nl| | ||
| **GitHub repository:** https://github.com/lmdu/pytrf |nl| | ||
| **License:** MIT License |nl| | ||
| **Disclaimer:** This is a minimal implementation supporting basic functionality. | ||
| pytrf is not a Python binding to TRF - it's an independent tool. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # SAMPLE RULE: Custom parameters via extra | ||
| rule pytrf_findatr: | ||
| input: | ||
| "demo_data/{sample}.fasta", | ||
| output: | ||
| "results/{sample}.tsv", | ||
| log: | ||
| "logs/{sample}.log", | ||
| params: | ||
| extra="-m 3 -M 10", # min-motif-size=3, max-motif-size=10 | ||
| wrapper: | ||
| "master/bio/pytrf/findatr" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| >seq1 | ||
| TCATCGGTCATCGGTCATCGGTCATCGGTCATCGG |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| seq1 1 35 TCATCGG 7 5.0 35 1 35 5 35 35 0 0 0 100.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| """ | ||
| Snakemake Wrapper for PyTRF findatr | ||
| ------------------------------------------------------ | ||
| Find approximate/imperfect tandem repeats. | ||
| """ | ||
|
|
||
| from pathlib import Path | ||
| from snakemake.shell import shell | ||
| from snakemake_wrapper_utils.snakemake import get_format, is_arg | ||
|
|
||
|
|
||
| # Logging | ||
| log = snakemake.log_fmt_shell(stdout=True, stderr=True) | ||
|
|
||
| # Get input file | ||
| try: | ||
| input_file = Path(snakemake.input[0]).resolve() | ||
| except (IndexError, TypeError) as e: | ||
| raise ValueError(f"Input specification error: {e}") from e | ||
|
|
||
| # Get output file and determine format | ||
| try: | ||
| output_file = Path(snakemake.output[0]).resolve() | ||
| except (IndexError, TypeError) as e: | ||
| raise ValueError("Output file is required") from e | ||
|
|
||
| out_format = get_format(output_file) | ||
|
|
||
| supported_formats = {"tsv", "csv", "gff"} | ||
|
|
||
| if out_format not in supported_formats: | ||
| raise ValueError( | ||
| f"Unsupported format '{out_format}' for pytrf findatr. " | ||
| f"Supported formats: {', '.join(supported_formats)}" | ||
| ) | ||
|
|
||
| # Additional parameters | ||
| extra = snakemake.params.get("extra", "") | ||
|
|
||
| if is_arg("-f", extra) or is_arg("--out-format", extra): | ||
| raise ValueError( | ||
| "Output format is automatically inferred from output file extension. " | ||
| "Do not specify -f/--out-format in params.extra. " | ||
| ) | ||
|
|
||
| CMD = f"pytrf findatr {input_file} -f {out_format}" | ||
| if extra: | ||
| CMD += f" {extra}" | ||
| CMD += f" -o {output_file}" | ||
|
|
||
| # Execute | ||
| try: | ||
| shell(f"{CMD} {log}") | ||
fgvieira marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| except Exception as e: | ||
| raise RuntimeError(f"PyTRF findatr execution failed: {e}") from e | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.