You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a script that builds the local BLAST ortholog database from taxonomy IDs - #27
Add a script that builds the local BLAST ortholog database from taxonomy IDs
A new user starts with nothing. Given the NCBI taxonomy IDs of the species they want orthologs from, scripts/make_blast_db.sh downloads each RefSeq reference proteome with the NCBI datasets CLI, combines them, builds a BLAST database with -parse_seqids, verifies retrieval, and prints the species names to use as species_map keys.
LocalBlastSearcher fetches each hit's complete protein with blastdbcmd -entry, which fails on any database built without -parse_seqids. Both of our existing lab databases were built that way and return no orthologs under V2.
The script can also build from a protein FASTA the user already has (-i), or extract taxa from an existing taxonomy-enabled database such as nr (-n). The README section is rewritten as the three steps a user follows: install the tools, run the script, point LocalBlastSearcher at the result.
Tested from scratch with yeast plus fruit fly: download, build, and verify took six seconds, blastp returns correct hits, and per-accession retrieval works.
…omy IDs
A new user starts with nothing. Given the NCBI taxonomy IDs of the species
they want orthologs from, scripts/make_blast_db.sh downloads each RefSeq
reference proteome with the NCBI datasets CLI, combines them, builds a
BLAST database with -parse_seqids (LocalBlastSearcher fetches each hit's
complete protein with blastdbcmd -entry, which fails without it), verifies
retrieval, and prints the species names to use as species_map keys.
It can also build from a protein FASTA the user already has (-i), or
extract taxa from an existing taxonomy-enabled database such as nr (-n).
Rewrite the README section as the three steps a user actually follows:
install the tools, run the script, point LocalBlastSearcher at the result.
The README is for users; how to construct LocalBlastSearcher in code
belongs in the API docs. Step 3 now just says what to keep from the
script's output and why.
AnthonyGarza124
changed the title
Add a script that builds a V2-compatible local BLAST database
Add a script that builds the local BLAST ortholog database from taxonomy IDs
Oct 15, 2026
The file was committed as 644 because this clone has core.filemode off,
so the documented invocation failed with permission denied. Also drop the
20-line cap on the species report, since users copy species_map keys
from it.
RefSeq reuses WP_ accessions for identical proteins across related
bacteria, and makeblastdb -parse_seqids refuses duplicate ids (two
Bacillus reference proteomes share 803). When a downloaded record's id was
already added by an earlier species, suffix it with the taxid and keep the
description; accessions are untouched otherwise. For -i input, fail early
with the duplicate ids listed instead of makeblastdb's error.
Also fix the final report: piping blastdbcmd -info into head raised
SIGPIPE under pipefail, so the script exited before printing the species
list and ready line. Use sed, which reads to the end.
README: bacterial proteomes label many records with only a genus, so map
every printed name.
Disambiguate shared bracketed organism labels across species
scripts/make_blast_db.sh:95
When two downloaded species share a bracketed group label such as [Bacillus], suffixing their accessions leaves their species indistinguishable. LocalBlastSearcher assigns taxonomy from that label alone (src/lverage/blast.py:69–84), so following README lines 89–91 and mapping the printed label to one taxid misclassifies proteins from the other species. Preserve source-specific organism labels and print their taxid mappings, or reject labels shared across source taxa. Update the README to explain that ambiguous group labels cannot safely be mapped to a single species.
Use consistent organism extraction between builder and BLAST parser
scripts/make_blast_db.sh:124
This prints the last bracketed field, but _parse_blast_hits (src/lverage/blast.py:69) reads the first. For >id NADH dehydrogenase [ubiquinone] subunit [Homo sapiens], the script recommends Homo sapiens, while the searcher looks up ubiquinone and skips the hit when only the recommended species key is configured. Use a consistent organism-extraction rule in the builder and searcher; printing the first field instead would incorrectly treat protein annotations as species.
Track every id emitted so far, not only those from earlier species, and
pick a collision-free suffix when a proteome repeats an accession or the
suffixed name already exists.
README: two species of the same genus share genus-level labels in RefSeq
and cannot be told apart by species_map.
Align organism extraction between BLAST builder and searcher
scripts/make_blast_db.sh:129
This prints the last bracketed field, but LocalBlastSearcher uses the first (src/lverage/blast.py:69–76). For a header such as [acyl-carrier-protein] S-malonyltransferase [Escherichia coli], the script prints Escherichia coli, while the searcher looks up acyl-carrier-protein and skips the hit with an unresolved-species warning. Align the searcher's organism extraction with the builder's trailing species field, and add a regression case with brackets in the protein description. Printing the first field instead would incorrectly treat a protein-description fragment as a species.
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
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.
Add a script that builds the local BLAST ortholog database from taxonomy IDs
A new user starts with nothing. Given the NCBI taxonomy IDs of the species they want orthologs from, scripts/make_blast_db.sh downloads each RefSeq reference proteome with the NCBI datasets CLI, combines them, builds a BLAST database with -parse_seqids, verifies retrieval, and prints the species names to use as species_map keys.
LocalBlastSearcher fetches each hit's complete protein with blastdbcmd -entry, which fails on any database built without -parse_seqids. Both of our existing lab databases were built that way and return no orthologs under V2.
The script can also build from a protein FASTA the user already has (-i), or extract taxa from an existing taxonomy-enabled database such as nr (-n). The README section is rewritten as the three steps a user follows: install the tools, run the script, point LocalBlastSearcher at the result.
Tested from scratch with yeast plus fruit fly: download, build, and verify took six seconds, blastp returns correct hits, and per-accession retrieval works.