Skip to content

Add foapy.partials package for partial-sequence interval analysis#107

Open
goruha wants to merge 3 commits into
002-decompose-intervals-pipelinefrom
004-partials-package
Open

Add foapy.partials package for partial-sequence interval analysis#107
goruha wants to merge 3 commits into
002-decompose-intervals-pipelinefrom
004-partials-package

Conversation

@goruha
Copy link
Copy Markdown
Member

@goruha goruha commented Apr 19, 2026

Summary

  • Adds foapy.partials subpackage — the position-preserving counterpart to foapy.core and foapy.ma for sequences with gap positions (numpy masked arrays)
  • Gap positions are preserved throughout the pipeline; interval distances are measured using actual full-array indices (gaps count toward distance)
  • Exports order, alphabet, intervals_chain, intervals_tuple — all returning masked 1-D arrays of the same length as input

Key semantic distinction

foapy.ma foapy.partials
Gap handling Compressed out before computing Preserved; count toward interval distance
order() output 2-D masked matrix 1-D masked array (same length as input)
lossy output length Shorter (boundaries dropped) Same length (boundaries masked in-place)
redundant output length n+k using compressed positions n+k using actual full-array positions

Files changed

New source files: src/foapy/partials/__init__, _order, _alphabet, _intervals_chain, _intervals_tuple

Modified: src/foapy/__init__.py — lazy submodule registration for foapy.partials

New tests: 5 test files covering all functions, all binding × chain_mode × tuple_mode combinations, gap semantics, error handling, and no-mask passthrough consistency with core.

Test plan

  • tox -e default — 503 tests passing, 0 failures
  • pre-commit run --all-files — black, isort, flake8 all pass
  • Quickstart examples execute without error

🤖 Generated with Claude Code

@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 24638355903

Coverage increased (+0.7%) to 94.595%

