strkit 0.25.0a1__tar.gz → 0.25.0a2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. {strkit-0.25.0a1/strkit.egg-info → strkit-0.25.0a2}/PKG-INFO +147 -34
  2. {strkit-0.25.0a1 → strkit-0.25.0a2}/README.md +143 -29
  3. {strkit-0.25.0a1 → strkit-0.25.0a2}/pyproject.toml +1 -1
  4. {strkit-0.25.0a1 → strkit-0.25.0a2}/setup.py +4 -5
  5. strkit-0.25.0a2/strkit/VERSION +1 -0
  6. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/allele.py +43 -54
  7. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/call_locus.py +111 -97
  8. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/call_sample.py +1 -4
  9. strkit-0.25.0a2/strkit/call/constants.py +9 -0
  10. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/gmm.py +10 -4
  11. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/loci.py +106 -53
  12. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/output/vcf.py +6 -1
  13. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/params.py +39 -8
  14. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/realign.py +1 -0
  15. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/snvs.py +3 -8
  16. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/types.py +5 -7
  17. strkit-0.25.0a2/strkit/convert/_bed_4.py +11 -0
  18. strkit-0.25.0a2/strkit/convert/constants.py +16 -0
  19. strkit-0.25.0a2/strkit/convert/converter.py +102 -0
  20. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/convert/expansionhunter.py +3 -3
  21. strkit-0.25.0a2/strkit/convert/gangstr.py +11 -0
  22. strkit-0.25.0a2/strkit/convert/hipstr.py +11 -0
  23. strkit-0.25.0a2/strkit/convert/trf.py +64 -0
  24. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/convert/trgt.py +32 -11
  25. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/entry.py +57 -12
  26. {strkit-0.25.0a1 → strkit-0.25.0a2/strkit.egg-info}/PKG-INFO +147 -34
  27. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit.egg-info/SOURCES.txt +3 -0
  28. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit.egg-info/requires.txt +3 -3
  29. {strkit-0.25.0a1 → strkit-0.25.0a2}/tests/test_caller_loci_fns.py +3 -3
  30. strkit-0.25.0a2/tests/test_convert.py +22 -0
  31. strkit-0.25.0a1/strkit/VERSION +0 -1
  32. strkit-0.25.0a1/strkit/convert/_bed_4.py +0 -11
  33. strkit-0.25.0a1/strkit/convert/constants.py +0 -13
  34. strkit-0.25.0a1/strkit/convert/converter.py +0 -58
  35. strkit-0.25.0a1/strkit/convert/gangstr.py +0 -11
  36. strkit-0.25.0a1/strkit/convert/hipstr.py +0 -11
  37. {strkit-0.25.0a1 → strkit-0.25.0a2}/LICENSE +0 -0
  38. {strkit-0.25.0a1 → strkit-0.25.0a2}/MANIFEST.in +0 -0
  39. {strkit-0.25.0a1 → strkit-0.25.0a2}/setup.cfg +0 -0
  40. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/__init__.py +0 -0
  41. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/__init__.py +0 -0
  42. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/align_matrix.py +0 -0
  43. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/non_daemonic_pool.py +0 -0
  44. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/output/__init__.py +0 -0
  45. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/output/json_report.py +0 -0
  46. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/output/tsv.py +0 -0
  47. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/repeat_count_params.py +0 -0
  48. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/repeats.py +0 -0
  49. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/call/utils.py +0 -0
  50. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/catalog/__init__.py +0 -0
  51. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/catalog/combine.py +0 -0
  52. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/constants.py +0 -0
  53. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/convert/__init__.py +0 -0
  54. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/data/ploidy_configs/diploid_autosomes.json +0 -0
  55. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/data/ploidy_configs/diploid_xx.json +0 -0
  56. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/data/ploidy_configs/diploid_xy.json +0 -0
  57. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/data/ploidy_configs/haploid.json +0 -0
  58. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/exceptions.py +0 -0
  59. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/iupac.py +0 -0
  60. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/json.py +0 -0
  61. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/logger.py +0 -0
  62. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/mi/__init__.py +0 -0
  63. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/mi/base.py +0 -0
  64. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/mi/expansionhunter.py +0 -0
  65. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/mi/gangstr.py +0 -0
  66. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/mi/generic_vcf.py +0 -0
  67. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/mi/intervals.py +0 -0
  68. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/mi/repeathmm.py +0 -0
  69. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/mi/result.py +0 -0
  70. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/mi/straglr.py +0 -0
  71. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/mi/strkit.py +0 -0
  72. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/mi/tandem_genotypes.py +0 -0
  73. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/mi/trgt.py +0 -0
  74. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/mi/vcf_utils.py +0 -0
  75. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/ploidy.py +0 -0
  76. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/utils.py +0 -0
  77. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/viz/__init__.py +0 -0
  78. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/viz/server.py +0 -0
  79. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/viz/static/logo.png +0 -0
  80. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit/viz/templates/browser.html +0 -0
  81. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit.egg-info/dependency_links.txt +0 -0
  82. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit.egg-info/entry_points.txt +0 -0
  83. {strkit-0.25.0a1 → strkit-0.25.0a2}/strkit.egg-info/top_level.txt +0 -0
  84. {strkit-0.25.0a1 → strkit-0.25.0a2}/tests/test_caller_utils.py +0 -0
  85. {strkit-0.25.0a1 → strkit-0.25.0a2}/tests/test_iupac.py +0 -0
  86. {strkit-0.25.0a1 → strkit-0.25.0a2}/tests/test_mi_intervals.py +0 -0
  87. {strkit-0.25.0a1 → strkit-0.25.0a2}/tests/test_ploidy.py +0 -0
  88. {strkit-0.25.0a1 → strkit-0.25.0a2}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: strkit
