---
title: Local database prep
description: Build a local index with makeblastdb — getting -dbtype nucl or prot right is what makes it work — then version it, checksum it, and pack a tarball for S3.
---

Build a local [BLAST](/docs/blast) database from a source FASTA so searches can run against it without sending data to NCBI. Getting `-dbtype` right (`nucl` vs. `prot`) is what determines whether the index works — it must match the sequences you're indexing and the search program you'll run.

> **Where these commands run**

> You cannot open a shell on the platform yourself. The commands on this page are BLAST+ command lines: ask Ivy in chat to run them in the chat's [code workspace](/docs/sandbox), which ships BLAST+, or run them on your own machine. For a hosted search with no commands, see the [BLAST quickstart](/docs/blast/quickstart).

## Build a database

```bash
makeblastdb \
  -in inputs/db/source.fasta \
  -dbtype nucl \
  -parse_seqids \
  -out inputs/db/genomes_v1
```

For protein:

```bash
makeblastdb -in inputs/db/source_prot.fasta -dbtype prot -out inputs/db/proteins_v1
```

## Versioning pattern

- Keep databases under `inputs/db/<name>_<version>/`.
- Store the source FASTA alongside the generated index files.
- Record MD5 checksums in `inputs/db/<name>_<version>/CHECKSUMS.txt`.

```bash
cd inputs/db
md5sum genomes_v1.* > genomes_v1/CHECKSUMS.txt
```

## Packing for S3

```bash
tar -czf outputs/genomes_v1.tar.gz -C inputs/db genomes_v1*
```

Keep the tarball and restore it wherever you run BLAST, to avoid
rebuilding each run.

## Refresh cadence

- Public databases: refresh weekly or monthly depending on size.
- Internal databases: refresh on source data updates; bump the version suffix
  and update CHECKSUMS.
