Pandedup: building a k-mer spectrum of HPRCv2

Previously on … Ragnar’s talks: Link to heading

Batching, Streaming, Prefetching

Today: multithreading Link to heading

I have idle CPU cores, not idle walltime

What’s in a k-mer spectrum (SPSS) Link to heading

UnitigsSimplitigs
MatchtigsMasked superstring

Overview Link to heading

Overview Link to heading

Quick & dirty: deduplicating the parse Link to heading

Deduplicating overlapping minimizer phrasesAn example of the optional forward-reference pass. Lexicographic four-base minimizers anchor phrases with 14-base overlaps. Underlines show phrase spans. Assembly 2 has a seeded random substitution. Assembly 3 shares its first phrase with the reference. Two substitutions change its anchors and phrases, with non-emitted bases dimmed. Dashed underlines mark greedily matched phrases. Separate threads process Assemblies 2 and 3. The hash set schematic shows one colored dot per stored phrase hash and a lock for each illustrated shard. Dot colors identify the assembly that supplied the phrase.(k'=4, w=25)-minimizersReferenceAAGCAATTCACGAGCTGCGGTCCAAATCGGGTAAGCCCTCCTTCGATGTGAACTACGGTTTGAGGCGATTTTCACATTTGTCCACTCAGGGAGGATGGACGCGCTAAGTCACAGAATATCParse for k=15phrasek-1=14 overlapAssembly 2AAGCAATTCACGAGCTGCGGTCCAAATCGGGTAAGCCCTCCTTCGATCTGAACTACGGTTTGAGGCGATTTTCACATTTGTCCACTCAGGGAGGATGGACGCGCTAAGTCACAGAATATCThread 1Greedily matchedAssembly 3AAGCAATTCACGAGCTGCGGTCCAAATCGGGTAAGCCCTCCTTCGATGTGAACAACGGTTTGAGGCGATTTTCTCATTTGTCCACTCAGGGAGGATGGACGCGCTAAGTCACAGAATATCThread 2Sharded set ofphrase hashes

MSS: BiGreedy via \(k\) rounds of 4-way merging Link to heading

LF-based matching at overlaps of three through zero basesEight simplitigs of length five through ten are listed by prefix in rainbow order at k equals four, using forward orientations. At each shorter overlap, the suffix keys lose their first base. Shading marks the retained bases in each already-sorted suffix range and in the prefix column. During the merge step, lines colored by source range connect each suffix to its next row. Gray shading marks the input prefixes and suffixes. Prefix keys lose their last base and keep their order. Crossed-out keys were used at a longer overlap. Each cycle shows its original contigs with the overlapping prefixes and suffixes highlighted. Dashed outlines mark the cut. Each displayed cycle contig copies the case of its span in the masked output. Cycle 1 goes from 4 to 6 to 5 and back to 4. Cutting 5 to 4 gives CTTCGgGCGTtaa. Cycle 2 goes from 8 to 2 to 1 to 3 to 7 and back to 8. Cutting 7 to 8 gives TGCATACaCAGTCACCAATtcCATGatTCTGTttt. The first cut has zero overlap and the second has one base of overlap. Lowercase marks excluded 4-mer starts.k=4 simplitigs1ACCAATTCC2CAGTCACC3CATGATT4CTTCG5GCGTTAA6TCGGGC7TCTGTTTT8TGCATACACAOverlap 3SuffixesPrefixesMerge-sort8ACA2ACC3ATT6GGC5TAA1TCC4TCG7TTT1ACC2CAG3CAT4CTT5GCG6TCG7TCT8TGCOverlap 2SuffixesPrefixesMerge-sort5AA8CA2CC1CC4CG6GC3TT7TT1AC2CA3CA4CT5GC6TC7TC8TGOverlap 1SuffixesPrefixes5A8A2C1C6C4G3T7T1A2C3C4C5G6T7T8TOverlap 0SuffixesPrefixes5ε8ε2ε1ε6ε4ε3ε7ε1ε2ε3ε4ε5ε6ε7ε8εCycle 14362500 · cut4ContigsCTTCGTCGgGCGCGTtaaMasked outputCTTCGgGCGTtaalowercase = skipped 4-mer startCycle 282231131711 · cut8ContigsTGCATACaCACAGTCACCACCAATtcCCATGatTTCTGTtttMasked outputTGCATACaCAGTCACCAATtcCATGatTCTGTttt

Matchtigs: multi-source bidirectional BFS Link to heading

Matchtigs search with free connections and weighted unitig traversalsDNA labels identify every unitig. A directed edge connects two unitigs with a three-base overlap, at zero cost. Crossing a unitig costs its length minus three. When both ends of a unitig have settled distances, their sum plus the crossing cost gives the bridge cost. The first match consumes its two free ends. The repaired distances yield a second match.k = 4Each in-between k-mer costs 1Free suffixesFree prefixesAGGGcost 1AGGTcost 1AGGCGGcost 3ACGGcost 1ACGAcost 1GGTGGGcost 3CGGGcost 1CGGACcost 2CGACcost 1AAGGAACGGGGAGACA1234000000000000cost 1 link0000000000cost 1 link00101011010101000cost 1 link00101cost 2 link01cost 2 link1010cost 2 link1010cost 2 link00cost 1 link00101cost 2 link01cost 2 link1010cost 2 link1010cost 2 linkAAGGAGGGcost 1GGGA000010101cost 2 link10101010cost 2 link000010101cost 2 link10101010cost 2 link00001010110101010AAGGGGGAAACGACGAcost 1CGACcost 1GACA

Overview Link to heading

Overview Link to heading

Bibliography Link to heading

References Link to heading

Břinda, Karel, Michael Baym, and Gregory Kucherov. 2021. “Simplitigs as an Efficient and Scalable Representation of de Bruijn Graphs.” Genome Biology 22 (1). https://doi.org/10.1186/s13059-021-02297-z.
Cracco, Andrea, and Alexandru I. Tomescu. 2023. “Extremely Fast Construction and Querying of Compacted and Colored De Bruijn Graphs with GGCAT.” Genome Research, May. https://doi.org/10.1101/gr.277615.122.
Schmidt, Sebastian, Shahbaz Khan, Jarno N. Alanko, Giulio E. Pibiri, and Alexandru I. Tomescu. 2023. “Matchtigs: Minimum Plain Text Representation of K-Mer Sets.” Genome Biology 24 (1). https://doi.org/10.1186/s13059-023-02968-z.
Sladký, Ondřej, Pavel Veselý, and Karel Břinda. 2023. “Masked Superstrings as a Unified Framework for Textualk-Mer Set Representations,” February. https://doi.org/10.1101/2023.02.01.526717.