3
- Version: 0.25.0a1
3
+ Version: 0.25.0a2
4
4
  Summary: A toolkit for analyzing variation in short(ish) tandem repeats.
5
5
  Home-page: https://github.com/davidlougheed/strkit
6
6
  Author: David Lougheed
@@ -11,7 +11,6 @@ Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
13
  Classifier: Programming Language :: Python :: 3 :: Only
14
- Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
15
14
  Classifier: Operating System :: POSIX
16
15
  Classifier: Operating System :: POSIX :: Linux
17
16
  Classifier: Operating System :: MacOS :: MacOS X
@@ -19,15 +18,15 @@ Requires-Python: ~=3.10
19
18
  Description-Content-Type: text/markdown
20
19
  License-File: LICENSE
21
20
  Requires-Dist: Flask<3.2,>=2.2.5
22
- Requires-Dist: orjson<4,>=3.9.15
21
+ Requires-Dist: orjson<4,>=3.11.1
23
22
  Requires-Dist: pysam<0.24,>=0.19
24
- Requires-Dist: numpy<1.27,>=1.23.4
23
+ Requires-Dist: numpy<3,>=2.1.3
25
24
  Requires-Dist: parasail<1.4,>=1.2.4
26
25
  Requires-Dist: pydantic<3,>=2.11.7
27
26
  Requires-Dist: scikit-learn<1.8,>=1.2.1
28
27
  Requires-Dist: scipy<1.17,>=1.10
29
28
  Requires-Dist: statsmodels<0.15,>=0.14.0
30
- Requires-Dist: strkit_rust_ext==0.25.0
29
+ Requires-Dist: strkit_rust_ext==0.26.0
31
30
  Dynamic: author
32
31
  Dynamic: author-email
33
32
  Dynamic: classifier
@@ -43,12 +42,20 @@ Dynamic: summary
43
42
  # STRkit - short tandem repeat genotyping with long reads
44
43
 
