> ## Documentation Index
> Fetch the complete documentation index at: https://proto.evodesign.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Primer3 Thermodynamics

> Penalize DNA oligo Tm outside a range and stable hairpins/homodimers via Primer3.

![Primer3 Thermodynamics](https://proto-bio.github.io/proto-assets/images/constraint/primer3-thermodynamics/hero.png)

> [!NOTE]
>
> **License:** Primer3 has a GPL-2.0 license. Please refer to [the license](https://github.com/libnano/primer3-py/blob/master/LICENSE) for full terms.

This constraint is open source. Any third-party models, product names, or trademarks referenced are the property of their respective owners, and Proto is not affiliated with them.

***

&#x20;Tools Used Tools Used  Source Source  Cite Cite

![](https://proto-bio.github.io/proto-assets/images/tool/primer3/social.png)

&#x20;Go to Tool Page

[Open](https://proto.evodesign.org/docs/tools/sequence-scoring/primer3.md)

![Proto](https://mintcdn.com/bio-pro/cMLt8hAqaP9M3LKy/assets/logo/logo-light.svg?fit=max\&auto=format\&n=cMLt8hAqaP9M3LKy\&q=85\&s=f5e5dfd1b8f9b9db3a0be0e2eb01f678)

evo-design/proto-language

&#x20;View source

[Open](https://github.com/evo-design/proto-language/blob/1a97e675c7e5e4ae0e92be91b1bb7b49f1331104/proto_language/constraint/sequence_composition/primer3_thermodynamics_constraint.py#L106)

@articleuntergasser2012primer3

```bibtex theme={null}
@article{untergasser2012primer3,
  title={Primer3--new capabilities and interfaces},
  author={Untergasser, Andreas and Cutcutache, Ioana and Koressaar, Triinu and Ye, Jian and Faircloth, Brant C. and Remm, Maido and Rozen, Steven G.},
  journal={Nucleic Acids Research},
  volume={40},
  number={15},
  pages={e115},
  year={2012},
  publisher={Oxford University Press},
  doi={10.1093/nar/gks596}
}
```

&#x20;Copy citation

Constraint contributors[![](https://avatars.githubusercontent.com/u/61667248?v=4\&s=64)adititm](https://github.com/adititm)[![](https://avatars.githubusercontent.com/u/21143637?v=4\&s=64)bviggiano](https://github.com/bviggiano)
Score DNA oligos on Tm range and hairpin/homodimer stability.

## API Reference

ConfigPrimer3ThermodynamicsConstraintConfig[ Source](https://github.com/evo-design/proto-language/blob/1a97e675c7e5e4ae0e92be91b1bb7b49f1331104/proto_language/constraint/sequence_composition/primer3_thermodynamics_constraint.py#L40)

Configuration for the Primer3 thermodynamics constraint.

**tm\_min** `number` (default: 55.0)

Minimum acceptable Tm (°C).

**tm\_max** `number` (default: 65.0)

Maximum acceptable Tm (°C).

**tm\_tolerance** `number` (default: 10.0)

°C outside \[tm\_min, tm\_max] at which the Tm penalty reaches 1.0.

**hairpin\_dg\_min** `number` (default: -2.0)

Hairpin ΔG (kcal/mol) below which the oligo is penalized; heuristic default.

**homodimer\_dg\_min** `number` (default: -6.0)

Homodimer ΔG (kcal/mol) below which the oligo is penalized; heuristic default.

**dg\_tolerance** `number` (default: 5.0)

kcal/mol below a ΔG threshold at which that penalty reaches 1.0.

**primer3\_config** `Primer3ThermodynamicsConfig`

Ionic and oligo conditions for Primer3.

ReturnsConstraintOutput

Mean of the Tm, hairpin and homodimer penalties in `[0, 1]`
(0 = all within thresholds). `metadata` carries `tm`, `hairpin_dg`,
`homodimer_dg` and the per-term penalties.

## Usage

```python python icon="python" theme={null}
from proto_language.core import Constraint
from proto_language.constraint import primer3_thermodynamics_constraint, Primer3ThermodynamicsConstraintConfig

constraint = Constraint(
    inputs=[segment],
    function=primer3_thermodynamics_constraint,
    function_config=Primer3ThermodynamicsConstraintConfig(
        # Configure parameters here
    ),
)

scores = constraint.evaluate()
```

## Metadata

| Property | Value |
| - | - |
| Key | `primer3-thermodynamics` |
| Function | `primer3_thermodynamics_constraint` |
| Category | `sequence_composition` |
| Mode | `discrete` |
| Uses GPU | `False` |
| Supported Types | `dna` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.