Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DNA Barcode Validator API

A FastAPI wrapper around naturalis/barcode_validator. It validates batches of DNA barcodes against the upstream package's marker-specific length and ambiguity criteria and also rejects non-IUPAC characters.

Supported markers are COI-5P, matK, rbcL, ITS, and ITS2.

Run locally

Python 3.11–3.13 is supported.

uv sync --extra dev
uv run uvicorn app.main:app --reload

Open http://localhost:8000/docs for the generated OpenAPI UI.

Validate barcodes

curl -X POST http://localhost:8000/v1/validate \
  -H 'content-type: application/json' \
  -d '{
    "marker": "ITS",
    "barcodes": [
      {"id": "sample-1", "sequence": "ACGTACGT"}
    ],
    "min_length": 8,
    "max_ambiguities": 0
  }'

The response contains one result per barcode, individual check outcomes, and an all_valid batch summary. Whitespace is removed from sequences and bases are normalized to uppercase.

Request limits:

  • 100 barcodes per request
  • 100,000 characters per barcode before whitespace normalization

Validation scope

This API reports validation_scope: "core_structural". It uses the upstream package's structural measurement and marker-criteria classes for:

  • IUPAC DNA alphabet checks
  • minimum barcode length
  • maximum ambiguous-base count

It does not perform HMM alignment, stop-codon analysis, or taxonomic validation. Those upstream workflows require HMMER and project-specific taxonomy/reference data, which are not meaningful without deployment-specific configuration.

Tests

uv run --extra dev pytest
uv run --extra dev ruff check .

Docker

docker build -t dna-barcode-validator-api .
docker run --rm -p 8000:8000 dna-barcode-validator-api

Render deployment

The repository includes a Render Blueprint and a GitHub Actions CI workflow. Pull requests and pushes to main run linting and tests. Render deploys pushes to main only after those GitHub checks pass.

One-time setup:

  1. In Render, create a new Blueprint and connect this GitHub repository. Render will read render.yaml and create the Docker web service.
  2. Confirm that the service is linked to the repository's main branch and that Auto-Deploy is set to After CI Checks Pass. The Blueprint's autoDeployTrigger: checksPass configures this automatically when synced.
  3. Push or merge a commit to main. GitHub Actions will run the checks, and Render will deploy the commit after they succeed.

No GitHub deploy-hook secret is required. The configured /health endpoint is used by Render to decide when the new instance is ready to receive traffic.

About

A FastAPI wrapper around Naturalis's DNA barcode validator

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages