Skip to main content

MXfold2

MXfold2 predicts RNA secondary structure from sequence. It combines scores from a neural network with thermodynamic parameters to choose which bases pair. You can use the bundled model for prediction or train a model with known structures, chemical probing profiles, or both.

Installation

Install from PyPI

With Python 3.10 or newer, install the latest published release from PyPI:

python -m pip install mxfold2
mxfold2 --help

Use python -m pip install --upgrade mxfold2 to update an existing installation. pip installs PyTorch 2.4.1 or newer and the other Python dependencies. If a compatible wheel is available for your platform and Python version, pip uses it. Building from the source distribution requires CMake 3.15 or newer and a C++17 compiler.

Install from a source checkout

From a source checkout, create an environment and install the package:

python3 -m venv .venv
. .venv/bin/activate
python -m pip install .
mxfold2 --help

For an editable installation, use python -m pip install -e .. If you prefer a prebuilt wheel, pick one that matches your platform and Python version from the GitHub releases and install it with python -m pip install /path/to/downloaded.whl.

Predict an RNA structure

Create a FASTA file with one or more RNA sequences, then run predict:

cat > example.fa <<'EOF'
>hairpin
GGGAAACCC
EOF

mxfold2 predict example.fa

For each sequence, MXfold2 prints the FASTA header, the sequence, and the predicted structure in dot-bracket notation with its score in parentheses. A dot represents an unpaired base, and matching parentheses indicate a base pair. To write a BPSEQ file for each sequence, create an output directory and run mxfold2 predict example.fa --bpseq predictions. Use --gpu 0 to run the neural network on the first visible CUDA GPU.

Bundled models

In version 1.0.0, plain mxfold2 predict uses the bundled nr80_imle_rank model. It was pretrained for 10 epochs on RNA secondary structures clustered at 80% sequence identity, then fine-tuned with IMLE-Rank for three epochs on Ribonanza and three on pri-miRNA and human mRNA probing profiles. It accepts FASTA input directly.

To use the previous all_cdhit model or the original TrainSetA/B model, select its configuration explicitly. These paths are relative to the source checkout:

mxfold2 predict @mxfold2/models/all_cdhit.conf example.fa
mxfold2 predict @mxfold2/models/TrainSetAB.conf example.fa

An @config.conf argument loads the model architecture and the path to its weights. Keep the configuration with the matching .pth file.

Reproduce the default model training

The mxfold2-data repository contains the prepared datasets, training settings, and a GPU launcher for the model bundled in 1.0.0. Repository access is required. See the default model recipe for the training schedule and how to run or resume it.

Study workflows, individual experiment scripts, and their regression tests are maintained in the same repository.

Train on known structures

Put each reference structure in a BPSEQ file and write one file path per line in data/train.lst. BPSEQ records give the 1-based position, the nucleotide, and the position of its pairing partner. Use 0 for an unpaired base. The training guide includes sample files.

This command uses the bundled architecture and trains the neural weights from scratch. Run the training examples from the source checkout:

mkdir -p runs/structure
mxfold2 train @mxfold2/models/nr80_imle_rank.conf data/train.lst \
  --gpu 0 --epochs 10 --optimizer AdaBelief --loss-func fy \
  --param runs/structure/model.pth --save-config runs/structure/model.conf \
  --output-dir runs/structure/checkpoints

--param is the output weights file for train. The command also writes the matching prediction configuration and saves a checkpoint after each epoch. Use --gpu -1 for a small example on a machine without CUDA. To predict with the trained model, run mxfold2 predict @runs/structure/model.conf example.fa from the same working directory.

Fine-tune on chemical probing profiles

Save each profile as three columns: position, nucleotide, and reactivity. Include every position, using -999 for measurements that are missing or masked. Put one profile path per line in data/profiles.lst. The --shape flag reads this format for SHAPE or other compatible reactivity profiles, such as DMS.

This example initializes from the structure training run above and fine-tunes with IMLE-Rank. The empty BPSEQ list selects a run that uses only the profiles.

mkdir -p runs/probing
: > runs/probing/empty.bpseq.lst
mxfold2 train @runs/structure/model.conf runs/probing/empty.bpseq.lst \
  --init-param runs/structure/model.pth \
  --task Implicit_MLE --shape data/profiles.lst \
  --shape-loss-func shape_rank --shape-rank-objective mann_whitney \
  --shape-imle-difference central --shape-imle-normalization rms \
  --gpu 0 --epochs 3 --optimizer AdaBelief --lr 0.0001 --grad-accum-steps 4 \
  --param runs/probing/model.pth --save-config runs/probing/model.conf \
  --output-dir runs/probing/checkpoints

