twitcher 0.7.0

Find template switch mutations in genomic data
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.7.0]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.6.9...v0.7.0 - 2026-09-03

### Added

- output alignment statistics to a csv file

### Fixed

- *(vcf)* align on the edited cluster region
- *(vcf)* strip the entire shared allele prefix
- clippy

## [0.6.9]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.6.8...v0.6.9 - 2026-09-03

### Added

- *(vcf)* log failed alignments with OOM or timeout (need at least -vv)

### Fixed

- align VCF and BAM coordinates
- *(tsalign)* disable range extension
- clippy
- clippy continued, refactoring
- bunch of clippy warnings
- clustering algorithm now handles length-changing MNVs
- change default min-density to 0, effectively deprecating the setting

### Other

- *(vcf)* cover undeclared and mismatched FORMAT fields
- *(vcf)* split input and output record types
- update minimum rust version to 1.96

## [0.6.8]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.6.7...v0.6.8 - 2026-08-17

### Fixed

- don't abort on overlapping equal-cost-ranges (although they are not sound)

## [0.6.7]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.6.6...v0.6.7 - 2026-08-14

### Added

- *(vcf)* add `allele_count` to csv output

### Fixed

- handle off-path cluster offsets
- do not abort on missing contig

## [0.6.6]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.6.5...v0.6.6 - 2026-08-11

### Added

- *(phasing)* add `-f` and `-F` to filter reads for phasing

## [0.6.5]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.6.4...v0.6.5 - 2026-08-10

### Added

- *(viz)* upgrade lib_ts*, migrating `-e` for more equal cost rendering modes
- upgrade `--output-unresolvable` to show the reason and more information
- assert that VCF version is between 4.2 and 4.5

### Fixed

- *(vcf)* do not stumble on a star allele (overlapping deletion)
- use generic `tsalign` API instead of configurable to reduce binary size and compile times

## [0.6.4]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.6.3...v0.6.4 - 2026-08-05

### Fixed

- *(vcf)* Add missing PS header if not already present
- *(tests)* Change test data so that tsalign v4 does not hallucinate forward template switches

## [0.6.3]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.6.2...v0.6.3 - 2026-08-03

### Added

- upgrade upstream tsalign to v4

### Fixed

- *(cluster)* make VCF and BAM clustering consistent
- wording of settings warning

## [0.6.2]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.6.1...v0.6.2 - 2026-07-30

### Added

- add warnings for non-sensical or likely unintended settings
- *(csv)* add ts_2_3_min and ..._max fields to csv output

### Fixed

- *(csv)* on invalid equal-cost ranges, output null string

## [0.6.1]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.6.0...v0.6.1 - 2026-07-27

### Added

- *(vcf)* flag records with rewritten GT/PS

## [0.6.0]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.5.0...v0.6.0 - 2026-06-26

### Added

- *(fpa)* charge first_offset offset cost
- *(fpa)* add forward template switch matrices to fpa
- early-return with -t/-T: done if no contigs left
- *(clustering)* gate edit-mass behind --cluster-strategy
- *(clustering)* [**breaking**] Add --min-mass which makes it easier to target indels. Change default min_records to 1

### Fixed

- *(fpa)* correct forward TS first_offset
- *(fpa)* correct first_offset
- *(vcf)* ignore missing / no alt records
- *(vcf)* in single-unphased-het clusters, validate haplotype clusters before emitting
- add newline to stats output
- *(costs)* disable rr and qq and penalize secondary forward edits higher

### Other

- *(fpa)* deduplicate code for the four TS matrices
- *(fpa)* replace jump enum variants with cell back-pointer
- *(fpa)* add some more strict tests to fpa

## [0.5.0]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.4.0...v0.5.0 - 2026-06-15

### Added

- *(vcf)* resolve singleton unphased het with hom-alt

### Fixed

- *(vcf)* update tests for new phasing fn signatures
- *(vcf)* don't treat empty subclusters as error after phasing

### Other

- [**breaking**] update to tsalign v3
  - This includes renames "primary" -> "descendant" and "secondary" -> "ancestor"
  - Existing cost files will need to be updated: `sed -i 's/AntiPrimary/AntiDescendant/g' <cost-file>`

## [0.4.0]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.3.4...v0.4.0 - 2026-06-08

### Added

- *(vcf)* add --output-unresolvable
- *(vcf)* unify and refactor counters
- *(vcf)* MAPQ and base-quality gates for phasing
- *(vcf)* granular phasing resolution counters
- *(vcf)* reconstruct per-haplotype records on passthrough
- *(vcf)* thread allele number through phasing downstream
- *(vcf)* refactor phasing to allow for 1/2 records
- *(vcf)* implement local read-based phasing
- *(vcf)* haplotype-aware cluster splitting

### Fixed

- *(vcf)* ignore ref/ref reads in local phasing
- *(vcf)* add hom-alt into phased haplotype groups
- *(vcf)* remove unneccessary debug info
- *(vcf)* clippy
- *(vcf)* add reference to phasing bam reader to allow cram files
- *(vcf)* clippy + cargo-fmt
- *(vcf)* some more phasing fixes

### Other

- *(vcf)* add phasing trace logging, fix stats separator
- *(vcf)* add documentation on phasing
- *(vcf)* assert slot-to-haplotype phasing orientation
- *(vcf)* tests for local read-phasing
- *(vcf)* verify split-haplotype cluster correlation
- *(vcf)* remove phasing to re-implement from scratch

## [0.3.4]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.3.3...v0.3.4 - 2026-06-01

### Added

- *(viz)* accept float-formatted integers (42.0) in input CSV

## [0.3.3]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.3.2...v0.3.3 - 2026-05-26

### Added

- add --range-extension parameter to expand AlignmentRange

### Fixed

- *(vcf)* remove dead clear_cache() call; reads clears on tid change
- *(align)* release cache lock before DB write; close in_progress/finished gap
- *(vcf)* record first write error and return it after draining all messages
- *(vcf)* propagate Clusterizer init errors instead of silently producing empty output
- *(vcf)* flush SortingWriter explicitly before drop to propagate tail errors
- *(vcf)* track rid in FilteredOutputWriter to prevent cross-contig window bleed
- *(reads)* propagate CSV flush error from writer task
- *(vcf)* propagate BAM open error instead of panicking
- *(vcf)* warn on multi-allelic records in apply_mutations

### Other

- *(reads)* rename find_clusters -> find_cigar_clusters
- *(vcf)* replace bcf::Read impl with inherent methods
- *(reads)* replace htslib::Read impl with inherent methods
- *(vcf)* rename ClusterSettings -> ClusterizerSettings
- *(vcf)* document why alt_context_region equals ref_context_region
- *(reads)* remove obsolete channel from ClusterFinder
- *(reads)* cache hot counters outside read/cluster loops
- remove commented-out dbg! blocks

## [0.3.2]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.3.1...v0.3.2 - 2026-05-21

### Added

- *(viz)* only require the necessary fields in the input csv
- *(vcf)* warn if the input vcf has more than one sample
- remove -s flag to avoid confusion with -s from bcftools. --soft-mask still works as before.

### Fixed

- *(align)* re-enable extension of alignment ranges in tsalign

## [0.3.1]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.3.0...v0.3.1 - 2026-05-19

### Added

- *(vcf)* write cluster hash as VCF info field TSID
- *(vcf)* report TSCOST, TSINNERLEN, TSJUMP in output records
- *(align)* option to output failed alignment regions to file

### Fixed

- *(vcf)* compute AN from called genotype alleles, not ALT count
- clippy

### Other

- *(vcf)* verify variant ID written to VCF records

## [0.3.0]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.2.2...v0.3.0 - 2026-05-19

### Added

- *(db)* store constraints, retry OOM/timeout on larger limits

### Fixed

- *(docs)* small fixes in the cli help options ([#59]https://version.helsinki.fi/kraujasp/twitcher/pulls/59)

### Other

- *(reads)* add DB retry integration test for OOM with larger memory

## [0.2.2]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.2.1...v0.2.2 - 2026-05-13

### Added

- *(build)* update caching mechanism for gitlab runner

### Fixed

- *(vcf)* fix potential NPE
- *(build)* simplify CI build with stages

### Other

- *(vcf)* add crash regression from #58 as test
- add --fpa flag tests to vcf_tests and reads_tests
- add reads/viz integration tests, restructure test modules
- add meaningful integration tests with real WGS data

## [0.2.1]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.2.0...v0.2.1 - 2026-05-12

### Other

- update Cargo.toml dependencies

## [0.2.0]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.1.13...v0.2.0 - 2026-05-12

### Added

- *(align)* update default costs to something slightly more sensible
- include a default `.tsa` cost file in our repo
- *(align)* Allow to restrict that all TSMs have the same descendant
- *(viz)* align the cli interface more with `tsalign`
- *(viz)* add flags for eq range visualisation and context
- *(viz)* use id instead of cluster number for output files

### Fixed

- *(align)* flip default, `--only-equal-descendants` becomes `--allow-mixed-descendants`
- rename variable
- temporatily disable assertion

### Other

- update deps

## [0.1.13]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.1.12...v0.1.13 - 2026-05-07

### Added

- *(fpa)* add RQR template switch support
- add id to csv output that is a unique hash

## [0.1.12]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.1.11...v0.1.12 - 2026-04-30

### Fixed

- *(vcf)* repair progress bar
- *(clippy)* some pedantic / nursery lints

## [0.1.11]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.1.10...v0.1.11 - 2026-04-29

### Other

- update Cargo.lock dependencies

## [0.1.10]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.1.9...v0.1.10 - 2026-04-27

### Fixed

- *(fpa)* correct first_offset coordinate system
- *(reads)* exclude soft-clipped bases from window
- *(reads)* fix alignment indexing error

## [0.1.9]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.1.8...v0.1.9 - 2026-04-23

### Added

- *(viz)* Add id selector
- *(vcf)* enable csv output, some small buxfixes to make that happen
- *(viz)* add svg visualization subcommand
- *(csv)* output MI-string and alignment details

### Fixed

- clippy
- *(build)* update rust to 1.88 (needed by lib_tsshow)
- *(deps)* use crates.io version of tsalign libs

### Other

- update reads and vcf pipelines to use new alignment types
- extract alignment operations into dedicated module

## [0.1.8]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.1.7...v0.1.8 - 2026-03-25

### Added

- use new cluster density also in \'reads\' mode
- *(vcf)* expose clustering settings, add density parameter

### Fixed

- apply custom costs to tsalign (lost during refactor)

### Other

- write up some basic functionality

## [0.1.7]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.1.6...v0.1.7 - 2026-03-19

### Fixed

- test (again...)
- use characters M and X in vcf output cigar strings
- fix a test failure that expected M instead of = in cigar string

### Other

- update lib_tsalign to version 1

## [0.1.6]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.1.5...v0.1.6 - 2026-03-10

### Added

- add cram support
- add database feature to store known alignment cases
- in-memory deduplication of alignments
- show running alignments in progress bar

### Fixed

- buffer db writes, refactor counters
- Handle matches (eq or diff) properly in reads mode
- simplify dependencies
- some test coverage
- reduce tokio features

## [0.1.5]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.1.4...v0.1.5 - 2026-02-27

### Added

- parameter for buffer size, smaller tweaks
- rewrite many methods to async
- basic setup for tokio
- implement timeout for worker
- properly limit memory usage per alignment
- more info in log messages
- describe subcommands
- update to latest lib_tsalign with serde support

### Fixed

- lots of clippy fixes about number conversions, some of which have caused issues crashed
- differentiate between non-zero exit and signal termination
- Use subprocesses for the aligner to fail gracefully

## [0.1.4]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.1.3...v0.1.4 - 2026-02-18

### Added

- Refactor plumbing code to allow a selection of the aligner
- implement DP-based Four-Point-Aligner
- add --min-quality to require minimum quality for cluster bases
- *(vcf)* add command to output header
- some progress bars and less memory usage

### Fixed

- indexing bug in record creation, allow for full-range TSes in FPA
- clippy
- small changes to --help
- update test method to use new `augment_header` method
- make memory limit arg global so that it can be used at any point
- don't exclude reference parts with lowercase, even with --soft-mask
- use capped allocator for memory limit

## [0.1.3]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.1.2...v0.1.3 - 2026-02-02

### Added

- Add counters for alignments to reads mode
- add counters and runtime to reads mode (and refactor)

### Fixed

- use bounded channels to avoid uncontrolled memory growth

## [0.1.2]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.1.1...v0.1.2 - 2026-01-30

### Added

- unify the alignment tpool stuff, report alignment cost without TS for reads mode

### Fixed

- coordinate fix in soft mask feature
- update readme to use published twitcher version

## [0.1.1]https://version.helsinki.fi/kraujasp/twitcher/compare/v0.1.0...v0.1.1 - 2026-01-30

### Other

- Add some metadata to Cargo.toml