1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Pedantic lint overrides for FFI-heavy crate:
// - Casting between c_int/usize is inherent to FFI bridging code
// - Many small builder/getter methods don't benefit from #[must_use]
//! # primer3
//!
//! Safe, idiomatic Rust bindings to the [primer3](https://primer3.org/) C library
//! for PCR primer design and oligonucleotide thermodynamic calculations.
//!
//! ## Quick Start
//!
//! ### Melting Temperature
//!
//! ```no_run
//! use primer3::calc_tm;
//!
//! let tm = calc_tm("GTAAAACGACGGCCAGT").unwrap();
//! println!("Tm = {tm:.1}°C");
//! ```
//!
//! ### Thermodynamic Analysis
//!
//! ```no_run
//! use primer3::{calc_hairpin, calc_homodimer, calc_heterodimer};
//!
//! let hairpin = calc_hairpin("CCCCCATCCGATCAGGGGG").unwrap();
//! println!("Hairpin Tm = {:.1}°C, dG = {:.0} cal/mol", hairpin.tm(), hairpin.dg());
//!
//! let dimer = calc_heterodimer("AAAAAAAAAA", "TTTTTTTTTT").unwrap();
//! println!("Heterodimer Tm = {:.1}°C", dimer.tm());
//! ```
//!
//! ### Primer Design
//!
//! ```no_run
//! use primer3::{design_primers, SequenceArgs, PrimerSettings};
//!
//! let seq_args = SequenceArgs::builder()
//! .sequence("ATCGATCG...")
//! .target(100, 200) // start=100, length=200
//! .build()
//! .unwrap();
//!
//! let settings = PrimerSettings::builder()
//! .primer_opt_tm(60.0)
//! .primer_min_tm(57.0)
//! .primer_max_tm(63.0)
//! .product_size_range(75, 150)
//! .build()
//! .unwrap();
//!
//! let result = design_primers(&seq_args, &settings, None, None).unwrap();
//! for pair in result.pairs() {
//! println!("{}", pair.left().sequence());
//! }
//! ```
//!
//! ## Thread Safety
//!
//! The underlying C library uses global state for thermodynamic parameters,
//! which are compiled in from `thal_default_params.h` (no file I/O needed).
//! Thermodynamic calculation functions (`calc_tm`, `calc_hairpin`, etc.) are
//! safe to call concurrently. Both `design_primers()` and `align()` are
//! mutex-guarded because the underlying C routines use mutable global state
//! (primer3's internal bookkeeping and dpal's ~40 MB scoring/traceback
//! matrices, respectively).
//!
//! ## Defaults
//!
//! This crate uses primer3 C library v2 defaults (`p3_create_global_settings()`).
//! Some defaults differ from primer3-py -- consult the primer3 manual for details.
pub use ;
pub use SolutionConditions;
pub use design_primers;
pub use ;
pub use ;
pub use SequenceLibrary;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;