← Back to DAGDA | Support | Source: https://github.com/WitchDevelops/cloning-assistant
Skip to content

About

Bench companion for molecular cloning: reaction setup calculators and a 96-well plate map that tracks which wells are spent.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Cloning Screening Assistant

CI License: MIT FAIR checklist badge DOI

Calculators and a 96-well plate map for screening colonies after ligation and transformation.

Live: https://cloning-assistant.onrender.com/

API docs: https://cloning-assistant-api.onrender.com/docs

(free tier: the API sleeps when idle, so the first calculation can take up to a minute while it wakes up)

Stack

Python/FastAPI backend, React/TypeScript frontend

What works today

  • Dilution calculator
  • Endpoint returning standard buffers (predefined set)
  • Endpoint returning ligation reaction volumes (frontend coming soon)

Planned work

  • The calculators: ligation (in progress), restriction digest, gel loading dye, colony PCR master mix
  • The 96-well plate map: configurable start well, well states, multi-plate overflow, print and JSON export
  • Docker image

Accessibility

Built to WCAG 2.2 AA. Current state:

  • Automated: axe DevTools reports zero violations on every page, including best-practice rules.
  • Manual: keyboard navigation throughout, including the menu button (WAI-ARIA APG pattern); visible focus; forced-colors and prefers-reduced-motion honoured; per-route page titles; calculation results announced via a live region, tested with a screen reader (NVDA). The live-region behaviour is additionally covered by a DOM-level test.

Colour tokens are checked against 1.4.3 and 1.4.11 in both light and dark mode.

How to run it locally

Prerequisites

  • uv - manages Python and the backend dependencies
  • Node.js - version in frontend/.nvmrc

You do not need to install Python separately. uv reads backend/.python-version and downloads the right interpreter itself.

Installing uv

macOS / Linux

curl -LsSf https://astral.sh/uv/install.sh | sh

Windows (PowerShell)

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Or, with a package manager: brew install uv, winget install --id=astral-sh.uv -e.

Installing Node

macOS / Linux - with nvm:

Run the command from frontend/:

nvm install

then once it installs, point it at the Node version that this project uses with:

nvm use

Windows - nvm-windows, fnm, or the installer from nodejs.org.

then once it installs, point it at the Node version that this project uses with:

nvm use

Running it locally

Commands below for running each server are identical on Linux, macOS and Windows.

Backend

cd backend
cp .env.example .env
uv sync
uv run dev

Serves on http://localhost:8000.

Frontend

In a second terminal:

cd frontend
npm ci
npm run dev

Serves on http://localhost:5173.

Running both servers with a single command

This is possible only on Linux, macOS and WSL (no Windows support). To run both servers at once from a single terminal, run from the repo root:

uv run dev.py

Then stop both with Ctrl+C. If one server crashes, the other one is stopped to free the port.

Contributing

Issues and feedback are very welcome. If you'd like to work on an issue, first comment on it - for now I'm writing issue descriptions for myself, so it might not be fully clear what is the scope of work. Get it touch and I'll contact you with futher details.

Pre-commit hooks

This repo uses pre-commit hooks. To set it up, install pre-commit after cloning:

uv tool install pre-commit
pre-commit install

This runs on every commit, only against the staged files:

  • ruff - lint and format the backend
  • eslint - lint the frontend
  • trailing whitespace, end-of-file newline, YAML/JSON validity, large-file guard

Most hooks fix files in place. When one does, re-stage and commit again.

To run everything without committing:

pre-commit run --all-files

Tests

Frontend uses Vitest, backend uses pytest. Commands to run the tests:

cd backend && uv run pytest
cd frontend && npm test

Type checking runs in CI rather than in the commit hook, because mypy needs the project's installed dependencies and pre-commit's hook environments are isolated from them:

cd backend && uv run mypy src

Validation

Input validation is deliberately done twice:

  • Zod on the front end for immediate user feedback and data cleaning,
  • Pydantic on the back end as the real gate.

Never trust the raw input from the user.

The units shown in the dropdowns for calculations are declared twice (in Python backend and in TypeScript frontend) because waiting for server response for the dropdown is really bad UX and requires a separate endpoint. Two checks stop the copies from drifting: CI regenerates contracts/units.json from the Python enum and fails if the committed file is stale, and a Vitest test asserts the TypeScript table matches that file.

From backend/, run:

uv run python scripts/export_units.py

to write a JSON file to contracts/units.json, then from frontend/ npm run test.

References:

NEB protocols

Cold Spring Harbor protocols

About

Bench companion for molecular cloning: reaction setup calculators and a 96-well plate map that tracks which wells are spent.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages