Skip to main content

A simple web UI and API for running BLAST+ against local databases.

Project description

blastweb

Local BLAST search via Web UI and REST API using Flask.


🐍 Requirements

📦 Installation

Prepare venv: (Highly recommended)

python -m venv my_blastweb
source my_blastweb/bin/activate

from github:

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

🚀 Start server for development or very local use

Start the web server:

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", ...]]
}

🗃️ 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.

🔧 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blastweb-0.1.6.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blastweb-0.1.6-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file blastweb-0.1.6.tar.gz.

File metadata

  • Download URL: blastweb-0.1.6.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for blastweb-0.1.6.tar.gz
Algorithm Hash digest
SHA256 1124d9ae8912e7a14e60fd403a5a4474ca42cd5da7c8532c79f798b67bf9bf0e
MD5 1d323f884311a161ef6884d21de7baf4
BLAKE2b-256 14799e98fd06a8cdcd24f2984f1a9a07ba083a3673b104666711626a56026013

See more details on using hashes here.

File details

Details for the file blastweb-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: blastweb-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for blastweb-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fad280c1d594d6a7c8c34e9cc56b3b99a6eff4825839e4cd10d59eca7ae0e956
MD5 2ba076b0ed90afa3f17fb0ec62bee9ff
BLAKE2b-256 bf084d1e1492b32d0b46056895a73483374815d77119e68c6e856fc4cb07aa46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page