A toolkit for fetching, validating and interrogating tiled amplicon PCR primer scheme definitions. Provides convenient programmatic access to the PHA4GE primer-schemes repository, a community repository of tiled amplicon primer schemes.
Recommended:
uv tool install primaschemaAlternatives:
pipx install primaschema
# or
python -m pip install primaschemaDownload a scheme from the default index and validate it:
primaschema get example-scheme/400/v1.0.0 --output ./schemes
primaschema validate ./schemes/example-scheme/400/v1.0.0/info.jsonShow CLI help or version:
primaschema --help
primaschema --show-versioncreate: Create a new scheme from aprimer.bedandreference.fasta.validate: Validate a single scheme or all schemes under a directory.rebuild: Recompute checksums, regenerate scheme README, and optionally reformatprimer.bed.index: Build or update anindex.jsonfor a local schemes directory.get: Download schemes from an index (default is the PHA4GE primer-schemes index).modify: Update contributors, vendors, tags, status, license, target organisms, and algorithm fields.
mkdir -p ./schemes && rm -rf ./schemes/example-scheme
primaschema create \
--name example-scheme \
--amplicon-size 400 \
--version v1.0.0 \
--contributors "name=Alice Smith,email=alice@example.org" \
--target-organisms "common_name=Example organism,ncbi_tax_id=000001" \
--status VALIDATED \
--bed-path ./example-scheme.primer.bed \
--reference-path ./example-scheme.reference.fasta \
--primer-schemes-path ./schemesThe scheme is written to ./schemes/example-scheme/400/v1.0.0/.
Many commands accept --primer-schemes-path. You can also set it once:
export PRIMER_SCHEMES_PATH=./schemesgit clone https://github.com/pha4ge/primaschema.git
cd primaschema
uv sync --all-extras
uv run primaschema --help
uv run pytest
uv run pre-commit install
uv run pre-commit run --all-filesuv sync --all-extras installs optional dependencies, including the dev extra (e.g. pytest, pre-commit, ruff) defined in pyproject.toml.
The Pydantic model (src/primaschema/schema/info.py) is generated from the LinkML schema (src/primaschema/schema/info.yml). After modifying the schema, regenerate with:
uv run gen-pydantic src/primaschema/schema/info.yml --meta None > src/primaschema/schema/info.py