Mimosa
Mimosa is a Python package and command-line tool for DNA motif comparison. It supports PWM/PFM, BaMM, Dimont, Slim, and precomputed score profiles. Mimosa compares heterogeneous motif models through their behavior on the same DNA sequences rather than by forcing their internal representations into a common matrix.
Background
Transcription factors (TFs) are key regulators of gene expression. They bind specific DNA sequences, termed transcription factor binding sites (TFBSs), located in gene regulatory regions. Because TFBSs are highly variable, they are typically described using motifs, which capture the nucleotide preferences of a TF across a range of binding sites. The position weight matrix (PWM) is the de facto standard motif model, assuming independence between positions and additive nucleotide contributions. However, numerous studies have demonstrated the presence of dependencies between positions within TFBSs. To account for such dependencies, alternative models have been proposed, including Markov-based approaches (BaMM, InMoDe, Dimont, Slim, MODER2) and deep learning models (DeepBind, DeepGRN, BERT-TFBS). However, a mature ecosystem of databases and tools has been developed primarily for PWMs, including motif comparison methods that are critical for result interpretation. Comparison of alternative motif models usually requires their conversion into PWMs, which inevitably leads to loss of information about positional dependencies. At present, no universal tool exists for their direct comparison. Mimosa (Model-Independent Motif Similarity Assessment) addresses this gap by evaluating motif similarity based on functional behavior, namely the scores models assign to DNA sequences rather than their internal parameters.
Mimosa uses the following profile comparison pipeline:
- Scan the same DNA sequences with each model to obtain score profiles.
- Normalize the scores to make different models comparable.
- Identify positions with high scores in either profile.
- Calculate weighted Jaccard similarity across profile alignments and strand orientations.
- Return the best alignment and its similarity score.
See Method and Statistics for the metric definition, statistical significance, and references.
Supported Models
| Model | Source formats | CLI type |
|---|---|---|
| PWM/PFM | MEME, plain PFM, model bundle | pwm |
| BaMM | .ihbcp, model bundle |
bamm |
| Dimont | Jstacs XML, model bundle | dimont |
| Slim | Jstacs XML, model bundle | slim |
| Score profile | FASTA-like numeric rows | scores |
Installation
Mimosa supports Python 3.12 and 3.13. The package is published on
PyPI as mimosa-tool.
python -m pip install mimosa-tool
To install from source with uv, run from the repository root:
uv sync --locked --group dev
uv run mimosa --version
Alternatively, install this checkout with python -m pip install ..
Paths under examples/ below refer to files in the repository, not files
installed beside the CLI. With the uv environment, prefix CLI commands with
uv run.
Mimosa uses JAX for computation. The default installation supports CPU. GPU plugins are optional: an installer cannot reliably select one from the target hardware, driver and system libraries, which may differ from the installation machine.
For an NVIDIA GPU on supported Linux systems, choose one CUDA extra:
python -m pip install 'mimosa-tool[cuda13]'
# Or, for CUDA 12:
python -m pip install 'mimosa-tool[cuda12]'
These extras install the matching JAX plugin and CUDA libraries; a compatible
NVIDIA driver must already be installed. Check GPU, driver and platform support
in the JAX installation guide.
For a source checkout use uv sync --locked --group dev --extra cuda13 (or
cuda12) and include the same --extra cuda13 in subsequent uv run
commands, for example uv run --extra cuda13 mimosa --version. Do not select
both CUDA extras in one environment.
For an AMD GPU on supported Linux systems with system ROCm 7, install the ROCm extra:
python -m pip install 'mimosa-tool[rocm]'
For a source checkout, use uv sync --locked --group dev --extra rocm, then
include --extra rocm in subsequent uv run commands. This installs the JAX
ROCm 7 plugin and PJRT, but not the ROCm system libraries or GPU driver.
Install a compatible ROCm version and driver first, and check your GPU and
platform against AMD's JAX installation guide
and compatibility matrix.
The project pins JAX 0.10.0. Its AMD extra is rocm7-local.
For a ROCm runtime installed alongside Mimosa, choose one of these commands. Each installs the runtime, JAX plugin and kernels for all supported GPU targets in the tool's own environment.
# ROCm 7.14.1
uv tool install 'mimosa-tool[rocm7]' --index https://repo.amd.com/rocm/whl-multi-arch/
# ROCm 10.0.0
uv tool install 'mimosa-tool[rocm10]' --index https://stable.repo.amd.com/rocm/whl-next/
The rocm7 and rocm10 extras target Linux x86-64 and require a compatible
AMD driver. With pip, use python -m pip install 'mimosa-tool[rocm7]' or
'mimosa-tool[rocm10]' and pass the matching AMD URL as --extra-index-url.
For the source checkout, use uv sync --locked --group dev --extra rocm7
or --extra rocm10, and pass the same extra to subsequent uv run commands.
Select a single GPU extra per environment.
GitHub Actions checks wheel dependency resolution for cuda12, cuda13,
rocm7, and rocm10. To test GPU execution, run GPU smoke test from
the default branch and select an extra. Use a Linux x86-64 self-hosted runner
labelled amd-gpu for ROCm or nvidia-gpu for CUDA. To use a GitHub-hosted
Linux GPU larger runner for CUDA, set the repository Actions variable
CUDA_GPU_RUNNER to that runner's name.
JAX selects the compute device automatically. Inspect the selected backend and its available devices in the same environment used to run Mimosa:
python -c "import jax; print(jax.default_backend(), jax.devices())"
For the uv checkout, use uv run --extra rocm python -c 'import jax; print(jax.default_backend(), jax.devices())'
(or the selected CUDA extra). To require a GPU instead of silently using CPU, run
with JAX_PLATFORMS=gpu; JAX will report an error if it cannot initialize one.
CLI
Compare two PWM models on generated sequences with the default settings:
mimosa compare examples/foxa2.meme examples/gata2.meme \
--query-type pwm --target-type pwm
Compare them on a FASTA batch:
mimosa compare examples/foxa2.meme examples/gata2.meme \
--query-type pwm --target-type pwm \
--fasta examples/foreground.fa --min-logerr 2
Compare precomputed score profiles:
mimosa compare examples/scores_1.fasta examples/scores_2.fasta \
--query-type scores --target-type scores --min-logerr 2
Compare one query against multiple targets:
mimosa compare-many examples/foxa2.meme examples/gata2.meme examples/gata4.meme \
--query-type pwm --target-type pwm --fasta examples/foreground.fa \
--min-logerr 2
Compute pair-specific Monte Carlo significance:
mimosa compare examples/foxa2.meme examples/gata2.meme \
--query-type pwm --target-type pwm \
--fasta examples/foreground.fa --background examples/background.fa \
--min-logerr 2 \
--pvalue --mc-replicates 2000 --mc-stop-after-exceedances 20 --mc-seed 127
Monte Carlo randomizes the query while keeping targets fixed and requires
motif models. Here each pair stops after 20 randomized scores meet or exceed
its observed score, or after 2000 simulations. The JSON field
monte_carlo.replicates reports how many simulations were used for each pair.
Omit --mc-stop-after-exceedances to use a fixed number of simulations.
In Python, use direct_mc(..., stop_after_exceedances=20, return_replicates=True)
with the usual k and seed arguments.
See Method and statistics for the p-value formula and
how to choose the simulation budget.
Manage the optional prepared-profile cache:
mimosa cache clear --cache-dir .mimosa-cache
Successful compare results are one JSON object; compare-many results are an
ordered JSON array on stdout. Diagnostics and errors are
written to stderr. Run mimosa --help to list commands.
Command-specific options are listed by mimosa compare --help,
mimosa compare-many --help, and mimosa cache --help. In particular:
--fastasupplies the shared comparison sequences.--backgroundsupplies separate sequences for score calibration; without it, calibration uses the comparison sequences.--background-freqis the per-base frequency used for PFM-to-PWM conversion (uniform0.25), not a sequence-generation or calibration-file option.--cache-direnables persistent normalized-profile caching across runs; caching is disabled if omitted.
Python API
from mimosa import compare, read_fasta, read_model
query = read_model("examples/foxa2.meme")
target = read_model("examples/gata2.meme")
sequences, names = read_fasta("examples/foreground.fa")
result = compare(query, target, sequences, min_logerr=2.0)
print(result.to_dict())
Compare one query against multiple targets:
from mimosa import compare_many
targets = [target, read_model("examples/gata4.meme")]
results = compare_many(query, targets, sequences, min_logerr=2.0)
The quickstart and API reference cover profile reuse, site selection, PFM reconstruction, and Monte Carlo. See custom models to integrate another scorer.
Documentation
- Python Documentation
- Python Quickstart
- Python API
- CLI Reference
- Supported Models and Formats
- Comparison Method and Statistics
- Custom Models and Readers
- Storage and Cache
- Data Layout and Coordinates
- Migrating to JAX
Development
Run the code checks, tests, and example commands:
uv run ruff check .
uv run pytest -q tests
uv run bash examples/run.sh
Run the production-path performance benchmark with:
uv run python benchmarks/benchmark_performance.py --output /tmp/mimosa-performance.json
The default run uses 10 000 sequences, 1/64/128/256 targets and three repeats; it can require substantial memory and temporary disk space. For a smaller check:
uv run python benchmarks/benchmark_performance.py \
--sequence-count 100 --target-counts 1 --repeats 1 --min-logerr 2 \
--output /tmp/mimosa-performance-small.json
Run the benchmark with --help for detailed options. Report the selected JAX
device and distinguish compilation time from warmed execution when sharing
performance measurements.
License
MIT. See LICENSE.
Metadata
Release files for mimosa-tool 2.0.5
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 | Actions |
|---|---|---|---|---|
| mimosa_tool-2.0.5.tar.gz | 1.1 MB | Without provenance | Details for mimosa_tool-2.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mimosa_tool-2.0.5-py3-none-any.whl | Python 3 | none | any | Details for mimosa_tool-2.0.5-py3-none-any.whl |
Total release size: 1.1 MB
Release files / mimosa_tool-2.0.5.tar.gz
| Download URL | mimosa_tool-2.0.5.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c55c0ce87c40ca8bef66d41d79e45fe9aef767d41e1523d056eb0628e162d56
|
|
BLAKE2b-256 checksum How to use checksums |
a62285877cb7883c26f5780810e4ea1d6f0b93e4be60f83f789f6f5ec91c42b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / mimosa_tool-2.0.5-py3-none-any.whl
| Download URL | mimosa_tool-2.0.5-py3-none-any.whl |
|---|---|
| Size | 71.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
761b9bf84f6f6ad1ba26b1b65fd9c252124eedd3416b4809cfc035738178a8cc
|
|
BLAKE2b-256 checksum How to use checksums |
97dc578febad94fedaca30de815d724f26d86768a31433533bc0362bb6e0fcaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for mimosa-tool 2.0.5
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.