A Flask server for Biosynthetic Gene Cluster analysis
Project description
BGC-Viewer
!!Work-in-progress!!
A viewer for BGC data.
Project Structure
bgc-viewer/
├── bgc_viewer/
│ ├── __init__.py
│ ├── app.py # Main Flask application
│ ├── static/
│ │ └── style.css # Styling
│ │ └── app.js # Frontend JavaScript
│ └── templates/
│ └── index.html # Main HTML template
├── data/
│ └── custom_data.json # Optional custom data file
├── tests/
│ └── test_app.py # Test files
├── pyproject.toml # Project configuration
├── README.md
└── .gitignore
Setup
Prerequisites
- Python 3.8+
- uv package manager
Installation
-
Clone or create the project directory:
mkdir bgc-viewer cd bgc-viewer
-
Create the project structure and files (as shown above)
-
Initialize the project with uv:
uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate uv pip install -e .
-
For development dependencies:
uv pip install -e ".[dev]"
Usage
Running the Server
# Using the console script
serve
# Or directly with Python
python -m bgc_viewer.app
# Or with environment variables
FLASK_DEBUG=true PORT=8000 serve
The server will start on http://localhost:5005 by default.
API Endpoints
GET /- Main HTML page with interactive API testerGET /api/data- Get all custom dataGET /api/users- Get user listGET /api/users/<id>- Get specific userGET /api/stats- Get application statisticsGET /api/health- Health check endpoint
Testing the API
Visit http://localhost:5005 in your browser to access the interactive API tester, or use curl:
# Get all data
curl http://localhost:5005/api/data
# Get users
curl http://localhost:5005/api/users
# Get specific user
curl http://localhost:5005/api/users/1
# Health check
curl http://localhost:5005/api/health
Development
Code Formatting
# Format code
uv run black bgc_viewer/
# Lint code
uv run flake8 bgc_viewer/
# Type checking
uv run mypy bgc_viewer/
Testing
# Run tests
uv run pytest
# Run tests with coverage
uv run pytest --cov=bgc_viewer
Adding Custom Data
- Create a
data/custom_data.jsonfile with your data structure - Modify the
load_custom_data()function inapp.pyto read from your data source - Update the API endpoints to serve your custom data
Customization
Adding New Endpoints
- Add new route functions to
app.py - Update the HTML template to include new endpoints
- Add corresponding JavaScript functions if needed
Styling
Modify static/css/style.css to customize the appearance of the web interface.
Frontend Behavior
Update static/js/app.js to add new interactive features.
Environment Variables
Environment variables can be set to change the configuration of the viewer.
A convenient way to change them is to put a file called .env in the directory from
which you are running the application.
BGCV_HOST- Server host (default: localhost)BGCV_PORT- Server port (default: 5005)BGCV_DEBUG_MODE- Enable dev/debug mode (default: False)
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bgc_viewer-0.1.1-py3-none-any.whl.
File metadata
- Download URL: bgc_viewer-0.1.1-py3-none-any.whl
- Upload date:
- Size: 63.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75f7c0b54129882fce4f951e9929122e4d4eb7fa50c450de7f94bafd73469c0f
|
|
| MD5 |
9c7074a9b43cc0e2e5aba1f47f01653a
|
|
| BLAKE2b-256 |
f2ced698d6761f4e8281949a04f9673bc0fcdbc2b0f4bfab5cf9c38430a5a7ae
|