Skip to main content

primalscheme

License: GPL v3 Build Quality Gate Status


about

primalscheme is a tool for designing primer panels for multiplex PCR. It uses a greedy algorithm to find primers for tiling amplicon generation for multiple reference genomes. It works best on viral isolates of known lineages e.g. outbreak strains.

web interface

a web interface is available at primalscheme.com, although it does not currently support all available options.

requirements

  • Linux, macOS or Windows
  • Python 3.7+

installation from PyPI using pip

Create & activate a virtual environment (recommended):

python3 -m venv /path/to/primal-venv
source /path/to/primal-venv/bin/activate

or on Windows:

python -m venv c:\path\to\primal-venv
c:\path\to\primal-venv\Scripts\activate.bat

Install primalscheme with pip:

pip install primalscheme

installation from source

git clone https://github.com/aresti/primalscheme.git primalscheme
cd primalscheme
python3 -m venv venv
source venv/bin/activate
pip install .

Note: if you'd like your installation to be editable, use:

pip install flit
flit install --pth-file

(--pth-file vs --symlink: maintains module visibility for IDE debuggers, and works on Windows.)

command line interface

To design a multiplex scheme run primalscheme multiplex <FASTA>.

If you're looking for test inputs you can try CHIKV_demo.fa, Ebov-10-Pan.fasta or nCov-2019.fasta

optional arguments

  • --amplicon-size, -a: Amplicon size target. Pass twice to set an exact range (e.g, -a 220 -a 250), otherwise expect +/- 5% (default 380, 420).
  • --outpath, -o: Path to output directory (default: ./output).
  • --name, -n: Prefix name for your outputs (default: scheme).
  • --target-overlap, -t: Target insert overlap size (default: 0).
  • --debug, -d: Set log level DEBUG.
  • --force, -f: Force output to an existing directory, overwrite files.
  • --pinned, -p: Only consider primers from the first reference.
  • --high-gc, -g: Use config suitable for high-GC sequences.
  • --help, -h: Show help message and exit.

modifying config

Many parameters are not directly exposed in the CLI as we believe they are necessary for successful multiplex PCR. However, most values can be modified in config.py if you install the package from source in editable mode with flit install --pth-file (see above).

output

  • {output_dir}/{prefix}.reference.fasta - all input references
  • {output_dir}/{prefix}.primer.bed - coordinates of primer positions
  • {output_dir}/{prefix}.insert.bed - coordinates of trimmed amplicons
  • {output_dir}/{prefix}.primer.tsv - primer sequences and information
  • {output_dir}/{prefix}.plot.pdf - diagrammatic overview of scheme (PDF)
  • {output_dir}/{prefix}.plot.svg - diagrammatic overview of scheme (SVG)
  • {output_dir}/{prefix}.report.json - run report (reference ids, regions, gaps, coverage)
  • {output_dir}/{prefix}.pickle - pickled Python objects (if --debug)
  • {output_dir}/{prefix}.log - run logs (more detail if --debug)

how to design a scheme

  1. Download complete genomes from GenBank and concatenate into a single FASTA file.
    • e.g. cat "sequence (1).fasta" "sequence (2).fasta" > input.fasta
  2. Align all sequences using Clustal Omega.
  3. The genomes should be complete and roughly the same length.
    • Primers are only designed within the limits of the alignment.
    • The first reference will be used for the coordinate system in the output scheme.
  4. Check the 'Result Summary' tab then the 'Percent Identity Matrix' link to check the identity matrix of all sequences.
    • Check that the maximum sequence divergence is not more than 5%.
    • If your sequences are more divergent, it may be necessary to separate them into multiple independent schemes; the 'Phylogenetic Tree' tab may be useful for this.
  5. Remove sequences with 99-100% identity to other genomes in the file as these will bias the primer selection
  6. Run primalscheme on your FASTA file.
    • Optionally, set amplicon min/max length as required by your sequencing technology.

protocol

We strongly recommend using the PCR conditions outlined in the Nature Protocols paper.

description of the algorithm

  • Set the first reference as primary, to be used for the coordinate system.
  • Open a region window of width AMPLICON_SIZE_MAX onto the primary reference.
  • Align the flanks of this reference slice to all other references using parasail.
  • Take all aligned flanks and digest them into K-mers (primers) of length PRIMER_SIZE_MIN to PRIMER_SIZE_MAX.
  • Hard filter the primers to eliminate those with unacceptable GC, Tm, hairpin structures & homopolymer length.
  • Filter out any primers with > PRIMER_MAX_MISMATCHES against any reference.
  • Sort left and right primers according to base penalty plus weighted mismatch score.
  • Check for heterodimers in same pool using primer3-py; select top scoring, non-interacting pair.
  • Open new window position set to maintain overlap if region is successful.
  • Repeat routine until end of genome is reached.
  • If during the above routine there is a) failed alignment b) no primers after filtering then:
    • Move window position left by STEP_DISTANCE before retrying.
    • Continue stepping left until a hard-left limit is reached (start of genome, primer collision or no progress).
    • Reset window position to initial value.
    • Move window position right (to open a gap or reduce overlap) before retrying.
    • Exclude secondary reference on repeated flank alignment failure.

citing

If you use primalscheme please cite:

Quick J et al. Multiplex PCR method for MinION and Illumina sequencing of Zika and other virus genomes directly from clinical samples. Nat Protoc. 2017 Jun;12(6):1261-1276.

Metadata

Release files for primalscheme 1.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for primalscheme 1.4.1
File Size Uploaded Provenance Actions
primalscheme-1.4.1.tar.gz 79.3 kB Without provenance Details for primalscheme-1.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for primalscheme 1.4.1
File Interpreter ABI Platform Actions
primalscheme-1.4.1-py3-none-any.whl Python 3 none any Details for primalscheme-1.4.1-py3-none-any.whl

Total release size: 116.2 kB

Release files / primalscheme-1.4.1.tar.gz

Download URL primalscheme-1.4.1.tar.gz
Size 79.3 kB
Tags Source
SHA-256 checksum
How to use checksums
51eaf234ea1adc8412d11a7b395329c6d08a66c52e8594adf567382469eb701a
BLAKE2b-256 checksum
How to use checksums
9b124a8d5b4312a0b6cf51d52807bdc40e6466618e54b81006e39e22644cc1ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.1

Release files / primalscheme-1.4.1-py3-none-any.whl

Download URL primalscheme-1.4.1-py3-none-any.whl
Size 37.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb1d5c75574d88431384bda51f02d922d682fe0d2b0d6cc9c3f2557901d27b4f
BLAKE2b-256 checksum
How to use checksums
3a68f424712f3c0fe81f31debb70b92a471e28fb6d88d0ee6a91c39948cd261d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.1

Security for primalscheme 1.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page