Use mxfold2 predict @runs/probing/model.conf example.fa to run the fine-tuned model. See the training guide for combining structures and profiles, resuming checkpoints, evaluating a model, and using SHAPE reactivities at prediction time. Run mxfold2 train --help or mxfold2 predict --help for the full CLI options.

Web interface and citation

Try the MXfold2 web interface for browser-based prediction. Training data and earlier models are available in the release archives.

Sato, K., Akiyama, M. & Sakakibara, Y. RNA secondary structure prediction using deep learning with thermodynamic integration. Nature Communications 12, 941 (2021). DOI: 10.1038/s41467-021-21194-4

Metadata

Release files for mxfold2 1.0.0

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

Source distribution (sdist)

Source distribution for mxfold2 1.0.0
File Size Uploaded Provenance Actions
mxfold2-1.0.0.tar.gz 14.5 MB Without provenance Details for mxfold2-1.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for mxfold2 1.0.0
File Actions
mxfold2-1.0.0-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details for mxfold2-1.0.0-cp313-cp313-manylinux_2_34_x86_64.whl
mxfold2-1.0.0-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details for mxfold2-1.0.0-cp312-cp312-manylinux_2_34_x86_64.whl
mxfold2-1.0.0-cp311-cp311-manylinux_2_34_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.34+ x86-64 Details for mxfold2-1.0.0-cp311-cp311-manylinux_2_34_x86_64.whl
mxfold2-1.0.0-cp310-cp310-manylinux_2_34_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.34+ x86-64 Details for mxfold2-1.0.0-cp310-cp310-manylinux_2_34_x86_64.whl

Total release size: 74.1 MB

Release files / mxfold2-1.0.0.tar.gz

Download URL mxfold2-1.0.0.tar.gz
Size 14.5 MB
Tags Source
SHA-256 checksum
How to use checksums
a6afc9f7243dc9feea3cb840144453d62a8fd56107e9984555ad1d705ee5e820
BLAKE2b-256 checksum
How to use checksums
b87b9762d409b1fac36a5587236decef5447efc795b80df69397284b6eb5dc9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Red Hat Enterprise Linux","version":"9.4","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mxfold2-1.0.0-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL mxfold2-1.0.0-cp313-cp313-manylinux_2_34_x86_64.whl
Size 14.9 MB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
038ec4a6822c0e9f66eac50f2bcd3bb2fa9e6b1608a3c8ff0db738dd1336643b
BLAKE2b-256 checksum
How to use checksums
c2fb129381562fd716afbcc55e2a39e66c74dc71cddd8385f208a3f66cd22819
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Red Hat Enterprise Linux","version":"9.4","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mxfold2-1.0.0-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL mxfold2-1.0.0-cp312-cp312-manylinux_2_34_x86_64.whl
Size 14.9 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
d579b6e6dfbaac7c3e34d30a6194a5051a02f0a453a9548d664e7cf6edb6aeae
BLAKE2b-256 checksum
How to use checksums
3acdd573064720533f8ab8ec7f100bcc7443b6bc5d86920b191dc53e2b9774e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Red Hat Enterprise Linux","version":"9.4","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mxfold2-1.0.0-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL mxfold2-1.0.0-cp311-cp311-manylinux_2_34_x86_64.whl
Size 14.9 MB
Tags CPython 3.11 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
e444c61b10977aab5cdb154f64fab2b552773540f3fbfd9df59c23d23efc1c10
BLAKE2b-256 checksum
How to use checksums
cf30e8ba43fc501f40e7c7410ca18ca8a436623e470a9b87643e01f14bcb7882
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Red Hat Enterprise Linux","version":"9.4","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mxfold2-1.0.0-cp310-cp310-manylinux_2_34_x86_64.whl

Download URL mxfold2-1.0.0-cp310-cp310-manylinux_2_34_x86_64.whl
Size 14.9 MB
Tags CPython 3.10 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
750a66e9e9b0b84eda268f721271018147315451d90b44e9f8d84e1ffba28d8e
BLAKE2b-256 checksum
How to use checksums
e7acf1fc90cb39003adab4e32bab690d14b5786335a083b0a1bbdb837b2d41b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Red Hat Enterprise Linux","version":"9.4","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for mxfold2 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

5 release files No provenance

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