Repository navigation
feat: implement exact seeded base-pair probabilities (#257) - #258
Alexander-Mitrofanov wants to merge 23 commits into
Conversation
|
thanks, implement the plan in multiple commits (at least one per step) to this branch |
|
thanks, please add the following steps: (step 8) SVG dot plot output
general SVG requirements:
linear-gradient(90deg,
#FFFFFF 0%, #FFFFFF 25%,
#AEC6CF 25%, #AEC6CF 50%,
#4682B4 50%, #4682B4 75%,
#002060 75%, #002060 100%
);
(step 9) recursion depiction
|
feat: add exact and heuristic probability SVGs (steps 8–11)
martin-raden
left a comment
There was a problem hiding this comment.
thanks, please revise:
- do a "git update" to get the recent changes to this branch
- implement the following issues
| //! admitted occurrences keyed by local start | ||
| std::map<std::pair<size_t,size_t>, size_t> lengths; | ||
| //! shortest retained length per ending vertex for suffix acceptance | ||
| std::map<std::pair<size_t,size_t>, size_t> endingLengths; |
There was a problem hiding this comment.
- when encoding base pair information, use
IntaRNA::Interaction::BasePairinstead of "std::pair" or "std::array"- provides already a hash function
- for sparse data storage (typical for seed starts) use a hash(map) rather than a std::map.
- replace this using "std::unordered_map<BasePair, size_t, BasePair::Hash>"
There was a problem hiding this comment.
- update AGENTS.md with respective guidelines for similar upcoming changes
| void StackSeedDomain::add(Occurrence s, size_t n, size_t m, size_t w1, size_t w2) { | ||
| w1=std::min(w1,n); w2=std::min(w2,m); | ||
| if (s.length==0 || s.i>=n || s.j>=m || s.length>n-s.i || s.length>m-s.j | ||
| || s.length>w1 || s.length>w2) return; | ||
| auto [p,inserted]=lengths.emplace(std::make_pair(s.i,s.j),s.length); | ||
| if (!inserted && p->second!=s.length) throw std::invalid_argument("multiple retained seed lengths at one start"); | ||
| auto [end, fresh]=endingLengths.emplace(std::make_pair(s.i+s.length-1,s.j+s.length-1),s.length); | ||
| if (!fresh) end->second=std::min(end->second,s.length); | ||
| maximum=std::max(maximum,s.length); | ||
| const size_t end1=s.i+s.length, end2=s.j+s.length; | ||
| boxes.push_back({end1>w1?end1-w1:0,s.i,end2>w2?end2-w2:0,s.j}); | ||
| } | ||
| void StackSeedDomain::forEachStart(const std::function<void(size_t,size_t)> & visit) const { |
There was a problem hiding this comment.
- generally: extend documentation level of function implementations with inline comments summarizing subsequent steps similar to remaining code, to simplify human code and sanity checks
| size_t i=n, j=m; | ||
| while (handler.updateToNextSeed(i,j,0,n-1,0,m-1)) { | ||
| const size_t len=handler.getSeedLength1(i,j); | ||
| if (len != handler.getSeedLength2(i,j)) throw std::logic_error("stack seed has unequal strand lengths"); |
There was a problem hiding this comment.
- check internal invariants like this with
assertorNDEBUGprecompiler checks that are not checked in release code - only to release-code checks for input validation and checks that might fail during normal execution
- extend the AGENTS.md with respective guidelines
Use Interaction::BasePair and hash maps for sparse seed lookup, make the stack-length invariant debug-only, and document probability computation steps and contributor conventions. Validate overlapping seed endings, deterministic traversal, and input rejection. Release and debug make tests -j2 each pass all seven suites (100967 assertions in 98 API cases); installed headers, pkg-config consumer, assertion-mode probe, and before/after CLI output checks also pass.
…com/BackofenLab/IntaRNA into docs/257-base-pair-probability-plan
Exact seeded
--model=P --mode=Mprediction now counts each complete interaction once, even when it contains several overlapping or disjoint seeds.--out=bpProb:FILEreports actual interior-pair probabilities over the union of searched disjoint regions, using the same raw partition denominator as prediction without pair output.The implementation follows the reviewed plan on this existing branch in seven separate commits, one per step:
88f4369: Establish an independent exhaustive weighted-chain oracle and all ten unrounded theory fixtures.62afc24: Compile geometric stack-seed capability, active occurrences, and eligible domains.5c8907c: Validate and compare both kernel candidates and select the suffix kernel.8bd8534: Integrate unique partition accounting, shared boundary coefficients, extension hooks, and exact-zero handling.99919de: Accumulate raw pair masses in original coordinates across successful disjoint regions.3f6d3d1: Expose the matrix writer and CLI output, including multiFASTA, gzip, and shared streams.48efc54: Complete validation, documentation, performance measurements, installed consumer checks, and packaging.Stack-seed admission is preserved, including accepted mixed-length and singleton explicit seeds. Existing bulged and heuristic prediction paths remain available; unsupported combinations with
bpProbfail explicitly. The new matrix contains actual pairs; existing spot output retains its coverage interpretation. Successful empty searches produceNAentries. Numerical range errors fail explicitly without a scaling fallback, and failed calculations do not publish a partial probability matrix. Corrected partition accounting can change ensemble results; no golden output was regenerated to conceal differences.Validation:
-leasyloggingdependency is fixed and CI now runs this consumer.make distsucceeds and includes all 23 new distributable files. Encoding andgit diff --checkpass.See kernel comparison and validation report for reproducible commands and limitations. Apple Clang validation is left to the existing macOS CI because that toolchain is unavailable locally.
Addresses #257.