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"
  • 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

🚀 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.4.tar.gz (9.3 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.4-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: blastweb-0.1.4.tar.gz
  • Upload date:
  • Size: 9.3 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.4.tar.gz
Algorithm Hash digest
SHA256 c7467c5282f2837fc285858ffe953a1a30e13a5507123e45ada814278dba7444
MD5 bb6bbd5c5af1d2654d588699ae6dceb2
BLAKE2b-256 4a27d73dffcbe7acaba5104924205695d70a0ffd3da89dbef0b294d23ce8ec8e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: blastweb-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.3 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 036925a2a8a814fc33b4c8d6887d786283e928e21a7157f2eb86ba1d87c738f8
MD5 865c460acbc8f1a0e34a2ceffdc1c90b
BLAKE2b-256 879847cdb17bf4058b6944118db31df78f1584818dd017dcdecc09fdcac5c716

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