{"slug":"alterlab-blast","title":"alterlab-blast","summary":"Runs NCBI BLAST+ 2.17.0 sequence searches from the command line: makeblastdb (with -parse_seqids), blastn/blastp/blastx/tblastn with tabular -outfmt 6/7 for parsing, correct -task choice (megablast vs blastn vs blastn-short), -taxids/-negative_taxids taxonomic scoping, and -mt_mo","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-23T18:56:53.359704Z","repo":{"url":"https://github.com/AlterLab-IEU/AlterLab-Academic-Skills","stars":68,"forks":13,"license":"MIT","updatedAt":"2026-09-23T13:42:59Z"},"bodyHtml":"<hr>\n<h2>name: alterlab-blast\ndescription: \"Runs NCBI BLAST+ 2.17.0 sequence searches from the command line: makeblastdb (with -parse_seqids), blastn/blastp/blastx/tblastn with tabular -outfmt 6/7 for parsing, correct -task choice (megablast vs blastn vs blastn-short), -taxids/-negative_taxids taxonomic scoping, and -mt_mode multithreading; plus a DIAMOND blastp --ultra-sensitive path for large protein searches. Warns that -max_target_seqs is a heuristic keep-count, not a top-N best-hits filter. Use when the user wants command-line BLAST, makeblastdb, a local BLAST database, blastn/blastp/blastx/tblastn searches, or DIAMOND protein search. For the Bio.Blast web NCBIWWW API prefer alterlab-biopython; for quick one-liner database lookups prefer alterlab-gget. Part of the AlterLab Academic Skills suite.\"\nlicense: MIT\nallowed-tools: Read Write Edit Bash(python:<em>) Bash(makeblastdb:</em>) Bash(blastn:<em>) Bash(blastp:</em>) Bash(blastx:<em>) Bash(tblastn:</em>) Bash(blastdbcmd:<em>) Bash(diamond:</em>)\ncompatibility: \"Requires NCBI BLAST+ 2.17.0 binaries on PATH (conda: <code>bioconda::blast</code>; or Homebrew <code>blast</code>); no API key or account needed for local searches. DIAMOND (<code>bioconda::diamond</code>) is optional and only used for the large-protein fast path. Parsing/QC helper runs under <code>uv run python</code> with the standard library only.\"\nmetadata:\nskill-author: AlterLab\nversion: \"1.1.0\"\nlast_updated: \"2026-09-23\"</h2>\n<h1>BLAST+ — Command-Line Sequence Search</h1>\n<p>Run local NCBI <strong>BLAST+ 2.17.0</strong> searches end-to-end: build a database with\n<code>makeblastdb</code>, search it with <code>blastn</code> / <code>blastp</code> / <code>blastx</code> / <code>tblastn</code>, emit\nmachine-parseable tabular output, and scope by taxonomy. For very large protein\nsearches, hand off to <strong>DIAMOND</strong> <code>blastp --ultra-sensitive</code> (100x–10,000x the\nspeed of BLAST, per the DIAMOND project). This is the <strong>CLI / local-database</strong>\nskill; it is deliberately distinct from the Biopython web API and the gget\none-liner (see routing table below).</p>\n<blockquote>\n<p>Bulk DB builds and large searches are CPU/IO-heavy and fully offline — good\ncandidates to run on local compute rather than burning API calls.</p>\n</blockquote>\n<h2>When to Use This Skill</h2>\n<p>Use this skill when the request involves any of:</p>\n<ul>\n<li>\"BLAST these sequences\", \"run blastn/blastp/blastx/tblastn\", \"command-line BLAST\"</li>\n<li>\"build a local BLAST database\", \"makeblastdb\", \"index this FASTA for BLAST\"</li>\n<li>\"search my reads against a local nt/nr database\", \"get tabular BLAST hits I can parse\"</li>\n<li>\"scope the BLAST search to a taxon\" (<code>-taxids</code> / <code>-negative_taxids</code>)</li>\n<li>\"BLAST is too slow on millions of proteins\" → DIAMOND <code>blastp</code></li>\n<li>retrieving sequences out of a BLAST DB (<code>blastdbcmd</code>, requires <code>-parse_seqids</code>)</li>\n</ul>\n<h3>Does NOT Trigger</h3>\n<p>Route adjacent requests to the right sibling skill instead of forcing BLAST+:</p>\n<table>\n<thead>\n<tr>\n<th>The request is really about…</th>\n<th>Route to</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>The <strong>web</strong> BLAST API (<code>Bio.Blast.NCBIWWW.qblast</code>), or scripting BLAST inside a Python pipeline with <code>Bio.Blast</code> parsing</td>\n<td><code>alterlab-biopython</code></td>\n</tr>\n<tr>\n<td>A <strong>quick one-liner</strong> BLAST/database lookup (<code>gget blast</code>, gene/structure/enrichment lookups)</td>\n<td><code>alterlab-gget</code></td>\n</tr>\n<tr>\n<td>Unified programmatic access to many bio web services (UniProt, KEGG, Ensembl REST, NCBI eUtils)</td>\n<td><code>alterlab-bioservices</code></td>\n</tr>\n<tr>\n<td>Building/searching a <strong>phylogenetic tree</strong> from sequences, not a similarity search</td>\n<td><code>alterlab-phylogenetics</code></td>\n</tr>\n<tr>\n<td>Read alignment to a reference genome (BWA/minimap2 → BAM) and SAM/BAM handling</td>\n<td><code>alterlab-pysam</code></td>\n</tr>\n<tr>\n<td>FASTQ→VCF variant calling pipeline</td>\n<td><code>alterlab-nf-core-sarek</code></td>\n</tr>\n<tr>\n<td>Transcript-level RNA-seq quantification (salmon/kallisto)</td>\n<td><code>alterlab-rnaseq-quant</code></td>\n</tr>\n<tr>\n<td>16S/ITS amplicon classification (QIIME 2)</td>\n<td><code>alterlab-qiime2-amplicon</code></td>\n</tr>\n<tr>\n<td>Protein <strong>structure</strong> prediction / embeddings (ESM, AlphaFold)</td>\n<td><code>alterlab-esm</code></td>\n</tr>\n</tbody>\n</table>\n<p>If the user explicitly says \"web BLAST\", \"NCBIWWW\", or \"without installing\nanything\", they want <code>alterlab-biopython</code>, not this skill.</p>\n<h2>Quick Start</h2>\n<pre><code># 1. Build a protein DB (‑parse_seqids enables blastdbcmd retrieval + DIAMOND reuse)\nmakeblastdb -in proteins.fasta -dbtype prot -parse_seqids -out mydb -title \"my proteins\"\n\n# 2. Search, tabular output you can parse, std 12 columns\nblastp -query query.faa -db mydb -outfmt 6 -evalue 1e-5 -out hits.tsv\n\n# 3. QC / summarize the tabular output (stdlib only)\nuv run python scripts/parse_blast_tab.py hits.tsv --best-hit\n</code></pre>\n<p><code>-outfmt 6</code> is the canonical machine-readable format; its default columns are\nthe <code>std</code> set: <code>qseqid sseqid pident length mismatch gapopen qstart qend sstart send evalue bitscore</code>. Use <code>-outfmt 7</code> for the same columns plus comment lines.</p>\n<h2>Choosing the Right Program</h2>\n<table>\n<thead>\n<tr>\n<th>Query</th>\n<th>Subject DB</th>\n<th>Program</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>nucleotide</td>\n<td>nucleotide</td>\n<td><code>blastn</code></td>\n</tr>\n<tr>\n<td>protein</td>\n<td>protein</td>\n<td><code>blastp</code></td>\n</tr>\n<tr>\n<td>nucleotide (translated)</td>\n<td>protein</td>\n<td><code>blastx</code></td>\n</tr>\n<tr>\n<td>protein</td>\n<td>nucleotide (translated)</td>\n<td><code>tblastn</code></td>\n</tr>\n</tbody>\n</table>\n<p><code>-dbtype</code> for <code>makeblastdb</code> is <code>nucl</code> for nucleotide subjects, <code>prot</code> for protein.</p>\n<h2>The Five Things People Get Wrong</h2>\n<ol>\n<li><strong><code>-max_target_seqs</code> is NOT a \"top N best hits\" filter.</strong> It is the number of\naligned sequences to <em>keep</em>, applied during the search as a heuristic cutoff;\nties are broken \"by order of sequences in the database\", not by score. Setting\n<code>-max_target_seqs 1</code> does <strong>not</strong> reliably return the single best hit. To get\nthe best hit, keep a generous value and pick the top row <em>after</em> sorting by\nbitscore (see <code>scripts/parse_blast_tab.py --best-hit</code>). Default is 500.</li>\n<li><strong>Wrong <code>-task</code> for <code>blastn</code>.</strong> <code>megablast</code> (default) is for highly similar\nsequences; use <code>blastn</code> for cross-species / more divergent hits and\n<code>blastn-short</code> for queries &lt; ~30 nt (primers, sgRNAs). <code>dc-megablast</code> is the\ndiscontiguous option for inter-species comparison.</li>\n<li><strong>Forgetting <code>-parse_seqids</code> at DB-build time.</strong> Without it you cannot pull\nsequences back out with <code>blastdbcmd -entry</code>, and DIAMOND cannot reuse the\nsequence IDs cleanly. You cannot add it later without rebuilding.</li>\n<li><strong>Quoting the <code>-outfmt</code> custom column list for DIAMOND.</strong> BLAST+ wants the\nspec quoted (<code>-outfmt '6 qseqid sseqid pident evalue'</code>); <strong>DIAMOND wants it\nunquoted</strong> (<code>--outfmt 6 qseqid sseqid pident evalue</code>). Mixing these up is a\ncommon silent error.</li>\n<li><strong>Multithreading.</strong> Use <code>-num_threads N</code>. Since BLAST+ 2.15 the default\n<code>-mt_mode 0</code> means <strong>BLAST picks the split for you</strong> from query and database\nsize, which NCBI recommends leaving alone. Override only deliberately:\n<code>-mt_mode 1</code> = ThreadByQuery (many small queries), <code>-mt_mode 2</code> =\nThreadByDatabase (few large queries, big DB).</li>\n</ol>\n<p>Full option reference, taxonomy scoping, and DB-prep details:\n<a href=\"references/blast_cli.md\"><code>references/blast_cli.md</code></a>.</p>\n<h2>Taxonomic Scoping</h2>\n<p>Restrict a search to (or away from) clades by NCBI taxid:</p>\n<pre><code>blastn -query q.fna -db nt -taxids 9606 -outfmt 6 -out human_only.tsv\nblastp -query q.faa -db nr -negative_taxids 2 -outfmt 6 -out no_bacteria.tsv\n</code></pre>\n<p>Scoping by taxid requires a taxonomy-aware database (one built/downloaded with\nits <code>*.taxid</code> mapping, e.g. NCBI's pre-formatted <code>nt</code> / <code>nr</code>). See\n<a href=\"references/blast_cli.md#taxonomy\"><code>references/blast_cli.md</code></a>.</p>\n<h2>DIAMOND — Fast Path for Large Protein Searches</h2>\n<p>When <code>blastp</code> / <code>blastx</code> against millions of proteins is too slow, DIAMOND is a\ndrop-in for protein-space search:</p>\n<pre><code>diamond makedb --in nr.faa -d nr_diamond\ndiamond blastp -d nr_diamond -q query.faa -o hits.tsv \\\n  --ultra-sensitive --outfmt 6 qseqid sseqid pident length evalue bitscore\n</code></pre>\n<p>Sensitivity ladder (fast → most sensitive): <code>--fast</code>, <code>--mid-sensitive</code>,\n<code>--sensitive</code>, <code>--more-sensitive</code>, <code>--very-sensitive</code>, <code>--ultra-sensitive</code>. With no\nsensitivity flag DIAMOND runs its default mode, which sits between <code>--fast</code> and\n<code>--mid-sensitive</code>. Use <code>--ultra-sensitive</code> when you need BLAST-comparable recall. DIAMOND's <code>--outfmt 6</code> is compatible with the\nBLAST+ tabular parser below. Details and tradeoffs:\n<a href=\"references/diamond.md\"><code>references/diamond.md</code></a>.</p>\n<h2>Recommended Workflow</h2>\n<ol>\n<li><strong>Pick the program</strong> from the query/subject table above.</li>\n<li><strong>Build the DB</strong> with <code>makeblastdb -parse_seqids</code> (or download a pre-formatted\nNCBI DB). For &gt;~1M proteins, build a DIAMOND DB instead.</li>\n<li><strong>Search</strong> with <code>-outfmt 6</code>, an explicit <code>-evalue</code> threshold, the right\n<code>-task</code> (blastn), and <code>-num_threads</code>. Add <code>-taxids</code> if scoping.</li>\n<li><strong>Parse &amp; QC</strong> with <code>scripts/parse_blast_tab.py</code> — it sorts by bitscore,\nextracts best-hit-per-query, applies identity/coverage/e-value filters, and\nflags the <code>-max_target_seqs</code> pitfall if the column count looks truncated.</li>\n<li><strong>Retrieve</strong> any hit sequence with\n<code>blastdbcmd -db mydb -entry &lt;id&gt;</code> (needs <code>-parse_seqids</code>).</li>\n</ol>\n<h2>Verify Before Reporting</h2>\n<ul>\n<li>Confirm <code>blastn -version</code> / <code>diamond version</code> actually ran — never report hits\nyou did not produce.</li>\n<li>State the program, <code>-task</code>, <code>-evalue</code>, and DB used; results are meaningless\nwithout them.</li>\n<li>If you used <code>-max_target_seqs</code>, confirm best-hit selection was done by\n<em>post-hoc bitscore sort</em>, not by trusting the keep-count as a top-N.</li>\n<li>For DIAMOND results, note the sensitivity level used.</li>\n</ul>\n<h2>References</h2>\n<ul>\n<li><a href=\"references/blast_cli.md\"><code>references/blast_cli.md</code></a> — full BLAST+ 2.17.0 option\nreference: programs, <code>makeblastdb</code>, <code>-outfmt</code> columns, <code>-task</code>, taxonomy\nscoping, <code>-mt_mode</code>, <code>blastdbcmd</code> retrieval, and the <code>-max_target_seqs</code> caveat.</li>\n<li><a href=\"references/diamond.md\"><code>references/diamond.md</code></a> — DIAMOND DB build, sensitivity\nmodes, output formats, and when to choose it over BLAST+.</li>\n<li>NCBI BLAST+ manual: <a href=\"https://www.ncbi.nlm.nih.gov/books/NBK569856/\">https://www.ncbi.nlm.nih.gov/books/NBK569856/</a></li>\n<li>DIAMOND: <a href=\"https://github.com/bbuchfink/diamond\">https://github.com/bbuchfink/diamond</a></li>\n</ul>\n<p>Part of the AlterLab Academic Skills suite.</p>\n","files":[{"path":"evals/evals.json","sizeBytes":6296,"isText":true},{"path":"references/blast_cli.md","sizeBytes":6522,"isText":true},{"path":"references/diamond.md","sizeBytes":3157,"isText":true},{"path":"scripts/parse_blast_tab.py","sizeBytes":6653,"isText":true},{"path":"SKILL.md","sizeBytes":9661,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-23T18:57:14.09428Z","sha256":"19E59EC43038161F8CA96206D207BF709856D90FCDF5DF0F21163C1764A5661F","sizeBytes":13960},"review":null,"source":{"repositoryUrl":"https://github.com/AlterLab-IEU/AlterLab-Academic-Skills","path":"skills/bioinformatics/alterlab-blast","license":"MIT","commit":"e4836c08a20da195a11f30f203a8cf23ec30aa95","subtreeSha":"3EF11EF4062140A472EA401F8C8BD9C8D1A0DAEF7DA634AB675EE9357B04ACF3","lastSyncedAt":"2026-09-23T18:56:52.297238Z"},"reviewedAt":"2026-09-23T18:57:50.325706Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/AlterLab-IEU/AlterLab-Academic-Skills/tree/main/skills/bioinformatics/alterlab-blast"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install alterlab-ieu-alterlab-academic-skills@llmmart"},{"target":"git","command":"git clone https://github.com/AlterLab-IEU/AlterLab-Academic-Skills.git"}]}