Skip to content

Support URL inputs in taffy view -r and the Python API#85

Open
glennhickey wants to merge 1 commit intomainfrom
url
Open

Support URL inputs in taffy view -r and the Python API#85
glennhickey wants to merge 1 commit intomainfrom
url

Conversation

@glennhickey
Copy link
Copy Markdown
Contributor

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.

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>
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