Python client for the MajorGroove API
Project description
Major Groove
Lightweight DNA oligo planning toolkit and web UI. Manage sequences and plate layouts, export to vendor-friendly spreadsheets, and validate Watson–Crick constraints against order files. Ships as both a Flask app and a small Python library.
Highlights
- Sequences: import from CSV/XLSX, quick edit, bulk delete, export to CSV/XLSX (UI and API).
- Plates (6/96/384): create/edit/bulk-create, source/destination flag, vendor plate types, import from XLS/XLSX, export to XLSX (UI and API).
- Order check (Watson–Crick): define constraints between named sequences or domains and validate against parsed plate orders.
- Utilities: reverse complement tool, duplex distribution explorer (with JSON API).
- Library-first:
majorgrooveexposes parsers, exporters, and constraint validation for direct Python use.
Quickstart
- Create and activate a venv
python3.13 -m venv venv
source venv/bin/activate
- Install dependencies
# Optional: nupack (needed for duplex tools)
cd third_party/nupack-4.0.2.0
pip install -U nupack -f package
cd -
# App/library deps
pip install -r requirements.txt
Note: Ensure your Python version matches an available wheel in third_party/nupack-4.0.2.0/package/ (e.g., cp313 for Python 3.13).
- Run the web app
python app.py
Open http://localhost:5002.
What you can do
Sequences
- UI:
Sequencespage for list, inline edit, delete, bulk delete, export. - Import from CSV/XLSX; export selected to CSV/XLSX.
- API:
GET/POST/PUT /api/sequences,POST /api/sequences/export.
Plates (6/96/384)
- UI: create/edit single plates, or bulk create from JSON; enforce unique names.
- Import plate layouts from Excel (XLS/XLSX) — each sheet becomes a plate.
- Automatic vendor
plate_typesuggestions based on dimensions and role (source/destination). - Export selected plates to XLSX.
- API:
GET/PUT /api/plates,GET /api/plates/<id>,POST /plates/export.
Order check (Watson–Crick constraints)
- Define relationships between sequences (or domains) by name and validate against parsed order spreadsheets.
- UI helper:
Tools → Check Order (WC)with a Python snippet and sampleZebraOrder.xlsx.
Python API (library)
from majorgroove import (
parse_sequences_from_csv, parse_sequences_from_excel,
parse_plates_from_excel,
export_sequences_to_csv, export_sequences_to_xlsx, export_plates_to_xlsx,
ConstraintType, WatsonCrickConstraint, validate_constraints, reverse_complement,
)
# Parse plates from an order workbook
orders = parse_plates_from_excel("app/static/ZebraOrder.xlsx")
# Validate a WC constraint between named sequences (optionally by domain index)
constraints = [
WatsonCrickConstraint(
sequence1_plate_name=list(orders)[1], # pick a sheet/plate
sequence1_name="1^*B0", sequence1_domain_ID=2,
sequence2_plate_name=list(orders)[1],
sequence2_name="0*N1^", sequence2_domain_ID=0,
constraint_type=ConstraintType.REVERSE_COMPLEMENT,
),
]
validate_constraints(orders, constraints, verbose=True)
# Utilities
rc = reverse_complement("ACGT NNN /iSp18/ ACGT") # -> TGCATGC...
Export helpers return in-memory bytes you can write to disk:
with open("plates.xlsx", "wb") as f:
f.write(export_plates_to_xlsx(list(orders.values())))
Web tools
- Reverse complement:
/reverse-complement - Duplex distribution:
/duplex-distribution- JSON APIs:
POST /api/duplex-distribution/get-duplex-distribution,POST /api/duplex-distribution/generate-sequences
- JSON APIs:
- Order WC checker helper:
/check-order-wc(includes example code and sample workbook)
REST API (selected)
- Sequences:
GET/POST/PUT /api/sequences - Plates:
GET/PUT /api/plates,GET /api/plates/<id>
Deployment
- Sample configs:
gunicorn_config.py.example,majorgroove.nginx.conf.example,majorgroove.service.example. - Production deps:
pip install -r requirements-prod.txt.
Tests
pytest -q
Sample data
- Example order workbook:
app/static/ZebraOrder.xlsx.
Project structure (abridged)
app/ # Flask UI & routes (sequences, plates, tools, API)
majorgroove/ # Library: models, parser, export, constraints
third_party/ # NUPACK (optional, for duplex tools)
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 Distribution
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 majorgroove-0.2.0.tar.gz.
File metadata
- Download URL: majorgroove-0.2.0.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79e2eae6777e0407e53ca631f82943dd087d4829478c7c2394c4f8f36f2702db
|
|
| MD5 |
da1614afb09a503c0e2d76bfafb3bfef
|
|
| BLAKE2b-256 |
25afd7a7da23c8238447931c2c48ece1778f7e73f44290e8d9682c72edaa1507
|
File details
Details for the file majorgroove-0.2.0-py3-none-any.whl.
File metadata
- Download URL: majorgroove-0.2.0-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c288ba3f0c51889c7ec105ecac660aac7da099eb09f815c61d6f547e2e085fd0
|
|
| MD5 |
c3be81ca3c2a952b16190ab59cf37bba
|
|
| BLAKE2b-256 |
f0659f19bb1674430178ca4da750333c0fa07a3152db3389e91c8c7d8e1ab3db
|