Details

  • Coverage increased (+0.7%) from the base build.
  • Patch coverage: 5 uncovered changes across 3 files (271 of 276 lines covered, 98.19%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
src/foapy/init.py 9 6 66.67%
src/foapy/core/_intervals_tuple.py 37 36 97.3%
src/foapy/partials/init.py 12 11 91.67%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
src/foapy/init.py 1 53.49%

Coverage Stats

Coverage Status
Relevant Lines: 555
Covered Lines: 525
Line Coverage: 94.59%
Coverage Strength: 5.64 hits per line

💛 - Coveralls

@goruha goruha changed the title 004 partials package Add foapy.partials package for partial-sequence interval analysis Apr 19, 2026
@github-actions
Copy link
Copy Markdown

Change Before [58bd76e] <0.0.22> After [79a5d0f] Ratio Benchmark (Parameter)
- 17.2±0.1μs 15.4±0.1μs 0.9 bench_alphabet.AlphabetSuite.time_alphabet(500, 'DNA')
- 17.5±0.09μs 15.4±0.09μs 0.88 bench_alphabet.AlphabetSuite.time_alphabet(500, 'Normal')
- 19.8±0.1μs 15.8±0.1μs 0.8 bench_alphabet.AlphabetSuite.time_alphabet(500, 'Worst')
- 28.8±0.2μs 24.7±0.05μs 0.86 bench_alphabet.AlphabetSuite.time_alphabet(5000, 'Best')
- 156±1μs 119±0.7μs 0.76 bench_alphabet.AlphabetSuite.time_alphabet(5000, 'DNA')
- 264±0.4μs 126±0.9μs 0.48 bench_alphabet.AlphabetSuite.time_alphabet(5000, 'Normal')
- 345±0.8μs 133±0.9μs 0.39 bench_alphabet.AlphabetSuite.time_alphabet(5000, 'Worst')
- 4.69±0.1ms 3.90±0.1ms 0.83 bench_alphabet.AlphabetSuite.time_alphabet(500000, 'Best')
- 49.4±0.1μs 38.1±0.2μs 0.77 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(5, 'Best')
- 64.2±2μs 45.6±0.4μs 0.71 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(5, 'DNA')
- 50.1±2μs 39.3±0.8μs 0.78 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(5, 'Normal')
- 52.7±0.6μs 40.1±0.5μs 0.76 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(5, 'Worst')
- 50.7±0.7μs 39.1±0.07μs 0.77 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(50, 'Best')
- 65.9±1μs 45.8±0.2μs 0.7 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(50, 'DNA')
- 54.5±0.5μs 41.8±0.2μs 0.77 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(50, 'Normal')
- 54.7±0.4μs 42.6±0.4μs 0.78 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(50, 'Worst')
- 55.3±0.2μs 42.7±0.2μs 0.77 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(500, 'Best')
- 80.0±0.6μs 57.8±0.4μs 0.72 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(500, 'DNA')
- 74.1±0.7μs 56.8±0.2μs 0.77 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(500, 'Normal')
- 75.9±0.2μs 59.1±0.2μs 0.78 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(500, 'Worst')
- 92.9±0.5μs 72.3±0.6μs 0.78 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(5000, 'Best')
- 390±4μs 226±20μs 0.58 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(5000, 'Normal')
- 427±3μs 270±10μs 0.63 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(5000, 'Worst')
- 53.6±0.4μs 35.4±0.2μs 0.66 bench_ma_order.MaOrderSuite.time_order(5, 'Best')
- 60.3±2μs 39.8±0.2μs 0.66 bench_ma_order.MaOrderSuite.time_order(5, 'DNA')
- 55.4±1μs 35.8±1μs 0.65 bench_ma_order.MaOrderSuite.time_order(5, 'Normal')
- 61.3±0.5μs 39.4±1μs 0.64 bench_ma_order.MaOrderSuite.time_order(5, 'Worst')
- 55.0±0.2μs 36.8±0.6μs 0.67 bench_ma_order.MaOrderSuite.time_order(50, 'Best')
- 64.6±0.5μs 42.3±0.3μs 0.66 bench_ma_order.MaOrderSuite.time_order(50, 'DNA')
- 65.7±0.9μs 42.3±0.2μs 0.64 bench_ma_order.MaOrderSuite.time_order(50, 'Normal')
- 67.2±0.4μs 45.2±0.8μs 0.67 bench_ma_order.MaOrderSuite.time_order(50, 'Worst')
- 61.9±0.4μs 42.5±0.2μs 0.69 bench_ma_order.MaOrderSuite.time_order(500, 'Best')
- 83.8±0.7μs 57.9±0.4μs 0.69 bench_ma_order.MaOrderSuite.time_order(500, 'DNA')
- 140±0.6μs 117±3μs 0.83 bench_ma_order.MaOrderSuite.time_order(500, 'Normal')
- 264±2μs 226±4μs 0.86 bench_ma_order.MaOrderSuite.time_order(500, 'Worst')
- 120±0.3μs 92.4±0.3μs 0.77 bench_ma_order.MaOrderSuite.time_order(5000, 'Best')
- 288±5μs 223±6μs 0.77 bench_ma_order.MaOrderSuite.time_order(5000, 'DNA')
- 10.9±0.4ms 8.53±0.1ms 0.78 bench_ma_order.MaOrderSuite.time_order(5000, 'Normal')
- 39.1±0.3ms 28.8±0.4ms 0.74 bench_ma_order.MaOrderSuite.time_order(5000, 'Worst')
- 15.2±0.2μs 12.9±0.02μs 0.85 bench_order.OrderSuite.time_order(5, 'Best')
- 15.5±0.05μs 13.2±0.03μs 0.85 bench_order.OrderSuite.time_order(5, 'DNA')
- 15.3±0.07μs 13.0±0.02μs 0.85 bench_order.OrderSuite.time_order(5, 'Normal')
- 15.5±0.1μs 13.2±0.04μs 0.85 bench_order.OrderSuite.time_order(5, 'Worst')
- 16.0±0.2μs 13.5±0.03μs 0.85 bench_order.OrderSuite.time_order(50, 'Best')
- 17.1±0.04μs 14.5±0.1μs 0.85 bench_order.OrderSuite.time_order(50, 'DNA')
- 16.8±0.08μs 14.2±0.09μs 0.85 bench_order.OrderSuite.time_order(50, 'Normal')
- 16.9±0.3μs 14.4±0.06μs 0.85 bench_order.OrderSuite.time_order(50, 'Worst')
- 21.2±0.06μs 18.9±0.08μs 0.89 bench_order.OrderSuite.time_order(500, 'Best')
- 30.2±0.1μs 26.7±0.1μs 0.89 bench_order.OrderSuite.time_order(500, 'DNA')
- 31.5±0.1μs 27.1±0.1μs 0.86 bench_order.OrderSuite.time_order(500, 'Normal')
- 33.9±0.2μs 28.4±0.3μs 0.84 bench_order.OrderSuite.time_order(500, 'Worst')
- 208±3μs 163±3μs 0.78 bench_order.OrderSuite.time_order(5000, 'DNA')
- 309±1μs 177±1μs 0.57 bench_order.OrderSuite.time_order(5000, 'Normal')
- 397±0.8μs 202±1μs 0.51 bench_order.OrderSuite.time_order(5000, 'Worst')
- 12.0±0.5ms 10.8±0.08ms 0.9 bench_order.OrderSuite.time_order(500000, 'Best')
Change Before [58bd76e] <0.0.22> After [79a5d0f] Ratio Benchmark (Parameter)
---------- ------------------------------ --------------------- --------- -----------------------------------------------------------------
+ 50.9±0.9ms 57.2±2ms 1.12 bench_alphabet.AlphabetSuite.time_alphabet(500000, 'Normal')
+ 70.7±0.8ms 80.1±0.5ms 1.13 bench_alphabet.AlphabetSuite.time_alphabet(500000, 'Worst')
+ 4.71±0.02ms 5.27±0.06ms 1.12 bench_ma_alphabet.MaAlphabetSuite.time_alphabet(50000, 'Worst')
+ 83.0±0.3ms 93.2±0.6ms 1.12 bench_order.OrderSuite.time_order(500000, 'Worst')

@goruha goruha changed the base branch from main to 002-decompose-intervals-pipeline April 19, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants