Mimosa
Mimosa is a Python 3.12+ package and command-line tool for DNA motif comparison. It supports PWM/PFM, BaMM, SiteGA, 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), discriminative methods (SiteGA), 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 sequences by motifs to obtain score profiles.
- Convert raw scores to empirical
-log10(ERR)values, where ERR is the expectation recognition rate, optionally using a separate background sequence set for calibration. - Select one strict best anchor per non-empty sequence when
min_logerr <= 0, or all anchors with-log10(ERR) >= min_logerrfor a positive threshold. - Compare site-centered windows over shifts and the four strand orientations.
- Return the highest-scoring alignment, its offset, orientation, and number of contributing sites.
See Method and Statistics for metric definitions, statistical significance, and references.
Supported Models
| Model | Source formats | CLI type |
|---|---|---|
| PWM/PFM | MEME, plain PFM, model bundle | pwm |
| BaMM | .ihbcp, model bundle |
bamm |
| SiteGA | .mat, model bundle |
sitega |
| Dimont | Jstacs XML, model bundle | dimont |
| Slim | Jstacs XML, model bundle | slim |
| Score profile | FASTA-like numeric rows | scores |
Installation
Mimosa requires Python 3.12 or newer. It is published on
PyPI as mimosa-tool.
python -m pip install mimosa-tool
For development from a source checkout:
uv sync
CLI
Compare two PWM models on a FASTA batch:
mimosa profile examples/foxa2.meme examples/gata2.meme \
--model1-type pwm --model2-type pwm \
--fasta examples/foreground.fa --metric co
Compare precomputed score profiles:
mimosa profile examples/scores_1.fasta examples/scores_2.fasta \
--model1-type scores --model2-type scores --metric cosine
Build and use an empirical null distribution:
mimosa build-null examples/ \
--model-type pwm --output output/null_bundle \
--fasta examples/foreground.fa --num-samples 2000 --seed 127
mimosa profile examples/foxa2.meme examples/gata2.meme \
--model1-type pwm --model2-type pwm \
--fasta examples/foreground.fa \
--pvalue --null-distribution output/null_bundle
Manage the optional prepared-profile cache:
mimosa cache clear --cache-dir .mimosa-cache
Successful profile results are JSON on stdout. Diagnostics and errors are
written to stderr. Run mimosa --help for the complete CLI reference.
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, metric="co")
print(result.to_dict())
For repeated comparisons, prepare the query once:
from mimosa import compare_many, prepare_profile
prepared = prepare_profile(query, sequences)
results = compare_many(prepared, [target], sequences, metric="cosine")
The public API also includes scan, read_scores, select_sites,
reconstruct_pfm, build_null, annotate_results, and write_model.
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
Development
Run the test suite with:
uv run pytest -q
License
MIT. See LICENSE.
Metadata
Release files for mimosa-tool 1.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mimosa_tool-1.4.1.tar.gz | 47.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mimosa_tool-1.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 104.1 kB
Release files / mimosa_tool-1.4.1.tar.gz
| Download URL | mimosa_tool-1.4.1.tar.gz |
|---|---|
| Size | 47.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af4a666cf3a01fbc42e3bc64cfa32cccde6e3e6fba81f220a351ae2e20eabc74
|
|
BLAKE2b-256 checksum How to use checksums |
f036dd13d6801d0bd76560aabbb61f011fc4799578f5709a23358ef52621cd44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","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 / mimosa_tool-1.4.1-py3-none-any.whl
| Download URL | mimosa_tool-1.4.1-py3-none-any.whl |
|---|---|
| Size | 56.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e45c8ef3de08301824837987f3fa4b318e92ee1f4c4740796cbd925306330fa2
|
|
BLAKE2b-256 checksum How to use checksums |
4257e8b892e38b1ff84dbb035e65a6e35876844425587b5294bc38487c937795
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","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}
|