Support URL inputs in taffy view -r and the Python API#85
Merged
Conversation
Routes URL inputs (http://, https://, s3://, ...) through htslib's
URL-aware bgzf_open, so a region query against a remote MAF/TAF only
fetches the .tai plus the BGZF blocks the iterator actually needs.
- LI_construct_from_path: thin wrapper over bgzf_open, used in lieu of
fopen+LI_construct when the input is a URL
- remote_io.{h,c}: URL detector + .tai slurp helper that writes the
fetched bytes to a tmpfile (so downstream LI_construct(FILE*) can
fileno() it)
- taf_view.c: detects URL inputs, requires -r, falls through to the
shared cleanup path
- Python: AlignmentReader and TafIndex accept URL strings; URL-backed
readers skip the per-FILE* close that would otherwise corrupt
- Clear error message when htslib was built without libcurl, with a
pointer to ./configure --enable-libcurl
- README note documenting the htslib-with-libcurl requirement
Verified against a 184 GB MAF on S3: a 500 bp slice returns the right
content in ~8 s, dominated by the 5.9 MB index fetch.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Use htslib to support inputs over http. Seems to work pretty well thugh applied only to indexed taffy view (-r) queries for now.
These work by downloading the entire .tai, loading it into memory, then reading only the selected range from the remote alignment file.
Some things I need to check before merging: cactus integration (inc static build) and if it works on Mac.