Skip to content

Accept MAF input#86

Merged
glennhickey merged 3 commits into
mainfrom
index
May 28, 2026
Merged

Accept MAF input#86
glennhickey merged 3 commits into
mainfrom
index

Conversation

@glennhickey
Copy link
Copy Markdown
Contributor

Adds abstraction layer over maf/taf reading, and use it in the various tools. Now you can run all the taffy tools on MAF inputs, rather than needing to pipe through taffy view. Output remains TAF by default (with some tools having maf output toggles).

glennhickey and others added 3 commits April 29, 2026 16:11
Adds a BlockReader abstraction that sniffs MAF/TAF on open, reads the
right header, and dispatches subsequent block reads -- including the
alignment_link_adjacent call that MAF input needs for cross-block
coordinate continuity. Migrates each tool's read loop to it, so users
no longer need to pipe through 'taffy view' to consume a MAF.

stats -b (sequence intervals) is no longer rejected on MAF input.
Output formats per tool are unchanged for now -- pass 2 will make
output mirror input where it makes sense.

Adds unit tests for BlockReader plus a per-tool regression test that
diffs direct-MAF invocation against 'taffy view -i x.maf | tool'.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Each migrated tool's `block_reader_open == NULL` path now releases the
LI handle, the input FILE*, and (where applicable) the LW output writer
before returning 1. Previously these leaked until process exit -- not
observable in practice but worth fixing for hygiene.

Also drops the redundant `if (r->header != NULL)` guard in
block_reader_destruct since tag_destruct accepts NULL.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@glennhickey glennhickey merged commit 394150d into main May 28, 2026
glennhickey added a commit that referenced this pull request May 28, 2026
Pulls in #85 (URL inputs), #86 (BlockReader / direct-MAF readers),
#87 (faster MAF/TAF emitter+parser via byte-level LW_put* API), and
#88 (-T/--threads bgzf_mt across all commands).

Conflicts resolved:
  * Makefile -- union of build deps (kept tui.o + ONElib.o from unitaf,
    added block_reader.o + remote_io.o from main).
  * taf_index.c -- short-flag clash: main's -T = --threads collided with
    unitaf's -T = --tmpDir.  Renamed --tmpDir to -d to keep -T/--threads
    consistent across every command; --tmpDir long form is unchanged so
    only short-flag callers break.
  * taf_view.c -- combined #include "tui.h" + "remote_io.h"; gated the
    .tui auto-detect on !input_is_url (no remote-.tui resolver yet);
    routed the non-tui else branch through tai_path_for /
    open_tai_for_reading so URL inputs work there.
  * taffy/impl/line_iterator.{h,c} -- header auto-merged (LI_get_position
    from unitaf + LW_put* buffer fields from main).  .c kept both the
    LI_get_position definition and LW_BUF_TARGET.
  * taffy/impl/maf.c -- both branches hand-rolled the MAF "s" parser.
    Kept unitaf's body (uses the digit-only maf_parse_u64, ~13% CPU win
    over strtoll, plus defensive `continue` on malformed lines instead
    of assertion) and dropped main's now-unused maf_parse_s_line helper.
    Switched maf_write_block2 to main's LW_put* API (64 KB coalescing
    via the shared writer) and dropped the file-local maf_lw_putn /
    maf_i64_str helpers + the bgzf.h include they pulled in.
  * taffy/impl/taf.c -- auto-merged.

Tests: C unit suite 32/32, pytest tai+tui 983/983 pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant