seqfold
Predict the minimum free energy structure of nucleic acids.
seqfold is an implementation of the Zuker, 1981 dynamic programming algorithm, the basis for UNAFold/mfold, with energy functions from SantaLucia, 2004 (DNA) and Turner, 2009 (RNA).
The folding/Tm engine is written in Rust and exposed to Python through PyO3/maturin.
Installation
Conda
conda install -c bioconda seqfold
Thank you to @jonas-fuchs for this.
pip
pip install seqfold
Prebuilt wheels include the compiled Rust extension, so no Rust toolchain is needed to install.
Usage
Python
from seqfold import fold, dg, dg_cache, dot_bracket
# just returns minimum free energy
dg("GGGAGGTCGTTACATCTGGGTAACACCGGTACTGATCCGGTGACCTCCC", temp = 37.0) # -13.4
# `fold` returns a list of `seqfold.Struct` from the minimum free energy structure
structs = fold("GGGAGGTCGTTACATCTGGGTAACACCGGTACTGATCCGGTGACCTCCC")
print(sum(s.e for s in structs)) # -13.4, same as dg()
for struct in structs:
print(struct) # prints the i, j, ddg, and description of each structure
# `dg_cache` returns a 2D array where each (i,j) combination returns the MFE from i to j inclusive
cache = dg_cache("GGGAGGTCGTTACATCTGGGTAACACCGGTACTGATCCGGTGACCTCCC")
# `dot_bracket` returns a dot_bracket representation of the folding
print(dot_bracket(seq, structs)) # ((((((((.((((......))))..((((.......)))).))))))))
CLI
usage: seqfold [-h] [-t FLOAT] [-d] [-r] [--version] SEQ
Predict the minimum free energy (kcal/mol) of a nucleic acid sequence
positional arguments:
SEQ nucleic acid sequence to fold
optional arguments:
-h, --help show this help message and exit
-t FLOAT, --celcius FLOAT
temperature in Celsius
-d, --dot-bracket write a dot-bracket of the MFE folding to stdout
-r, --sub-structures write each substructure of the MFE folding to stdout
--version show program's version number and exit
Examples
$ seqfold GGGAGGTCGTTACATCTGGGTAACACCGGTACTGATCCGGTGACCTCCC --celcius 32
-15.3
$ seqfold GGGAGGTCGTTACATCTGGGTAACACCGGTACTGATCCGGTGACCTCCC --celcius 32 --dot-bracket --sub-structures
GGGAGGTCGTTACATCTGGGTAACACCGGTACTGATCCGGTGACCTCCC
((((((((.((((......))))..((((.......)))).))))))))
i j ddg description
0 48 -1.9 STACK:GG/CC
1 47 -1.9 STACK:GG/CC
2 46 -1.4 STACK:GA/CT
3 45 -1.4 STACK:AG/TC
4 44 -1.9 STACK:GG/CC
5 43 -1.6 STACK:GT/CA
6 42 -1.4 STACK:TC/AG
7 41 -0.5 BIFURCATION:4n/3h
9 22 -1.1 STACK:TT/AA
10 21 -0.7 STACK:TA/AT
11 20 -1.6 STACK:AC/TG
12 19 3.0 HAIRPIN:CA/GG
25 39 -1.9 STACK:CC/GG
26 38 -2.3 STACK:CG/GC
27 37 -1.9 STACK:GG/CC
28 36 3.2 HAIRPIN:GT/CT
-15.3
Notes
- The type of nucleic acid, DNA or RNA, is inferred from the input sequence.
seqfoldis case-insensitive with the input sequence.- The default temperature is 37 degrees Celsius for both the Python and CLI interface.
Motivation
Secondary structure prediction is used for making PCR primers, designing oligos for MAGE, and tuning RBS expression rates.
While UNAFold and mfold are the most widely used applications for nucleic acid secondary structure prediction, their format and license are restrictive. seqfold is meant to be an open-source, minimalist alternative for predicting minimum free energy secondary structure.
| seqfold | mfold | UNAFold | |
|---|---|---|---|
| License | MIT | Academic Non-commercial | $200-36,000 |
| OS | Linux, MacOS, Windows | Linux, MacOS | Linux, MacOS, Windows |
| Format | python, CLI python | CLI binary | CLI binary |
| Dependencies | none | (mfold_util) | Perl, (gnuplot, glut/OpenGL) |
| Graphical | no | yes (output) | yes (output) |
| Heterodimers | no | yes | yes |
| Constraints | no | yes | yes |
Citations
Papers, and how they helped in developing seqfold, are listed below.
Nussinov, 1980
Nussinov, Ruth, and Ann B. Jacobson. "Fast algorithm for predicting the secondary structure of single-stranded RNA." Proceedings of the National Academy of Sciences 77.11 (1980): 6309-6313.
Framework for the dynamic programming approach. It has a conceptually helpful "Maximal Matching" example that demonstrates the approach on a simple sequence with only matched or unmatched bp.
Zuker, 1981
Zuker, Michael, and Patrick Stiegler. "Optimal computer folding of large RNA sequences using thermodynamics and auxiliary information." Nucleic acids research 9.1 (1981): 133-148.
The most cited paper in this space. Extends further than Nussinov, 1980 with a nearest neighbor approach to energies and a consideration of each of stack, bulge, internal loop, and hairpin. Their data structure and traceback method are both more intuitive than Nussinov, 1980.
Jaeger, 1989
Jaeger, John A., Douglas H. Turner, and Michael Zuker. "Improved predictions of secondary structures for RNA." Proceedings of the National Academy of Sciences 86.20 (1989): 7706-7710.
Zuker and colleagues expand on the 1981 paper to incorporate penalties for multibranched loops and dangling ends.
SantaLucia, 2004
SantaLucia Jr, John, and Donald Hicks. "The thermodynamics of DNA structural motifs." Annu. Rev. Biophys. Biomol. Struct. 33 (2004): 415-440.
The paper from which almost every DNA energy function in seqfold comes from (with the exception of multibranch loops). Provides neighbor entropies and enthalpies for stacks, mismatching stacks, terminal stacks, and dangling stacks. Ditto for bulges, internal loops, and hairpins.
Turner, 2009
Turner, Douglas H., and David H. Mathews. "NNDB: the nearest neighbor parameter database for predicting stability of nucleic acid secondary structure." Nucleic acids research 38.suppl_1 (2009): D280-D282.
Source of RNA nearest neighbor change in entropy and enthalpy parameter data. In /data.
Ward, 2017
Ward, M., Datta, A., Wise, M., & Mathews, D. H. (2017). Advanced multi-loop algorithms for RNA secondary structure prediction reveal that the simplest model is best. Nucleic acids research, 45(14), 8541-8550.
An investigation of energy functions for multibranch loops that validates the simple linear approach employed by Jaeger, 1989 that keeps runtime within O(n³).
Metadata
Release files for seqfold 0.10.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| seqfold-0.10.2.tar.gz | 51.3 kB | Without provenance | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| seqfold-0.10.2-cp38-abi3-win_arm64.whl | CPython 3.8 | abi3 | Windows ARM64 | Details |
| seqfold-0.10.2-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details |
| seqfold-0.10.2-cp38-abi3-musllinux_1_2_x86_64.whl | CPython 3.8 | abi3 | Linux musl 1.2+ x86-64 | Details |
| seqfold-0.10.2-cp38-abi3-musllinux_1_2_aarch64.whl | CPython 3.8 | abi3 | Linux musl 1.2+ ARM64 | Details |
| seqfold-0.10.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| seqfold-0.10.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| seqfold-0.10.2-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details |
| seqfold-0.10.2-cp38-abi3-macosx_10_12_x86_64.whl | CPython 3.8 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 3.2 MB
Release files / seqfold-0.10.2.tar.gz
| Download URL | seqfold-0.10.2.tar.gz |
|---|---|
| Size | 51.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45e090094ff240371301bde9926b781fcef6ce7e8a9da98df5580918a51b83af
|
|
BLAKE2b-256 checksum How to use checksums |
beac7bfbb77d14a1fa5e8fbce564b13e0f231b6e5ede2bc200cb190cd06af9fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / seqfold-0.10.2-cp38-abi3-win_arm64.whl
| Download URL | seqfold-0.10.2-cp38-abi3-win_arm64.whl |
|---|---|
| Size | 252.2 kB |
| Tags | CPython 3.8 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
a2475acf5021fb43d8192a6a88dca149f535c70ab0dffb51736effdc29e42d5d
|
|
BLAKE2b-256 checksum How to use checksums |
5f628be67e2e92082491048db99950dac994df6d061da3f374787f42214f9f96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / seqfold-0.10.2-cp38-abi3-win_amd64.whl
| Download URL | seqfold-0.10.2-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 263.3 kB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d8f075bd6738b6d82baa5bee61b3b45bc05ad5d37d2687d9bd40c54d175cf91b
|
|
BLAKE2b-256 checksum How to use checksums |
9774be81300c239e58b4f72cc2caa492a59e6eb02dc820b1165b39fadbe99086
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / seqfold-0.10.2-cp38-abi3-musllinux_1_2_x86_64.whl
| Download URL | seqfold-0.10.2-cp38-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 608.6 kB |
| Tags | CPython 3.8 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
33c310b4422a924b54bd52c48377557c5b8acf03b6411d813d145348480c2978
|
|
BLAKE2b-256 checksum How to use checksums |
bde48cbf54bd098345044c924470f83b563e054ea0e5b8c42b53e862ed43688c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / seqfold-0.10.2-cp38-abi3-musllinux_1_2_aarch64.whl
| Download URL | seqfold-0.10.2-cp38-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 569.2 kB |
| Tags | CPython 3.8 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5f6ac1d7e31859acf65d28cc9c67ab51c15fccd72c3622b12fd81b5cbd9e72ae
|
|
BLAKE2b-256 checksum How to use checksums |
4add0ac60cdd4928614068895d8cdaae66607c16f3ea25d186a25ccdfa4ac52c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / seqfold-0.10.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | seqfold-0.10.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 393.3 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b79f983eb459d3d14b90a74e362aaf020fcfaa97f4cf99aab8792ac4df174e76
|
|
BLAKE2b-256 checksum How to use checksums |
0e2c057e3533cbe8776f1d43c91b18c119a5cd789a50b0ab48e31bf7b38c0e86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / seqfold-0.10.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | seqfold-0.10.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 391.7 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
dcd7c59730f1ee6ae8ee81ada44fb79ee468689c2048802ae614a194db5f758d
|
|
BLAKE2b-256 checksum How to use checksums |
f9b4d6b43e9af53a9dd079e5cf5b0a7054e5245c1d66b73b9ec74bfac80cf3b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / seqfold-0.10.2-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | seqfold-0.10.2-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 358.4 kB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
7a8346fcff651d3b137086460e9bf274a30187c86812405328a2f94227b62802
|
|
BLAKE2b-256 checksum How to use checksums |
45d8cd3875a8a4c9e822ce298ddd41922cb954081bbcd0e32045511088efb7b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / seqfold-0.10.2-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | seqfold-0.10.2-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 358.9 kB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
72373175599728eaa6e50d6220310816270b6f1bcaaad04891a7d861d09e83dd
|
|
BLAKE2b-256 checksum How to use checksums |
9a82d159497d079f9014b9d086cbf5c2dd6337db3bc6002781ca26f86a85a275
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for seqfold 0.10.2
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.