45
44
  [![PyPI version](https://badge.fury.io/py/strkit.svg)](https://badge.fury.io/py/strkit)
46
- [![BioRxiv DOI](https://img.shields.io/badge/bioRxiv-10.1101/2025.03.25.645269-B31B1B.svg)](https://doi.org/10.1101/2025.03.25.645269)
47
- [![Zenodo DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.12689906.svg)](https://doi.org/10.5281/zenodo.12689906)
48
45
 
49
- STRkit is a short tandem repeat (STR) genotyping and analysis toolkit for long read sequencing data, especially
50
- PacBio HiFi data. The STRkit software package is written in Python and is available in the PyPI package registry or as
51
- a Docker container.
46
+ STRkit is a short tandem repeat (STR) genotyping and analysis toolkit for long read sequencing data (both HiFi and ONT).
47
+ The STRkit software package is written in Python and is available in the PyPI package registry or as a Docker container.
48
+
49
+ STRkit's main advantages over other callers include:
50
+ * Better performance in some [benchmarking assessments](https://doi.org/10.1101/gr.280766.125) versus other tools;
51
+ * An on-the-fly SNV calling and local phasing step for unphased aligned reads;
52
+ * A license which allows use on any long-read sequencing data, versus TRGT whose
53
+ [license](https://github.com/PacificBiosciences/trgt/blob/main/LICENSE.md) restricts it to only PacBio data.
54
+
55
+ Some other useful features include:
56
+ * An interactive [call visualizer](#strkit-visualize-call-visualizer)
57
+ * A locus catalog [converter](#strkit-convert-str-catalog-conversion), which includes a TRF `.dat` to `BED` converter
58
+ * A pre-built Docker image ([`ghcr.io/davidlougheed/strkit`](https://ghcr.io/davidlougheed/strkit))
52
59
 
53
60
  If you use STRkit in published work, please cite our paper in *Genome Research*:
54
61
 
@@ -56,6 +63,8 @@ If you use STRkit in published work, please cite our paper in *Genome Research*:
56
63
  > David R Lougheed, Tomi Pastinen, Guillaume Bourque. *Genome Res*.
57
64
  > DOI:&nbsp;[10.1101/gr.280766.125](https://doi.org/10.1101/gr.280766.125)
58
65
 
66
+ The code for the software itself is also available and citeable in Zenodo: https://doi.org/10.5281/zenodo.12689906
67
+
59
68
  <img src="./docs/images/strkit_logo_small.png" alt="" width="500" height="324" />
60
69
 
61
70
  **Officially-supported platforms:** macOS (aarch64), Linux (amd64/aarch64)
@@ -141,7 +150,7 @@ docker run \
141
150
  -v out:/out \
142
151
  -it ghcr.io/davidlougheed/strkit call \
143
152
  /inputs/file.bam \
144
- --hq --loci /inputs/loci.bed --ref /inputs/ref.fa --incorporate-snvs /inputs/dbsnp.vcf.gz \
153
+ --loci /inputs/loci.bed --ref /inputs/ref.fa --incorporate-snvs /inputs/dbsnp.vcf.gz \
145
154
  --vcf /out/calls.vcf --no-tsv
146
155
  ```
147
156
 
@@ -179,13 +188,14 @@ long read data should still work.
179
188
  * Whole-genome and targeted genotyping modes to adjust this re-weighting.
180
189
  * Incorporation of single-nucleotide variation (SNVs) for better and faster calling plus
181
190
  additional downstream analysis possibilities.
182
- * Recommended for **HiFi data and ONT R10 data only**. In my testing, this worsens runtime and call quality for
183
- ONT ultra-long-read data, but speeds up the tool and improves call quality for HiFi/ONT R10 data.
191
+ * SNV incorporation is recommended for **HiFi data and ONT R10 data only**. In my testing, this worsens runtime and
192
+ call quality for ONT ultra-long-read data, but speeds up the tool and improves call quality for HiFi/ONT R10 data.
184
193
  * **Important note:** This functionality is best for whole-genome STR surveying. If hunting for rare / low-coverage
185
- expansions, or using targeted sequencing data, it may be best to **NOT USE** an SNV catalog to avoid discording
194
+ expansions, or using targeted sequencing data, it may be best to **NOT USE** an SNV catalog to avoid discarding
186
195
  reads with short flanking regions.
187
196
  * Parallelized for faster computing on clusters and for ad-hoc fast analysis of single samples.
188
197
  * 95% confidence intervals on calls via a user-configurable optional parametric bootstrapping process.
198
+ * Multiple motif support via [IUPAC code motifs](https://www.bioinformatics.org/sms/iupac.html).
189
199
 
190
200
 
191
201
  #### Usage:
@@ -198,16 +208,14 @@ See all parameters and example usage with a Slurm cluster:
198
208
  ```bash
199
209
  # For the dbSNP VCF used below for SNV incorporation, see https://ftp.ncbi.nih.gov/snp/organisms/human_9606/VCF/
200
210
  # (00-common_all.vcf.gz)
201
- #
202
- # "Accurate reads" here means HiFi / ONT R10 duplex reads, but in practice may also include ONT R10 simplex reads.
203
211
 
204
212
  strkit call \
205
213
  path/to/read/file.bam \ # [REQUIRED] One indexed read file (BAM/CRAM)
206
- --hq \ # If using accurate reads, enable this to get better genotyping & more robust expansion detection
207
214
  --realign \ # If using accurate reads, enable this to enable local realignment / read recovery. Good for detecting expansions, but slows down calling.
208
215
  --ref path/to/reference.fa.gz \ # [REQUIRED] Indexed FASTA-formatted reference genome
209
216
  --loci path/to/loci.bed \ # [REQUIRED] TRF-formatted (or 4-col, with motif as last column) sorted list of loci to genotype
210
- --incorporate-snvs path/to/dbsnp/00-common_all.vcf.gz \ # If you want, specify a SNV catalogue to help phase STRs & speed up calling
217
+ --annotation-file path/to/reference-annotations.gff.gz \ # Optional GFF3/GTF file to provide locus annotations (transcript/exon ID)
218
+ --incorporate-snvs path/to/dbsnp/00-common_all.vcf.gz \ # If you want, specify a SNV catalogue to help phase STRs & speed up calling with HiFi/ONT R10
211
219
  --vcf my-calls.vcf \ # Calculate consensus sequences for alleles and output a .vcf (or .vcf.gz) with call data
212
220
  --seed 183 \ # Fixed random number generator seed for replicability
213
221
  --processes 10 \ # Number of parallel processes to use; DEFAULT: 1
@@ -222,15 +230,77 @@ PacBio provides a
222
230
  for CCS alignment in this scenario. However, regular aligned readsets are fine and have been tested
223
231
  extensively.
224
232
 
225
- If you're using accurate long reads (e.g., HiFi, ONT R10 duplex) as input, **use the `--hq` and
226
- `--realign` options** to get better genotype calculation and a greater proportion of reads
227
- incorporated into the computed genotypes, respectively. These should not add much performance
228
- overhead. *In practice, these options may also aid calling with slightly-less-accurate reads.*
233
+ ###### WITH ACCURATE READS
234
+
235
+ If you're using accurate long reads (e.g., HiFi, ONT R10) as input, **use the `--realign` option**
236
+ to enable re-aligning soft-clipped reads to the reference genome. This will add a bit of
237
+ performance overhead, but can help recover some reads of interest (e.g., expansions).
238
+
239
+ *In practice, this option may also aid calling with slightly-less-accurate reads, especially if
240
+ you are looking for expansions and do not mind slower performance if the reads do not align well
241
+ to the reference genome.*
242
+
243
+ ###### WITH LOW-QUALITY READS
244
+
245
+ If you're using low-quality long reads (e.g., older ONT data), some non-default parameters may help
246
+ get the best genotyping performance:
247
+
248
+ - Reads with tandem repeat + flanking region PHRED quality below 13 are filtered out by default.
249
+ You may wish to lower this to avoid discarding reads by setting `--min-avg-phred` to a lower
250
+ value like `5`, or you can effectively disable this filter by setting it to `1`.
251
+ - We have observed some cases of 'false positive' expansion-esque reads with ONT R9 data. The
252
+ `--force-gm-filter` option can help filter these out, at the cost of reducing STRkit's
253
+ sensitivity to true expansions.
254
+
255
+ ###### WITH HAPLOTAGGED READS
229
256
 
230
257
  If you want to **incorporate haplotagging from an alignment file (`HP` tags)** into the
231
258
  process, which should speed up runtime and potentially improve calling results, you must pass
232
259
  the `--use-hp` flag.
233
260
 
261
+ ###### WITH LOW-COVEREAGE ALIGNMENT DATA
262
+
263
+ If you're calling STRs using low-coverage alignments, you may want to:
264
+
265
+ - lower the minimum number of reads per locus (`--min-reads`) to `2` (or even `1` if you're fine
266
+ with some guaranteed allelic dropout), and
267
+ - lower the minimum number of reads per allele (`--min-allele-reads`) to `1` to avoid dropout as
268
+ much as possible.
269
+ - potentially, if you desire more calls at the cost of quality, lower the minimum tandem repeat +
270
+ flanking region PHRED quality required (from its default of 13) via the `--min-avg-phred`
271
+ parameter.
272
+ - enable the `--allow-only-one-full-flank` option to discard fewer reads by including spanning
273
+ reads where only one of the two flanking sequences on either side of the repeat are of full
274
+ length (i.e., are of length `--flank-size` or higher.)
275
+
276
+ **Note:** `--min-reads` must be greater than or equal to `--min-allele-reads`.
277
+
278
+ ###### WITH TARGETED SEQUENCING DATA
279
+
280
+ If you're running STRkit with targeted sequencing data, you should put STRkit in targeted mode with the `--targeted`
281
+ flag, which slightly tweaks read re-sampling behaviour and increases the `--max-reads` default from 250 to 500.
282
+
283
+ ##### LOOKING FOR LARGE EXPANSIONS
284
+
285
+ If you're running STRkit for the purpose of finding pathogenic STR expansions or expansions of
286
+ interest, the following parameters may help increase expansion sensitivity, at the cost of
287
+ computational performance or a potential bias towards heterozygous calls:
288
+
289
+ * With a catalog of disease loci, make sure to encode all possible locus motifs of the same length
290
+ via [IUPAC codes](https://www.bioinformatics.org/sms/iupac.html) in the catalog file.
291
+ * Make sure to **NOT** enable `--force-gm-filter`, even if using lower-quality reads. Enabling this
292
+ option can filter out artifact reads with false-positive expansion-like read counts, but it will
293
+ also lower sensitivity for true expansions with low read support.
294
+ * Enable `--realign`, *even* with lower-quality reads. Reads containing expansions can be
295
+ soft-clipped by aligners like `minimap2`; the `--realign` flag can help recover these reads.
296
+ * Tune `--gm-filter-expansion-ratio` to a slightly lower value, like `3.0`. This will keep larger
297
+ alleles with low read support if they are larger than `--gm-filter-expansion-ratio` times the
298
+ size of the smaller allele.
299
+ * Enable the `--allow-only-one-full-flank` option to discard fewer reads (especially since
300
+ expansions often do not have many spanning reads) by including spanning reads where only one of the
301
+ two flanking sequences on either side of the repeat are of full length (i.e., are of length
302
+ `--flank-size` or higher.)
303
+
234
304
  ##### REGARDING SNV INCORPORATION
235
305
 
236
306
  If you want to **incorporate SNV calling** into the process, which speeds up runtime and gives
@@ -241,6 +311,16 @@ The file for GRCh38 is called `00-common_all.vcf.gz` as of time of writing.
241
311
  **Note that this does not need to be an SNV call file for your sample, specifically**; just one
242
312
  which has positions, reference/alternate alleles, and the `ID` field populated.
243
313
 
314
+ ##### REGARDING ANNOTATION
315
+
316
+ If you would like to have the IDs of **genome features** (from a `.gff3` or `.gtf` file) which
317
+ overlap STR loci in your `strkit call` output (JSON or VCF), you can pass a sorted, Tabix-indexed
318
+ annotation file path to `strkit call` with the `--annotation-file <path>` flag (replacing `<path>`
319
+ with the path to the annotation file.) This could be used for downstream analysis to find STR
320
+ variants that overlap, for example, coding sequences or gene UTRs.
321
+
322
+ For more information, see also documentation on the [Output formats](./docs/output_formats.md).
323
+
244
324
  ##### REGARDING OUTPUT
245
325
 
246
326
  If you want to output a full call report, you can use the `--json output-file.json` argument to
@@ -383,44 +463,77 @@ For other options and what they do, run `strkit mi` (with no other arguments) or
383
463
 
384
464
  ### `strkit convert`: STR catalog conversion
385
465
 
386
- STRkit takes as input a four-or-more-column BED file, structured like:
466
+ STRkit takes as input a four-or-more-column BED file, structured like one of the following:
387
467
 
388
468
  ```
389
- contig start end [0 or more extraneous columns] motif
469
+ contig start end [0 or more extraneous columns] NNN
470
+ contig start end [0 or more extraneous columns] ID=locus1;MOTIF=NNN
390
471
  ```
391
472
 
392
473
  Any extraneous columns are removed, (internally) leaving a four-column STR locus representation.
393
474
  Some other tools, e.g., [Straglr](https://github.com/bcgsc/straglr), also take a four-column STR
394
475
  BED as locus catalog input. However, other formats representing a catalog of STRs exist:
395
476
 
396
- * [Tandem Repeats Finder](https://github.com/Benson-Genomics-Lab/TRF) outputs a TSV/BED with a lot
397
- of information. This can be used as-is with STRkit, but it's safer for other tools to convert to
398
- a four-column BED format.
477
+ * [Tandem Repeats Finder](https://github.com/Benson-Genomics-Lab/TRF) outputs a `.dat` file with a lot
478
+ of information. Once converted to a BED file, this can be used as-is with STRkit, but
479
+ it's safer for other tools to convert to a four-column BED format.
480
+ See "[Converting TRF DAT files to BED](./docs/convert_trf_to_bed.md)" for more on how to do this.
481
+ * STRkit supports using [IUPAC codes] to specify motifs. Manual post-processing of TRF output would
482
+ be needed to do this.
399
483
  * [TRGT uses a custom repeat definition format](https://github.com/PacificBiosciences/trgt/blob/main/docs/repeat_files.md),
400
484
  which can specify more advanced STR structures.
485
+ * Some tools support multiple motifs (see, e.g.,
486
+ [STRchive catalogs of pathogenic loci](https://strchive.org/loci/#downloads)).
401
487
 
402
488
  #### Usage
403
489
 
404
- The `strkit convert` sub-command requires an input format (`trf` or `trgt`), an output format
405
- (many, see `strkit convert --help`), and an input file. Output is written to `stdout`.
490
+ The `strkit convert` sub-command requires an input format (`bed4`, `trf` or `trgt`), an output
491
+ format (many, see `strkit convert --help`), and an input file. Output is written to `stdout`.
492
+
493
+ If you want the output **sorted** (which many tools prefer or require), use the `--sort` flag.
406
494
 
407
495
  *Note:* Not all input/output format pairs have available converter functions; an error will be
408
496
  printed to `stderr` if one does not exist.
409
497
 
410
- For example, to convert from a TRF BED to a TRGT repeat definition BED file:
498
+ ##### TRF DAT file to TRF BED file (*UCSC-style*)
499
+
500
+ To convert from a TRF `.dat` file (as output by the TRF program) to a TRF BED file in the style of
501
+ the one obtainable from UCSC (e.g., for
502
+ [hg38](https://hgdownload.soe.ucsc.edu/goldenpath/hg38/bigZips/latest/)):
503
+
504
+ ```bash
505
+ strkit convert --in-format trf --out-format trf in_file.trf.dat > out_file.trf.bed
506
+ ```
507
+
508
+ ##### TRF DAT file to 4-column BED file
509
+
510
+ To convert from a TRF `.dat` file (as output by the TRF program) to a normal BED file:
511
+
512
+ ```bash
513
+ strkit convert --in-format trf --out-format bed4 in_file.trf.dat > out_file.bed
514
+ ```
515
+
516
+ ##### TRF BED to TRGT repeat definition file
517
+
518
+ To convert from a TRF BED to a TRGT repeat definition BED file:
411
519
 
412
520
  ```bash
413
521
  strkit convert --in-format trf --out-format trgt in_file.trf.bed > out_file.bed
414
522
  ```
415
523
 
416
- To attempt a conversion from a TRGT repeat definition file to a STRkit/four-column motif BED:
524
+ ##### TRGT repeat definition file to STRkit BED
525
+
526
+ To convert from a TRGT repeat definition file to a STRkit BED, including locus IDs if set:
417
527
 
418
528
  ```bash
419
- strkit convert --in-format trgt --out-format strkit in_file.trgt.bed > out_file.bed
529
+ strkit convert --in-format trgt --out-format strkit in_file.trgt.bed > out_file.strkit.bed
420
530
  ```
421
531
 
422
- Note that TRGT can represent STRs with complex structure that STRkit cannot, so some of these loci
423
- may not be converted (these will be logged to `stderr`).
532
+ Where possible, multiple motifs will be reconciled using [IUPAC codes](https://www.bioinformatics.org/sms/iupac.html),
533
+ which STRkit supports.
534
+
535
+ Note that TRGT can represent STRs with complex structure that STRkit cannot. In these cases, the first motif in the TRGT
536
+ locus definition will be used and a message will be logged to `stderr`.
424
537
 
425
538
 
426
539
  ## Copyright and License
@@ -1,12 +1,20 @@
1
1
  # STRkit - short tandem repeat genotyping with long reads
2
2
 
3
3
  [![PyPI version](https://badge.fury.io/py/strkit.svg)](https://badge.fury.io/py/strkit)
4
- [![BioRxiv DOI](https://img.shields.io/badge/bioRxiv-10.1101/2025.03.25.645269-B31B1B.svg)](https://doi.org/10.1101/2025.03.25.645269)
5
- [![Zenodo DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.12689906.svg)](https://doi.org/10.5281/zenodo.12689906)
6
4
 
7
- STRkit is a short tandem repeat (STR) genotyping and analysis toolkit for long read sequencing data, especially
8
- PacBio HiFi data. The STRkit software package is written in Python and is available in the PyPI package registry or as
9
- a Docker container.
5
+ STRkit is a short tandem repeat (STR) genotyping and analysis toolkit for long read sequencing data (both HiFi and ONT).
6
+ The STRkit software package is written in Python and is available in the PyPI package registry or as a Docker container.
7
+
8
+ STRkit's main advantages over other callers include:
9
+ * Better performance in some [benchmarking assessments](https://doi.org/10.1101/gr.280766.125) versus other tools;
10
+ * An on-the-fly SNV calling and local phasing step for unphased aligned reads;
11
+ * A license which allows use on any long-read sequencing data, versus TRGT whose
12
+ [license](https://github.com/PacificBiosciences/trgt/blob/main/LICENSE.md) restricts it to only PacBio data.
13
+
14
+ Some other useful features include:
15
+ * An interactive [call visualizer](#strkit-visualize-call-visualizer)
16
+ * A locus catalog [converter](#strkit-convert-str-catalog-conversion), which includes a TRF `.dat` to `BED` converter
17
+ * A pre-built Docker image ([`ghcr.io/davidlougheed/strkit`](https://ghcr.io/davidlougheed/strkit))
10
18
 
11
19
  If you use STRkit in published work, please cite our paper in *Genome Research*:
12
20
 
@@ -14,6 +22,8 @@ If you use STRkit in published work, please cite our paper in *Genome Research*:
14
22
  > David R Lougheed, Tomi Pastinen, Guillaume Bourque. *Genome Res*.
15
23
  > DOI:&nbsp;[10.1101/gr.280766.125](https://doi.org/10.1101/gr.280766.125)
16
24
 
25
+ The code for the software itself is also available and citeable in Zenodo: https://doi.org/10.5281/zenodo.12689906
26
+
17
27
  <img src="./docs/images/strkit_logo_small.png" alt="" width="500" height="324" />
18
28
 
19
29
  **Officially-supported platforms:** macOS (aarch64), Linux (amd64/aarch64)
@@ -99,7 +109,7 @@ docker run \
99
109
  -v out:/out \
100
110
  -it ghcr.io/davidlougheed/strkit call \
101
111
  /inputs/file.bam \
102
- --hq --loci /inputs/loci.bed --ref /inputs/ref.fa --incorporate-snvs /inputs/dbsnp.vcf.gz \
112
+ --loci /inputs/loci.bed --ref /inputs/ref.fa --incorporate-snvs /inputs/dbsnp.vcf.gz \
103
113
  --vcf /out/calls.vcf --no-tsv
104
114
  ```
105
115
 
@@ -137,13 +147,14 @@ long read data should still work.
137
147
  * Whole-genome and targeted genotyping modes to adjust this re-weighting.
138
148
  * Incorporation of single-nucleotide variation (SNVs) for better and faster calling plus
139
149
  additional downstream analysis possibilities.
140
- * Recommended for **HiFi data and ONT R10 data only**. In my testing, this worsens runtime and call quality for
141
- ONT ultra-long-read data, but speeds up the tool and improves call quality for HiFi/ONT R10 data.
150
+ * SNV incorporation is recommended for **HiFi data and ONT R10 data only**. In my testing, this worsens runtime and
151
+ call quality for ONT ultra-long-read data, but speeds up the tool and improves call quality for HiFi/ONT R10 data.
142
152
  * **Important note:** This functionality is best for whole-genome STR surveying. If hunting for rare / low-coverage
143
- expansions, or using targeted sequencing data, it may be best to **NOT USE** an SNV catalog to avoid discording
153
+ expansions, or using targeted sequencing data, it may be best to **NOT USE** an SNV catalog to avoid discarding
144
154
  reads with short flanking regions.
145
155
  * Parallelized for faster computing on clusters and for ad-hoc fast analysis of single samples.
146
156
  * 95% confidence intervals on calls via a user-configurable optional parametric bootstrapping process.
157
+ * Multiple motif support via [IUPAC code motifs](https://www.bioinformatics.org/sms/iupac.html).
147
158
 
148
159
 
149
160
  #### Usage:
@@ -156,16 +167,14 @@ See all parameters and example usage with a Slurm cluster:
156
167
  ```bash
157
168
  # For the dbSNP VCF used below for SNV incorporation, see https://ftp.ncbi.nih.gov/snp/organisms/human_9606/VCF/
158
169
  # (00-common_all.vcf.gz)
159
- #
160
- # "Accurate reads" here means HiFi / ONT R10 duplex reads, but in practice may also include ONT R10 simplex reads.
161
170
 
162
171
  strkit call \
163
172
  path/to/read/file.bam \ # [REQUIRED] One indexed read file (BAM/CRAM)
164
- --hq \ # If using accurate reads, enable this to get better genotyping & more robust expansion detection
165
173
  --realign \ # If using accurate reads, enable this to enable local realignment / read recovery. Good for detecting expansions, but slows down calling.
166
174
  --ref path/to/reference.fa.gz \ # [REQUIRED] Indexed FASTA-formatted reference genome
167
175
  --loci path/to/loci.bed \ # [REQUIRED] TRF-formatted (or 4-col, with motif as last column) sorted list of loci to genotype
168
- --incorporate-snvs path/to/dbsnp/00-common_all.vcf.gz \ # If you want, specify a SNV catalogue to help phase STRs & speed up calling
176
+ --annotation-file path/to/reference-annotations.gff.gz \ # Optional GFF3/GTF file to provide locus annotations (transcript/exon ID)
177
+ --incorporate-snvs path/to/dbsnp/00-common_all.vcf.gz \ # If you want, specify a SNV catalogue to help phase STRs & speed up calling with HiFi/ONT R10
169
178
  --vcf my-calls.vcf \ # Calculate consensus sequences for alleles and output a .vcf (or .vcf.gz) with call data
170
179
  --seed 183 \ # Fixed random number generator seed for replicability
171
180
  --processes 10 \ # Number of parallel processes to use; DEFAULT: 1
@@ -180,15 +189,77 @@ PacBio provides a
180
189
  for CCS alignment in this scenario. However, regular aligned readsets are fine and have been tested
181
190
  extensively.
182
191
 
183
- If you're using accurate long reads (e.g., HiFi, ONT R10 duplex) as input, **use the `--hq` and
184
- `--realign` options** to get better genotype calculation and a greater proportion of reads
185
- incorporated into the computed genotypes, respectively. These should not add much performance
186
- overhead. *In practice, these options may also aid calling with slightly-less-accurate reads.*
192
+ ###### WITH ACCURATE READS
193
+
194
+ If you're using accurate long reads (e.g., HiFi, ONT R10) as input, **use the `--realign` option**
195
+ to enable re-aligning soft-clipped reads to the reference genome. This will add a bit of
196
+ performance overhead, but can help recover some reads of interest (e.g., expansions).
197
+
198
+ *In practice, this option may also aid calling with slightly-less-accurate reads, especially if
199
+ you are looking for expansions and do not mind slower performance if the reads do not align well
200
+ to the reference genome.*
201
+
202
+ ###### WITH LOW-QUALITY READS
203
+
204
+ If you're using low-quality long reads (e.g., older ONT data), some non-default parameters may help
205
+ get the best genotyping performance:
206
+
207
+ - Reads with tandem repeat + flanking region PHRED quality below 13 are filtered out by default.
208
+ You may wish to lower this to avoid discarding reads by setting `--min-avg-phred` to a lower
209
+ value like `5`, or you can effectively disable this filter by setting it to `1`.
210
+ - We have observed some cases of 'false positive' expansion-esque reads with ONT R9 data. The
211
+ `--force-gm-filter` option can help filter these out, at the cost of reducing STRkit's
212
+ sensitivity to true expansions.
213
+
214
+ ###### WITH HAPLOTAGGED READS
187
215
 
188
216
  If you want to **incorporate haplotagging from an alignment file (`HP` tags)** into the
189
217
  process, which should speed up runtime and potentially improve calling results, you must pass
190
218
  the `--use-hp` flag.
191
219
 
220
+ ###### WITH LOW-COVEREAGE ALIGNMENT DATA
221
+
222
+ If you're calling STRs using low-coverage alignments, you may want to:
223
+
224
+ - lower the minimum number of reads per locus (`--min-reads`) to `2` (or even `1` if you're fine
225
+ with some guaranteed allelic dropout), and
226
+ - lower the minimum number of reads per allele (`--min-allele-reads`) to `1` to avoid dropout as
227
+ much as possible.
228
+ - potentially, if you desire more calls at the cost of quality, lower the minimum tandem repeat +
229
+ flanking region PHRED quality required (from its default of 13) via the `--min-avg-phred`
230
+ parameter.
231
+ - enable the `--allow-only-one-full-flank` option to discard fewer reads by including spanning
232
+ reads where only one of the two flanking sequences on either side of the repeat are of full
233
+ length (i.e., are of length `--flank-size` or higher.)
234
+
235
+ **Note:** `--min-reads` must be greater than or equal to `--min-allele-reads`.
236
+
237
+ ###### WITH TARGETED SEQUENCING DATA
238
+
239
+ If you're running STRkit with targeted sequencing data, you should put STRkit in targeted mode with the `--targeted`
240
+ flag, which slightly tweaks read re-sampling behaviour and increases the `--max-reads` default from 250 to 500.
241
+
242
+ ##### LOOKING FOR LARGE EXPANSIONS
243
+
244
+ If you're running STRkit for the purpose of finding pathogenic STR expansions or expansions of
245
+ interest, the following parameters may help increase expansion sensitivity, at the cost of
246
+ computational performance or a potential bias towards heterozygous calls:
247
+
248
+ * With a catalog of disease loci, make sure to encode all possible locus motifs of the same length
249
+ via [IUPAC codes](https://www.bioinformatics.org/sms/iupac.html) in the catalog file.
250
+ * Make sure to **NOT** enable `--force-gm-filter`, even if using lower-quality reads. Enabling this
251
+ option can filter out artifact reads with false-positive expansion-like read counts, but it will
252
+ also lower sensitivity for true expansions with low read support.
253
+ * Enable `--realign`, *even* with lower-quality reads. Reads containing expansions can be
254
+ soft-clipped by aligners like `minimap2`; the `--realign` flag can help recover these reads.
255
+ * Tune `--gm-filter-expansion-ratio` to a slightly lower value, like `3.0`. This will keep larger
256
+ alleles with low read support if they are larger than `--gm-filter-expansion-ratio` times the
257
+ size of the smaller allele.
258
+ * Enable the `--allow-only-one-full-flank` option to discard fewer reads (especially since
259
+ expansions often do not have many spanning reads) by including spanning reads where only one of the
260
+ two flanking sequences on either side of the repeat are of full length (i.e., are of length
261
+ `--flank-size` or higher.)
262
+
192
263
  ##### REGARDING SNV INCORPORATION
193
264
 
194
265
  If you want to **incorporate SNV calling** into the process, which speeds up runtime and gives
@@ -199,6 +270,16 @@ The file for GRCh38 is called `00-common_all.vcf.gz` as of time of writing.
199
270
  **Note that this does not need to be an SNV call file for your sample, specifically**; just one
200
271
  which has positions, reference/alternate alleles, and the `ID` field populated.
201
272
 
273
+ ##### REGARDING ANNOTATION
274
+
275
+ If you would like to have the IDs of **genome features** (from a `.gff3` or `.gtf` file) which
276
+ overlap STR loci in your `strkit call` output (JSON or VCF), you can pass a sorted, Tabix-indexed
277
+ annotation file path to `strkit call` with the `--annotation-file <path>` flag (replacing `<path>`
278
+ with the path to the annotation file.) This could be used for downstream analysis to find STR
279
+ variants that overlap, for example, coding sequences or gene UTRs.
280
+
281
+ For more information, see also documentation on the [Output formats](./docs/output_formats.md).
282
+
202
283
  ##### REGARDING OUTPUT
203
284
 
204
285
  If you want to output a full call report, you can use the `--json output-file.json` argument to
@@ -341,44 +422,77 @@ For other options and what they do, run `strkit mi` (with no other arguments) or
341
422
 
342
423
  ### `strkit convert`: STR catalog conversion
343
424
 
344
- STRkit takes as input a four-or-more-column BED file, structured like:
425
+ STRkit takes as input a four-or-more-column BED file, structured like one of the following:
345
426
 
346
427
  ```
347
- contig start end [0 or more extraneous columns] motif
428
+ contig start end [0 or more extraneous columns] NNN
429
+ contig start end [0 or more extraneous columns] ID=locus1;MOTIF=NNN
348
430
  ```
349
431
 
350
432
  Any extraneous columns are removed, (internally) leaving a four-column STR locus representation.
351
433
  Some other tools, e.g., [Straglr](https://github.com/bcgsc/straglr), also take a four-column STR
352
434
  BED as locus catalog input. However, other formats representing a catalog of STRs exist:
353
435
 
354
- * [Tandem Repeats Finder](https://github.com/Benson-Genomics-Lab/TRF) outputs a TSV/BED with a lot
355
- of information. This can be used as-is with STRkit, but it's safer for other tools to convert to
356
- a four-column BED format.
436
+ * [Tandem Repeats Finder](https://github.com/Benson-Genomics-Lab/TRF) outputs a `.dat` file with a lot
437
+ of information. Once converted to a BED file, this can be used as-is with STRkit, but
438
+ it's safer for other tools to convert to a four-column BED format.
439
+ See "[Converting TRF DAT files to BED](./docs/convert_trf_to_bed.md)" for more on how to do this.
440
+ * STRkit supports using [IUPAC codes] to specify motifs. Manual post-processing of TRF output would
441
+ be needed to do this.
357
442
  * [TRGT uses a custom repeat definition format](https://github.com/PacificBiosciences/trgt/blob/main/docs/repeat_files.md),
358
443
  which can specify more advanced STR structures.
444
+ * Some tools support multiple motifs (see, e.g.,
445
+ [STRchive catalogs of pathogenic loci](https://strchive.org/loci/#downloads)).
359
446
 
360
447
  #### Usage
361
448
 
362
- The `strkit convert` sub-command requires an input format (`trf` or `trgt`), an output format
363
- (many, see `strkit convert --help`), and an input file. Output is written to `stdout`.
449
+ The `strkit convert` sub-command requires an input format (`bed4`, `trf` or `trgt`), an output
450
+ format (many, see `strkit convert --help`), and an input file. Output is written to `stdout`.
451
+
452
+ If you want the output **sorted** (which many tools prefer or require), use the `--sort` flag.
364
453
 
365
454
  *Note:* Not all input/output format pairs have available converter functions; an error will be
366
455
  printed to `stderr` if one does not exist.
367
456
 
368
- For example, to convert from a TRF BED to a TRGT repeat definition BED file:
457
+ ##### TRF DAT file to TRF BED file (*UCSC-style*)
458
+
459
+ To convert from a TRF `.dat` file (as output by the TRF program) to a TRF BED file in the style of
460
+ the one obtainable from UCSC (e.g., for
461
+ [hg38](https://hgdownload.soe.ucsc.edu/goldenpath/hg38/bigZips/latest/)):
462
+
463
+ ```bash
464
+ strkit convert --in-format trf --out-format trf in_file.trf.dat > out_file.trf.bed
465
+ ```
466
+
467
+ ##### TRF DAT file to 4-column BED file
468
+
469
+ To convert from a TRF `.dat` file (as output by the TRF program) to a normal BED file:
470
+
471
+ ```bash
472
+ strkit convert --in-format trf --out-format bed4 in_file.trf.dat > out_file.bed
473
+ ```
474
+
475
+ ##### TRF BED to TRGT repeat definition file
476
+
477
+ To convert from a TRF BED to a TRGT repeat definition BED file:
369
478
 
370
479
  ```bash
371
480
  strkit convert --in-format trf --out-format trgt in_file.trf.bed > out_file.bed
372
481
  ```
373
482
 
374
- To attempt a conversion from a TRGT repeat definition file to a STRkit/four-column motif BED:
483
+ ##### TRGT repeat definition file to STRkit BED
484
+
485
+ To convert from a TRGT repeat definition file to a STRkit BED, including locus IDs if set:
375
486
 
376
487
  ```bash
377
- strkit convert --in-format trgt --out-format strkit in_file.trgt.bed > out_file.bed
488
+ strkit convert --in-format trgt --out-format strkit in_file.trgt.bed > out_file.strkit.bed
378
489
  ```
379
490
 
380
- Note that TRGT can represent STRs with complex structure that STRkit cannot, so some of these loci
381
- may not be converted (these will be logged to `stderr`).
491
+ Where possible, multiple motifs will be reconciled using [IUPAC codes](https://www.bioinformatics.org/sms/iupac.html),
492
+ which STRkit supports.
493
+
494
+ Note that TRGT can represent STRs with complex structure that STRkit cannot. In these cases, the first motif in the TRGT
495
+ locus definition will be used and a message will be logged to `stderr`.
382
496
 
383
497
 
384
498
  ## Copyright and License
@@ -1,3 +1,3 @@
1
1
  [build-system]
2
- requires = ["setuptools>=57.4.0", "wheel"]
2
+ requires = ["setuptools>=82.0.1"]
3
3
  build-backend = "setuptools.build_meta"
@@ -15,15 +15,15 @@ setup(
15
15
  python_requires="~=3.10",
16
16
  install_requires=[
17
17
  "Flask>=2.2.5,<3.2",
18
- "orjson>=3.9.15,<4",
18
+ "orjson>=3.11.1,<4",
19
19
  "pysam>=0.19,<0.24",
20
- "numpy>=1.23.4,<1.27",
20
+ "numpy>=2.1.3,<3",
21
21
  "parasail>=1.2.4,<1.4",
22
22
  "pydantic>=2.11.7,<3",
23
23
  "scikit-learn>=1.2.1,<1.8",
24
24
  "scipy>=1.10,<1.17",
25
25
  "statsmodels>=0.14.0,<0.15",
26
- "strkit_rust_ext==0.25.0",
26
+ "strkit_rust_ext==0.26.0",
27
27
  ],
28
28
 
29
29
  description="A toolkit for analyzing variation in short(ish) tandem repeats.",
@@ -38,7 +38,6 @@ setup(
38
38
  "Programming Language :: Python :: 3.12",
39
39
  "Programming Language :: Python :: 3.13",
40
40
  "Programming Language :: Python :: 3 :: Only",
41
- "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
42
41
  "Operating System :: POSIX",
43
42
  "Operating System :: POSIX :: Linux",
44
43
  "Operating System :: MacOS :: MacOS X",
@@ -47,7 +46,7 @@ setup(
47
46
  author="David Lougheed",
48
47
  author_email="david.lougheed@gmail.com",
49
48
 
50
- packages=setuptools.find_namespace_packages(),
49
+ packages=setuptools.find_namespace_packages(exclude=["tests"]),
51
50
  include_package_data=True,
52
51
 
53
52
  entry_points={
@@ -0,0 +1 @@
1
+ 0.25.0a2