Headless Primer3Plus logic — Boulder-IO parsing, subprocess runners, no Flask dependency
Project description
primer3plus-core
Headless Python core for Primer3Plus — Boulder-IO parsing, subprocess runners, and settings management. No Flask dependency.
This package provides the non-Web logic extracted from the Primer3Plus server. It can be used as a standalone library to run Primer3 from Python without a browser.
Requirements
- Python >= 3.9
primer3_coremust be installed and available onPATH
Install
pip install primer3plus-core
Or from source:
git clone https://github.com/primer3-org/primer3plus-core.git
cd primer3plus-core
pip install .
Quick start
Prepare input and run Primer3
from primer3plus_core.boulder import prepare_input
from primer3plus_core.runner import run_primer3
from primer3plus_core.files import new_uuid, work_dir
# Prepare Boulder-IO input (normalises newlines, injects mispriming libs)
raw = open("my_input.txt").read()
prepared = prepare_input(raw)
# Write to a work directory
uuidstr = new_uuid()
sf = work_dir("data", uuidstr)
infile = f"{sf}/p3p_{uuidstr}_input.txt"
with open(infile, "w") as f:
f.write(prepared)
# Run primer3_core
outfile = f"{sf}/p3p_{uuidstr}_output.txt"
error = run_primer3(infile, outfile,
f"{sf}/p3p_{uuidstr}_error.txt",
f"{sf}/p3p_{uuidstr}.log")
if error:
print("Error:", error)
else:
print(open(outfile).read())
Load default settings
from primer3plus_core.settings import load_default_settings
settings_json = load_default_settings()
print(settings_json[:80])
Parse prefold input (UNAFold)
from primer3plus_core.boulder import parse_prefold_input
dat = parse_prefold_input(open("prefold_input.txt").read())
print("Sequence:", dat["seq"][:40], "...")
print("Temp:", dat["temp"])
API modules
| Module | Purpose |
|---|---|
primer3plus_core.boulder |
Boulder-IO parsing, normalisation, tag injection, primer counting |
primer3plus_core.runner |
run_primer3(), run_unafold(), run_amplicon3() — subprocess with timeout |
primer3plus_core.files |
UUID helpers, work-directory creation, path builders |
primer3plus_core.settings |
Load settings JSON files shipped with the package |
primer3plus_core.logging |
Run-logging helper (IP/UA passed by caller) |
primer3plus_core.models |
RunError exception, result dataclasses |
primer3plus_core.config |
Paths and constants |
Development
pip install -e ".[dev]"
python -m pytest tests/ -v
License
GPL-3.0-or-later — same as Primer3Plus.
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 primer3plus_core-0.1.0.tar.gz.
File metadata
- Download URL: primer3plus_core-0.1.0.tar.gz
- Upload date:
- Size: 345.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3adb79b6e6170d76278c6e9f1ad0b4d8226e24085f9c50bccc99706154d6a0be
|
|
| MD5 |
ccd73f5a671f2f8dbeef170d7023d14a
|
|
| BLAKE2b-256 |
f647be4b4f9f9bf8d9e69c641c2cca50c4f809e453e71c66449906679d978814
|
File details
Details for the file primer3plus_core-0.1.0-py3-none-any.whl.
File metadata
- Download URL: primer3plus_core-0.1.0-py3-none-any.whl
- Upload date:
- Size: 350.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50da66ef722036ac08eedaeca069b50687e39e50fb98ef5d4eeb11990886ce0d
|
|
| MD5 |
48a769f1b8672a2de47ee25bf84d64c7
|
|
| BLAKE2b-256 |
b5deb9918c778d7f971f864e61af0a5ad7d8ab8d1691d52dd066fba525f48c44
|