Skip to main content

blastweb

Local BLAST search via Web UI and REST API using Flask, inspired by NCBI's legacy wwwblast.

  • Search form with database / task / option choices filtered by program
  • Multi-FASTA queries and FASTA file upload
  • Searches run as background jobs; each result has its own URL
  • wwwblast-style results: graphical overview, hit table and pairwise alignments
  • Download results as pairwise text, TSV, CSV, XML, JSON or ASN.1 archive

🐍 Requirements

📦 Installation

Prepare venv: (Highly recommended)

python -m venv my_blastweb
source my_blastweb/bin/activate

from github: - If you choose this installation method, the blastweb command must be run in the <blastweb top dir>.

git clone https://github.com/piroyon/blastweb.git
cd blastweb
pip install -e .

or, use pip:

pip install blastweb

⚙️ Configuration

Create a config file 'blast.yaml' in the current directory

blastweb init

Edit blast.yaml

blast_path: /usr/local/ncbi/blast+/bin
blast_db: /mnt/data/blastdb
default_extra_args: "-soft_masking true -word_size 11"
url_prefix: "/blastplus"
  • blast_path: Path to the directory where blastn, blastp, etc. are installed
  • blast_db: Path to the directory containing your BLAST databases
  • default_extra_args: Common BLAST options passed to all queries
  • url_prefix: If you plan to host this application behind a reverse proxy at a subpath
  • timeout: (optional) Max seconds a BLAST search may run. Default 600
  • job_dir: (optional) Where search jobs are stored. Default <system temp dir>/blastweb_jobs. Set this for production, since temp dirs may be cleaned
  • job_retention_days: (optional) Days to keep job results. Default 7
  • max_running_jobs: (optional) Max searches running at the same time. Default 4
  • max_upload_mb: (optional) Max size of an uploaded FASTA file. Default 10

Only common search options (e.g. -word_size, -strand, -dust, -task) are accepted in "Additional Options". Options touching files, output format or remote search (e.g. -out, -outfmt, -remote) are rejected. default_extra_args is set by the admin and is not restricted.

🚀 Start server for development or very local use

cd <blastweb_topdir>
blastweb runserver --port 5000 --config /path/to/blast.yaml

Then open http://localhost:5000 in your browser.

🧪 REST API

POST to /api/blast with JSON:

{
  "sequence": "ATGGCGTACGTAGC",
  "program": "blastn",
  "database": "mydb",
  "extra_args": "-word_size 11"
}

Command:

curl -X POST http://localhost:5000/api/blast \
  -H "Content-Type: application/json" \
  -d '{"sequence": "ATGGCGTACGTAGC", "program": "blastn", "database": "mydb"}'

Response (tsv lines split into array of columns):

{
  "results": [["query1", "subject1", "98.7", "123", ...]]
}

Optional keys: evalue, max_target_seqs, matrix, task, word_size, filter (yes/no), strand (plus/minus). If extra_args is omitted, default_extra_args is used.

Background jobs

For long searches, POST the same JSON to /api/jobs. It returns at once with a job ID:

{"job_id": "4df9...", "status_url": "http://localhost:5000/api/jobs/4df9...", "result_url": "http://localhost:5000/job/4df9..."}

Poll status_url until state is done (or error). When done, the response includes the BLAST JSON output (outfmt 15) as blast_output. result_url is the result page in the browser.

✅ Running tests

Tests need BLAST+ on your PATH.

pip install -e ".[test]"
pytest

🗃️ Custom Databases

Prepare database for BLAST+ with -hash_index & -parse_seqids options.

makeblastdb -in mydb.fa -dbtype [nucl|prot] -hash_index -parse_seqids

Put your databases (e.g. mydb.fa.nin, mydb.fa.nsq, etc.) into the directory specified by blast_db. These will be auto-listed in the form as options, with their titles and types (via blastdbcmd -list). Alias databases (.nal/.pal) are listed too.

🔧 Production Deployment with Gunicorn and Nginx

For production environments, it is strongly recommended to run blastweb behind a WSGI server such as gunicorn and use a reverse proxy like nginx to handle TLS, compression, and static file delivery.

Example setup:

[Client] → [nginx :443/80] → [gunicorn :5000] → blastweb.app

Step 1: Install gunicorn

pip install gunicorn

Step 2: Start blastweb with gunicorn

BLASTWEB_CONFIG=/path/to/blast.yaml gunicorn blastweb.wsgi:app --bind 127.0.0.1:5000

Step 3: Configure nginx (external to this project)

a minimal nginx config:

server {
    listen 80;
    server_name your.domain.com;

    location / {
        proxy_pass http://127.0.0.1:5000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}
  • To enable HTTPS, consider using Let's Encrypt.
  • Nginx is not included in this repository — please configure it separately on your server.

🏷️ Releasing (for maintainers)

Releases are published to PyPI by GitHub Actions (.github/workflows/release.yml) when a version tag is pushed.

  1. Bump version in pyproject.toml and commit
  2. Tag and push (the tag must match the version):
git tag v0.2.0
git push origin main v0.2.0

The workflow builds the package, uploads it to TestPyPI, then PyPI, and creates a GitHub Release with auto-generated notes.

Metadata

Release files for blastweb 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blastweb 0.2.0
File Size Uploaded Provenance Actions
blastweb-0.2.0.tar.gz 24.7 kB With provenance Details for blastweb-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for blastweb 0.2.0
File Interpreter ABI Platform Actions
blastweb-0.2.0-py3-none-any.whl Python 3 none any Details for blastweb-0.2.0-py3-none-any.whl

Total release size: 47.9 kB

Release files / blastweb-0.2.0.tar.gz

Download URL blastweb-0.2.0.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f31293b6da06d44dfcfafa5d447a01f5875cedc9576ff20192189ba807cbe7d6
BLAKE2b-256 checksum
How to use checksums
964bd384b8993454d8a83ac229ebfa4045c1af5bb024c05d06a020fd1403b148
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / blastweb-0.2.0-py3-none-any.whl

Download URL blastweb-0.2.0-py3-none-any.whl
Size 23.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2ee748111713d220bb5f4ea8dec04b5524e54b9a5c543aaa232f92a298e2865
BLAKE2b-256 checksum
How to use checksums
d801590e69dcbf1c347ea3b4868c030eecbb0eb4d6cbf68296db207e64c3cd88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for blastweb 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for blastweb-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page