Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 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 Nov 26, 2025
f01dfd2
feat/add_pytrf: delete unified wrapper approach
rohan-ibn-tariq Nov 26, 2025
4e1e6bb
feat/add_pytrf: add findstr basic wrapper
rohan-ibn-tariq Nov 26, 2025
70294eb
feat/add_pytrf: add findgtr basic wrapper
rohan-ibn-tariq Nov 27, 2025
c2260fa
feat/add_pytrf: add in meta discalaimer note
rohan-ibn-tariq Nov 27, 2025
cfefde7
feat/add_pytrf: fix output docs
rohan-ibn-tariq Nov 27, 2025
ba3ca6f
feat/add_pytrf: add end line
rohan-ibn-tariq Nov 27, 2025
dcbefdf
feat/add_pytrf: add pytrf subcommand findatr
rohan-ibn-tariq Nov 27, 2025
9daf5f1
feat/add_pytrf: black fmt for test_wrappers.py and basic pytrf tests …
rohan-ibn-tariq Nov 27, 2025
e4b5aa0
feat/add_pytrf: update with expected results test info and doc-comments
rohan-ibn-tariq Nov 27, 2025
4c87765
feat/add_pytrf: update with expected results test info and defaults test
rohan-ibn-tariq Nov 27, 2025
6e357ed
feat/add_pytrf: finalize findgtr with expected results very basic min…
rohan-ibn-tariq Nov 27, 2025
fd0b7f4
feat/add_pytrf: add comparison for findgtr minimal
rohan-ibn-tariq Nov 27, 2025
0dd30f6
feat/add_pytrf: refactor doc
rohan-ibn-tariq Nov 27, 2025
0fe268f
feat/add_pytrf: refactor doc
rohan-ibn-tariq Nov 27, 2025
86adfd6
feat/add_pytrf: add expected test for findatr + doc refactor
rohan-ibn-tariq Nov 27, 2025
653e9c5
feat/add_pytrf: remove python pins not required
rohan-ibn-tariq Nov 27, 2025
5b505fe
feat/add_pytrf: fix extract test
rohan-ibn-tariq Nov 27, 2025
55b31be
feat/add_pytrf: fix url and add additional note
rohan-ibn-tariq Nov 27, 2025
6cc90bd
feat/add_pytrf: black fmt wrapper.py
rohan-ibn-tariq Nov 27, 2025
8c2eb7d
feat/add_pytrf: snakefile fmt findatr findstr
rohan-ibn-tariq Nov 27, 2025
59e569f
feat/add_pytrf: pylint fixes for pytrf findstr
rohan-ibn-tariq Nov 27, 2025
8bbe890
feat/add_pytrf: pylint fixes for pytrf findgtr
rohan-ibn-tariq Nov 27, 2025
b29a28a
feat/add_pytrf: pylint fixes for pytrf findatr
rohan-ibn-tariq Nov 27, 2025
19530be
feat/add_pytrf: add extract but test failing
rohan-ibn-tariq Nov 27, 2025
718846c
feat/add_pytrf: add extract command issue in pytest skip and meta.yaml
rohan-ibn-tariq Nov 27, 2025
7b43c71
feat/add_pytrf: refactor meta.yaml's of 4 commands
rohan-ibn-tariq Nov 27, 2025
04b9263
feat/add_pytrf: refactor meta.yaml for findatr
rohan-ibn-tariq Nov 27, 2025
75421c4
feat/add_pytrf: pin envoirnments for four subcommands
rohan-ibn-tariq Nov 27, 2025
e93f085
feat/add-pytrf: merge branch master
rohan-ibn-tariq Nov 27, 2025
c0f2aaf
feat/add-pytrf: refactor meta.yaml
rohan-ibn-tariq Nov 27, 2025
df84e32
Deleting the pinned environment
rohan-ibn-tariq Dec 5, 2025
6da0812
feat/add_pytrf: remove pyfastx dependency due to upstream fix
rohan-ibn-tariq Dec 5, 2025
b4e02df
feat/add_pytrf: remove dead code in the four wrappers
rohan-ibn-tariq Dec 5, 2025
a786bc2
Merge remote-tracking branch 'upstream/master' into feat/add-pytrf
rohan-ibn-tariq Dec 5, 2025
e1f8ef3
feat/add_pytrf: pin four pytrf wrapper environments
rohan-ibn-tariq Dec 5, 2025
2a54579
merge branch master
rohan-ibn-tariq Jan 13, 2026
53705d5
feat/add-pytrf: format test_wrapperts.py with black
rohan-ibn-tariq Jan 13, 2026
985a957
feat/add-pytrf: refactor findstr based on review
rohan-ibn-tariq Jan 20, 2026
2b02651
feat/add-pytrf: refactor findgtr based on review
rohan-ibn-tariq Jan 20, 2026
3e122b5
feat/add-pytrf: refactor findatr based on review
rohan-ibn-tariq Jan 20, 2026
bb1e68c
feat/add-pytrf: fix findstr default output call
rohan-ibn-tariq Jan 20, 2026
c0e19d3
feat/add-pytrf: fix extract based on review
rohan-ibn-tariq Jan 20, 2026
8abd076
feat/add_pytrf: refactor and fix findstr command
rohan-ibn-tariq Jan 25, 2026
2363ed2
feat/add_pytrf: refactor and fix findgtr command
rohan-ibn-tariq Jan 25, 2026
b45d897
feat/add_pytrf: refactor and fix findatr command
rohan-ibn-tariq Jan 25, 2026
85c8961
feat/add_pytrf: refactor and fix extract command
rohan-ibn-tariq Jan 25, 2026
fc9e9c4
Merge remote-tracking branch 'upstream/master' into feat/add-pytrf
rohan-ibn-tariq Jan 25, 2026
e481bad
Small tweaks
fgvieira Jan 26, 2026
d7cb22a
Small tweak
fgvieira Jan 26, 2026
b5836e1
Combine tests
fgvieira Jan 26, 2026
842f12d
Fix typo
fgvieira Jan 26, 2026
37e8d18
Small tweak
fgvieira Jan 26, 2026
8858332
Simplify shell command
fgvieira Jan 26, 2026
4697659
Code format
fgvieira Jan 26, 2026
427bd56
Code format
fgvieira Jan 26, 2026
d434dba
feat/add-pytrf: making shell block consistent with other pytrf wrappe…
rohan-ibn-tariq Jan 28, 2026
30e7ccb
feat/add-pytrf: applying cr suggestion to block output file in extra …
rohan-ibn-tariq Jan 28, 2026
1c81fbf
feat/add-pytrf: applying cr suggestion to block output file in extra …
rohan-ibn-tariq Jan 28, 2026
4c54040
feat/add-pytrf: applying cr suggestion to block output file in extra …
rohan-ibn-tariq Jan 28, 2026
ca9d6af
feat/add-pytrf: updated pytrf findstr bed output format bug in meta
rohan-ibn-tariq Jan 28, 2026
10ea6f8
Merge branch 'master' into feat/add-pytrf
fgvieira Mar 24, 2026
87e9a9d
feat/add_pytrf: convert 4 pytrf subcommand based wrappers to 1 single…
rohan-ibn-tariq Mar 31, 2026
127618d
feat/add_pytrf: delete old 4 separate wrappers
rohan-ibn-tariq Mar 31, 2026
cd32757
Merge branch 'feat/add-pytrf' of github.com:rohan-ibn-tariq/snakemake…
rohan-ibn-tariq Mar 31, 2026
130448c
Merge remote-tracking branch 'upstream/master' into feat/add-pytrf
rohan-ibn-tariq Mar 31, 2026
9f9e02d
feat/add_pytrf: refactor - remove extra spaces Snakefile
rohan-ibn-tariq Mar 31, 2026
c633f43
feat/add_pytrf: reformat Snakefiles with snakefmt 1.0
rohan-ibn-tariq Mar 31, 2026
f00ba71
feat/add_pytrf: format test_wrappers.py
rohan-ibn-tariq Mar 31, 2026
0d98ee2
feat/add_pytrf: fix typo in meta.yaml
rohan-ibn-tariq Mar 31, 2026
3c8aad0
feat/add_pytrf: change back to patch version -> snakemake-wrapper-utils
rohan-ibn-tariq Mar 31, 2026
e18fb8d
Update test_wrappers.py
fgvieira Apr 1, 2026
931f05b
Code refactor
fgvieira Apr 1, 2026
0287b39
Code refactor
fgvieira Apr 1, 2026
3a49ff7
Apply suggestion from @fgvieira
fgvieira Apr 1, 2026
0273713
feat/add_pytrf: remove extra snakefile for tests, rather add in main …
rohan-ibn-tariq Apr 13, 2026
afe426a
Merge remote-tracking branch 'upstream/master' into feat/add-pytrf
rohan-ibn-tariq Apr 13, 2026
44f7061
Code refactor
fgvieira Apr 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions bio/pytrf/environment.linux-64.pin.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
# created-by: conda 26.1.1
@EXPLICIT
https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.2.25-hbd8a1cb_0.conda#4492fd26db29495f0ba23f146cd5638d
https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.2.0-he0feb66_18.conda#239c5e9546c38a1e884d69effcf4c882
https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.2-h25fd6f3_2.conda#d87ff7921124eccd67248aa483c23fec
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-20_gnu.conda#a9f577daf3de00bca7c3c76c0ecbd1de
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.1-default_hbd61a6d_102.conda#18335a698559cdbcd86150a48bf54ba6
https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.2.0-he0feb66_18.conda#0aa00f03f9e39fb9876085dee11a85d4
https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_9.conda#d2ffd7602c02f2b316fd921d39876885
https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.7.5-hecca717_0.conda#49f570f3bc4c874a06ea69b7225753af
https://conda.anaconda.org/conda-forge/linux-64/libffi-3.5.2-h3435931_0.conda#a360c33a5abe61c07959e449fa1453eb
https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.2.0-h69a702a_18.conda#d5e96b1ed75ca01906b3d2469b4ce493
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_18.conda#1b08cd684f34175e4514474793d44bcb
https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.41.3-h5347b49_0.conda#db409b7c1720428638e7c0d509d3e1b5
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.1-h35e630c_1.conda#f61eb8cd60ff9057122a3d338b99c00f
https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h366c992_103.conda#cffd3bdd58090148f4cfcd831f4b26ab
https://conda.anaconda.org/conda-forge/linux-64/icu-78.3-h33c6efd_0.conda#c80d8a3b84358cb967fa81e7075fbc8a
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/libsqlite-3.52.0-hf4e2dac_0.conda#fd893f6a3002a635b5e50ceb9dd2c0f4
https://conda.anaconda.org/conda-forge/linux-64/python-3.12.13-hd63d673_0_cpython.conda#7eccb41177e15cc672e1babe9056018e
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-py312h71493bf_2.conda#fe85dfc20384f1055cadcf981b7da973
https://conda.anaconda.org/conda-forge/noarch/setuptools-82.0.1-pyh332efcf_0.conda#8e194e7b992f99a5015edbd4ebd38efd
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-26.0.1-pyh8b19718_0.conda#67bdec43082fd8a9cffb9484420b39a2
7 changes: 7 additions & 0 deletions bio/pytrf/environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
channels:
- conda-forge
- bioconda
- nodefaults
dependencies:
Comment thread
fgvieira marked this conversation as resolved.
- pytrf =1.4
- snakemake-wrapper-utils =0.8.0
38 changes: 38 additions & 0 deletions bio/pytrf/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: pytrf
description: >
Tandem Repeat (TR) finding and extraction toolkit.
Supports finding exact short TRs (findstr), generic TRs (findgtr),
approximate TRs (findatr), and extracting sequences (extract).
url: https://pytrf.readthedocs.io/en/latest/usage.html
authors:
- Muhammad Rohan Ali Asmat
input:
- seq: FASTA or FASTQ file (supports gzip compression)
- repeat: For extract only - TSV/CSV file from findstr/findgtr/findatr
output:
- Output file (required). Format auto-detected from file extension.
params:
- subcommand: PyTRF subcommand to run [`findstr`, `findgtr`, `findatr`, `extract`].
- extra: Additional command-line arguments passed to pytrf.
notes: >
**Subcommands:** |nl|
- findstr: Find exact short tandem repeats (STRs/microsatellites) |nl|
- findgtr: Find exact generic tandem repeats |nl|
- findatr: Find approximate/imperfect tandem repeats |nl|
- extract: **NOT WORKING** - Extract TR sequences and flanking sequence (bug in PyTRF 1.4.2, see known issues) |nl|
|nl|
**All commands require named input 'seq'** (fasta/fastq). |nl|
**Extract also requires 'repeat'** (tsv/csv from findstr/findgtr/findatr). |nl|
|nl|
**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|
|nl|
**Testing:** |nl|
This wrapper skips extract test until upstream patch is released. |nl|
|nl|
**Known issues:** |nl|
- PyTRF 1.4.2 has a bug in findstr bed output format (https://github.com/lmdu/pytrf/issues/7) |nl|
- PyTRF 1.4.2 has a bug in extract command (https://github.com/lmdu/pytrf/issues/6)
78 changes: 78 additions & 0 deletions bio/pytrf/test/Snakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
########################################################
# Snakefile for pytrf wrapper
########################################################


# SAMPLE RULE: Find exact short tandem repeats (STRs/SSRs)
rule pytrf_findstr:
input:
seq="demo_data/{sample}.fasta",
output:
"results/{sample}_findstr.csv",
log:
"logs/{sample}.log",
params:
subcommand="findstr",
extra="-r 5 1 3 3 3 3",
wrapper:
"master/bio/pytrf"


# SAMPLE RULE: Find exact STRs with default parameters
rule pytrf_findstr_defaults:
input:
seq="demo_data/small_test.fasta",
output:
"results/small_test_findstr_defaults.tsv",
log:
"logs/small_test_defaults.log",
params:
subcommand="findstr",
wrapper:
"master/bio/pytrf"


# SAMPLE RULE: Find generic tandem repeats
rule pytrf_findgtr:
input:
seq="demo_data/{sample}.fasta",
output:
"results/{sample}_findgtr.tsv",
log:
"logs/{sample}.log",
params:
subcommand="findgtr",
extra="-m 3 -r 1", # min-motif=3, min-repeat=1
wrapper:
"master/bio/pytrf"


# SAMPLE RULE: Find approximate tandem repeats
rule pytrf_findatr:
input:
seq="demo_data/{sample}.fasta",
output:
"results/{sample}_findatr.tsv",
log:
"logs/{sample}.log",
params:
subcommand="findatr",
extra="-m 3 -M 10", # min-motif-size=3, max-motif-size=10
wrapper:
"master/bio/pytrf"


# SAMPLE RULE: Extract TR sequences (NOT WORKING - see meta.yaml notes)
rule pytrf_extract:
input:
seq="demo_data/small_test_extract.fasta", # sequence fasta
repeat="demo_data/small_test_extract.tsv", # repeat file from findstr/findgtr/findatr
output:
"results/small_test_extract.tsv",
log:
"logs/small_test_extract.log",
params:
subcommand="extract",
extra="-l 150", # flank-length=150
wrapper:
"master/bio/pytrf"
2 changes: 2 additions & 0 deletions bio/pytrf/test/demo_data/small_test.fasta
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
>seq1
TCATCGGTCATCGGTCATCGGTCATCGGTCATCGG
6 changes: 6 additions & 0 deletions bio/pytrf/test/demo_data/small_test_extract.fasta
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
>seq1
TCATCGGTCATCGGTCATCGGTCATCGGTCATCGG
>seq2
ACCCCTCAGGGTACCCCTCAGGGTACCCCTCAGGGTACCCCTCAGGGTACCCCTCAGGGTACCCCTCAGGGTACCCCTCAGGGT
>seq3
TGACTATATCCGCAAATGAAGGCTGTTCTCTGACATGACTATATCCGCAAATGAAGGCTGTTCTCTGACATGACTATATCCGCAAATGAAGGCTGTTCTCTGACATGACTATATCCGCAAATGAAGGCTGTTCTCTGACA
85 changes: 85 additions & 0 deletions bio/pytrf/test/demo_data/small_test_extract.tsv
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.
1 change: 1 addition & 0 deletions bio/pytrf/test/expected/findatr_basic.tsv
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
1 change: 1 addition & 0 deletions bio/pytrf/test/expected/findgtr_basic.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
seq1 1 35 TCATCGG 7 5 35
18 changes: 18 additions & 0 deletions bio/pytrf/test/expected/findstr_basic.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
seq1,1,2,TC,2,1,2
seq1,3,4,AT,2,1,2
seq1,5,6,CG,2,1,2
seq1,7,8,GT,2,1,2
seq1,9,10,CA,2,1,2
seq1,11,12,TC,2,1,2
seq1,13,14,GG,2,1,2
seq1,15,16,TC,2,1,2
seq1,17,18,AT,2,1,2
seq1,19,20,CG,2,1,2
seq1,21,22,GT,2,1,2
seq1,23,24,CA,2,1,2
seq1,25,26,TC,2,1,2
seq1,27,28,GG,2,1,2
seq1,29,30,TC,2,1,2
seq1,31,32,AT,2,1,2
seq1,33,34,CG,2,1,2
seq1,35,36,G,2,1,2
70 changes: 70 additions & 0 deletions bio/pytrf/wrapper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
"""
Snakemake Wrapper for PyTRF
------------------------------------------------------
Tandem repeat finding and extraction toolkit.
Supports: findstr, findgtr, findatr, extract subcommands.
"""

from pathlib import Path
from snakemake.shell import shell
from snakemake_wrapper_utils.snakemake import get_format, is_arg

# Configuration variables
VALID_SUBCOMMANDS = {"findstr", "findgtr", "findatr", "extract"}
FORMAT_SUPPORT = {
"findstr": {"tsv", "csv", "bed", "gff"},
"findgtr": {"tsv", "csv", "gff"},
"findatr": {"tsv", "csv", "gff"},
"extract": {"tsv", "csv", "fasta"},
}

log = snakemake.log_fmt_shell(stdout=True, stderr=True)
extra = snakemake.params.get("extra", "")

# Get subcommand type and validate
if snakemake.params.subcommand not in VALID_SUBCOMMANDS:
raise ValueError(
f"Invalid subcommand '{snakemake.params.subcommand}'. "
f"Valid options: {', '.join(sorted(VALID_SUBCOMMANDS))}"
)

# Get repeat file (extract only)
repeat_file = ""
if snakemake.params.subcommand == "extract":
repeat_file = f"-r {snakemake.input.repeat}"
if is_arg("-r", extra) or is_arg("--repeat-file", extra):
raise ValueError(
"Repeat file is provided as input.repeat. "
"Do not specify -r/--repeat-file in params.extra"
)

# Infer and validate output format
out_format = get_format(snakemake.output[0])
if out_format not in FORMAT_SUPPORT[snakemake.params.subcommand]:
raise ValueError(
f"Unsupported format '{out_format}' for pytrf {snakemake.params.subcommand}. "
f"Supported formats: {', '.join(sorted(supported_formats))}"
)

# Validate: block format and output flags
if (
is_arg("-f", extra)
or is_arg("--out-format", extra)
or is_arg("-o", extra)
or is_arg("--out-file", extra)
):
raise ValueError(
"Output format is inferred and output path is provided through Snakemake. "
"Do not specify -f/--out-format or -o/--out-file in params.extra"
)

# Execute
shell(
"pytrf {snakemake.params.subcommand}"
" {snakemake.input.seq}"
" {repeat_file}"
" {extra}"
" -f {out_format}"
" -o {snakemake.output[0]}"
" {log}"
)
Loading
Loading