Skip to content

Fix search-mode reliability for BLAST, UniProt, AFDB, and small maps - #103

Merged
ahmedhosny merged 4 commits into
mainfrom
ah/fix-search-mode-cloud-apis
Aug 14, 2026
Merged

Fix search-mode reliability for BLAST, UniProt, AFDB, and small maps#103
ahmedhosny merged 4 commits into
mainfrom
ah/fix-search-mode-cloud-apis

Conversation

@ahmedhosny

Copy link
Copy Markdown
Contributor

Summary

  • BLAST: default to NCBI WWW/QBlast (PC_BLAST_BACKEND=www, PC_BLAST_DB=refseq_protein) with timeout/heartbeat; keep blastp -remote via env. Optional PC_BLAST_SOFT_FAIL=1 continues Foldseek-only when NCBI fails. Empty BLAST results no longer abort extract.
  • AlphaFold: prefer model_v6, fall back to v4 / prediction API; never write HTML/XML error bodies as PDBs (poisoned Foldseek → N≈1).
  • UniProt: idmapping handles 303/ERROR, batches + retries; metadata uses /uniprotkb/accessions instead of 100-OR search.
  • Small N: clamp UMAP/t-SNE/Leiden parameters; N<3 gets a degenerate layout / single cluster.
  • Unit tests for BLAST XML→TSV and empty hit extraction. README BLAST TODO updated.

These fixes were developed while running ProteinCartography v0.5.0 search-mode on Modal for Arcadia Studio (full cartography). Upstream main already has AFDB v6 URL + Foldseek F1-model parse; this PR covers what still breaks real cloud/search runs.

Test plan

  • ruff check ProteinCartography / ruff format
  • pytest unit tests: test_blast_utils, test_extract_blast_hits, test_packaging
  • CI lint + mocked search/cluster pipeline (make test)
  • Optional: add run-slow-tests label before merge for live API smoke

Env knobs (optional)

Var Default Purpose
PC_BLAST_BACKEND www www / remote / auto
PC_BLAST_DB refseq_protein (www) set nr for broader historical search
PC_BLAST_SOFT_FAIL 0 (run) / empty extract allowed 1 to continue after BLAST failure
PC_UNIPROT_MAP_* / PC_UNIPROT_META_* see scripts batch/timeout/retry tuning

Made with Cursor

Replace hanging blastp -remote with NCBI WWW/QBlast by default, harden
UniProt idmapping/metadata and AlphaFold PDB downloads, and keep tiny
maps from crashing UMAP/Leiden. Proven while wiring ProteinCartography
into Arcadia Studio full cartography on Modal.

Co-authored-by: Cursor <cursoragent@cursor.com>
ahmedhosny and others added 3 commits August 14, 2026 10:46
Query AlphaFold's prediction API first so isoform entries like Q9Y6V0-3
are not written as 404 error bodies. Stop scaling t-SNE perplexity for
every N<250. Share one PC_BLAST_SOFT_FAIL opt-in so an empty BLAST TSV
cannot succeed in run_blast and then abort extract_blast_hits.

Co-authored-by: Cursor <cursoragent@cursor.com>
…s import.

Unpinned matplotlib now requires numpy>=1.25 while this env pins 1.23.5;
setuptools 81 dropped pkg_resources, which umap-learn still imports.
Same pins as #101.

Co-authored-by: Cursor <cursoragent@cursor.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