Accept MAF input#86
Merged
Merged
Conversation
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>
# Conflicts: # Makefile
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>
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.
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).