Repository navigation
Tsls integration - #637
Merged
Merged
Tsls integration#637
Conversation
added 5 commits
October 30, 2026 13:44
Replace tsinfer's TreeSequenceBuilder and AncestorMatcher with the tsls HMM, and drop the tsinfer dependency. - tsls matches against the tree sequence directly, with the alleles ACGT- (indexed as in core.IUPAC_ALLELES), so the site-index coordinate map is gone and paths are in genome coordinates. - sc2ts's model, in which a recombination costs k mismatches, is tsls's model with r = tsls.model.recombination_probability(rho, n). With deletions as missing data, the mismatch probability for 5 alleles has the odds of mu with 4. - The matching passes use exact prune thresholds (cost_threshold, from tsls.model.path_threshold), so a match costing at most the pass's bound is optimal. The first two passes of match_samples bound the cost by k + 1, the cost they accept; the final pass by the cost of the previous match. - tsls can copy the vestigial root, node 0, which ties with the reference, node 1, so paths copy node 1 wherever tsls copies node 0 (check_vestigial_root, copy_node1_for_node0). - characterise_recombinants finds the interval between the sites where the parents differ on either side of a breakpoint, wherever the breakpoint is in it, as tsls doesn't specify where it places a switch among equally likely positions. - match_tsinfer is renamed match_tsls. All test results are unchanged. The ARGs that the test fixtures build are identical up to 2020-02-11; on 2020-02-13 one sample has a different match of the same cost (four mutations, parent 47 rather than 39), which changes metadata but not the topology. tsls is a dependency from GitHub until it's released. The lockfile needs to be regenerated once tsls's main branch has the new layout.
tests/test_tsls_contract.py calls tsls with the parameters that sc2ts computes, so that changes in tsls that would break sc2ts are caught: the allele encoding, including deletions and missing data; the tie between the vestigial root and the reference; isolated (future) nodes not being copied; one recombination costing k mismatches, with and without deletions as missing data; the exactness of the cost thresholds; the path format; and sharing a tsls tree sequence between threads.
tsls now exports its whole API from the tsls namespace, rather than from tsls.model.
tsls's main branch now has the version sc2ts uses (a32ce06). tsinfer and the dependencies only it needed (daiquiri, lmdb, sortedcontainers and others) are no longer locked.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #637 +/- ##
==========================================
+ Coverage 88.64% 88.72% +0.08%
==========================================
Files 12 12
Lines 4323 4336 +13
Branches 622 624 +2
==========================================
+ Hits 3832 3847 +15
+ Misses 362 361 -1
+ Partials 129 128 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
Author
|
According to the benchmarks here this should be a major performance improvement for sc2ts, dropping the time and memory required for difficult matches by 10X or more. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.