Skip to main content

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

  1. Clone or create the project directory:

    mkdir bgc-viewer
    cd bgc-viewer
    
  2. Create the project structure and files (as shown above)

  3. Initialize the project with uv:

    uv venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    uv pip install -e .
    
  4. 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 tester
  • GET /api/data - Get all custom data
  • GET /api/users - Get user list
  • GET /api/users/<id> - Get specific user
  • GET /api/stats - Get application statistics
  • GET /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

  1. Create a data/custom_data.json file with your data structure
  2. Modify the load_custom_data() function in app.py to read from your data source
  3. Update the API endpoints to serve your custom data

Customization

Adding New Endpoints

  1. Add new route functions to app.py
  2. Update the HTML template to include new endpoints
  3. 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


Download files

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

Source Distribution

bgc_viewer-0.1.0.tar.gz (6.6 MB view details)

Uploaded Source

Built Distribution

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

bgc_viewer-0.1.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file bgc_viewer-0.1.0.tar.gz.

File metadata

  • Download URL: bgc_viewer-0.1.0.tar.gz
  • Upload date:
  • Size: 6.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for bgc_viewer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 011680bcfba4175ad0b3d40c7c0db38980b603354b058499664cb1c2bc78513a
MD5 119c77c56b4d2411392607a55a63a6ee
BLAKE2b-256 f56ba4b66e80a6fabc1747a52302524edcbd7901cc4e25fa8258bf809808fc08

See more details on using hashes here.

File details

Details for the file bgc_viewer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bgc_viewer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for bgc_viewer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61b86c90310267d51a1adef336a4708565f4b21b222cb4a7f7f777da73e2f50d
MD5 89bbc3a2d734104f30b07155c3bed941
BLAKE2b-256 0a38ae6c1bbe221997a148e947b8af4ebd32e0fadf4e27b72ee5ea5b23485819

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