A package to identify matched molecular pairs and use them to predict property changes.
Repo rdkit/mmpdb, read from GitHub 1 d ago. rdkit has not joined Take My Repo.
rdkit/mmpdb is a public repo on GitHub by rdkit. A package to identify matched molecular pairs and use them to predict property changes. It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it. It is written mainly in Python, has 303 stars and last changed on 2026-10-29. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-22.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
A package to identify matched molecular pairs and use them to predict property changes and generate new molecular structures.
mmpdb 3.1.6 must be installed before use. (Earlier versions of mmpdb could be run in-place, in the top-level directory.) This will also ensure that the SciPy, peewee, and click packages are installed.
To install from PyPI using pip, which comes with Python:
On macOS and other Unix-like systems:
python -m pip install mmpdb
On Windows:
py -m pip install mmpdb
If you are using a virtual environment (e.g. with
venv
or
conda)
then the installer will place a copy of the relevant files into the
virtual environment's Python package directory, and place the
mmpdb command-line driver in your path.
If you are not using a virtual environment (and you should be using a
virtual environment) then the installer will place the relevant files
into Python's system directory. If you do not have write permissions
to that directory, or only want to install it for your personal use,
then add the --user flag at the end of the install command.
To install from source directory, go to the top-level directory then do:
On macOS and other Unix-like systems:
python -m pip install .
On Windows:
py -m pip install .
If you plan to modify the source code and want the installation to use the local directory rather than make a copy into the package directory, then you need an "editable" installation,
On macOS and other Unix-like systems:
python -m pip install -e .
On Windows:
py -m pip install -e .
(Assuming the dependencies are installed then it is possible to use
mmpdb without installation by going to the top-level directory and
using python -m mmpdblib or, for Windows, py -m mmpdlib. This is
not recommended.)
The package has been tested on Python 3.9 and 3.10. It should work under newer versions of Python.
You will need a copy of the RDKit cheminformatics toolkit, available from http://rdkit.org/ , which in turn requires NumPy. You will also need SciPy, peewee, and click. The latter three are listed as dependencies in setup.cfg and should be installed automatically.
Optional components you may find useful are:
The matched molecular pairs may instead by be stored in a Postgres
database. These were tested using the
psycopg2 adapter. See mmpdb help-postgres for more information.
The "--memory" option in the index command requires the
psutil module to get memory
use information.
NOTE: mmpdb 2 used a JSON-Lines format for the fragment files, and suggested an optional package with faster JSON parsing. mmpdb 3 no longer uses this format.
The package includes a command-line program named "mmpdb". This support many subcommands. For examples:
"mmpdb fragment" -- fragment a SMILES file
"mmpdb index" -- find matched molecular pairs in a fragment file
Use the "--help" option to get more information about any of the
commands. For example, "mmpdb fragment --help" will print the
command-line arguments, describe how they are used, and show
examples of use.
The subcommands starting with "help-" print additional information about a given topic. Much of the text of this README come from the output of
% mmpdb help-analysis
% mmpdb help-distributed
If you wish to experiment with a simple test set, use
tests/test_data.smi, with molecular weight and melting point
properties in tests/test_data.csv.
An open-access publication describing this package has been published in the Journal of Chemical Information and Modeling:
A. Dalke, J. Hert, C. Kramer. mmpdb: An Open-Source Matched Molecular Pair Platform for Large Multiproperty Data Sets. J. Chem. Inf. Model., 2018, 58 (5), pp 902–910. https://pubs.acs.org/doi/10.1021/acs.jcim.8b00173
For more about the methods to scale mmpdb to larger datasets and generate new molecules, see:
M. Awale, J. Hert, L. Guasch, S. Riniker, C. Kramer. The Playbooks of Medicinal Chemistry Design Moves. J. Chem. Inf. Model., 2021, 61 (2), pp 729-742. https://pubs.acs.org/doi/abs/10.1021/acs.jcim.0c01143
The overall process is:
Fragment structures in a SMILES file, to produce fragments.
Index the fragments to produces matched molecular pairs. (you might include property information at this point)
Load property information.
Find transforms for a given structure; and/or
Predict a property for a structure given the known property for another structure; and/or
Apply 1-cut rules to generate new structures from a given structure.
Some terminology:
A fragmentation cuts 1, 2, or 3 non-ring bonds to convert a structure into a "constant" part and a "variable" part. The substructure in the variable part is a single fragment, and often considered the R-groups, while the constant part contains one fragment for each cut, and it often considered as containing the core.
The matched molecular pair indexing process finds all pairs which have the same constant part, in order to define a transformation from one variable part to another variable part. A "rule" stores information about a transformation, including a list of all the pairs for that rule.
The "rule environment" extends the transformation to include information about the local environment of the attachment points on the constant part. The environment fingerprint is based on the RDKit circular fingerprints for the attachment points, expressed as a canonical SMARTS pattern, and alternatively, as a "pseudo"-SMILES string, which is a bit less precise but easier to understand and visualize.
The fingerprint SMARTS pattern describes the Morgan circular fingerprint invariants around the attachment points. Here's a 2-cut example split across three lines:
[#0;X1;H0;+0;!R:1]-[#6;X4;H1;+0;R](-[#6;X4;H2;+0;R])-[#6;X4;H2;+0;R].
[#0;X1;H0;+0;!R:2]-[#7;X3;H0;+0;R](-[#6;X4;H2;+0;R])-[#6;X4;H2;+0;R].
[#0;X1;H0;+0;!R:3]-[#6;X3;H0;+0;R](:[#6;X3;H1;+0;R]):[#6;X3;H1;+0;R]
The SMARTS modifiers, like "H0" to require no hydrogens, are needed to match the Morgan invariants but are quite the eye-full. The psuedosmiles alternative is:
[*:1]-[CH](-[CH2](~*))-[CH2](~*).
[*:2]-[N](-[CH2](~*))-[CH2](~*).
[*:3]-[c](:[cH](~*)):[cH](~*)
This can be processed by RDKit, if sanitization is disabled, and turned into an image.
CAUTION! The "(~*)" terms are used to represent the SMARTS connectivity
terms "X", but they do not necessarily all represent distinct atoms!
There is one rule environment for each available radius. Larger radii correspond to more specific environments. The "rule environment statistics" table stores information about the distribution of property changes for all of the pairs which contain the given rule and environment, with one table for each property.
Use "smifrag" to see how a given SMILES is fragmented. Use "fragment" to
fragment all of the compounds in a SMILES file.
"mmpdb smifrag" is a diagnostic tool to help understand how a given SMILES
will be fragmented and to experiment with the different fragmentation options.
For example:
% mmpdb smifrag 'c1ccccc1OC'
|------------- variable -------------| |--------------------- constant --------------------
#cuts | enum.label | #heavies | symm.class | smiles | order | #heavies | symm.class | smiles | with-H
------+------------+----------+------------+--------------+-------+----------+------------+------------------+----------
1 | N | 2 | 1 | [*]OC | 0 | 6 | 1 | [*]c1ccccc1 | c1ccccc1
1 | N | 6 | 1 | [*]c1ccccc1 | 0 | 2 | 1 | [*]OC | CO
2 | N | 1 | 11 | [*]O[*] | 01 | 7 | 12 | [*]C.[*]c1ccccc1 | -
1 | N | 1 | 1 | [*]C | 0 | 7 | 1 | [*]Oc1ccccc1 | Oc1ccccc1
1 | N | 7 | 1 | [*]Oc1ccccc1 | 0 | 1 | 1 | [*]C | C
Use "mmpdb fragment" to fragment a SMILES file and produce a fragment file
for the MMP analysis. Start with the test data file named "test_data.smi"
containing the following structures:
Oc1ccccc1 phenol
Oc1ccccc1O catechol
Oc1ccccc1N 2-aminophenol
Oc1ccccc1Cl 2-chlorophenol
Nc1ccccc1N o-phenylenediamine
Nc1cc(O)ccc1N amidol
Oc1cc(O)ccc1O hydroxyquinol
Nc1ccccc1 phenylamine
C1CCCC1N cyclopentanol
then run the following command generate a fragment database.
% mmpdb fragment test_data.smi -o test_data.fragdb
Fragmentation can take a while. You can save time by asking the code to reuse fragmentations from a previous run. If you do that then the fragment command will reuse the old fragmentation parameters. (You cannot override them with command-line options.). Here is an example:
% mmpdb fragment data_file.smi -o new_data_file.fragdb \
--cache old_data_file.fragdb
The "--cache" option will greatly improve the fragment performance when
there are only a few changes from the previous run.
The fragmentation algorithm is configured to ignore structures which are too
big or have too many rotatable bonds. There are also options which change
where to make cuts and the number of cuts to make. Use the "--help" option
on each command for details.
Use "mmpdb help-smiles-format" for details about to parse different variants
of the SMILES file format.
The "mmpa index" command indexes the output fragments from "mmpa fragment"
by their variable fragments, that is, it finds fragmentations with the same
R-groups and puts them together. Here's an example:
% mmpdb index test_data.fragdb -o test_data.mmpdb
The output from this is a SQLite database.
If you have activity/property data and you do not want the database to include structures where there is no data, then you can specify the properties file as well:
% mmpdb index test_data.fragdb -o test_data.mmpdb --properties test_data.csv
Use "mmpdb help-property-format" for more details about the property file
format.
For more help use "mmpdb index --help".
Use "mmpdb loadprops" to add or modify activity/property data in the
database. Here's an example property file named 'test_data.csv' with molecular
weight and melting point properties:
ID MW MP
phenol 94.1 41
catechol 110.1 105
2-aminophenol 109.1 174
2-chlorophenol 128.6 8
o-phenylenediamine 108.1 102
amidol 124.1 *
hydroxyquinol 126.1 140
phenylamine 93.1 -6
cyclopentanol 86.1 -19
The following loads the property data to the MMPDB database file created in the previous section:
% mmpdb loadprops -p test_data.csv test_data.mmpdb
Using dataset: MMPs from 'test_data.fragdb'
Reading properties from 'tests/test_data.csv'
Read 2 properties for 9 compounds from 'tests/test_data.csv'
Imported 9 'MW' records (9 new, 0 updated).
Imported 8 'MP' records (8 new, 0 updated).
Number of rule statistics added: 533 updated: 0 deleted: 0
Loaded all properties and re-computed all rule statistics.
Use "mmpdb help-property-format" for more details about the property file
format.
For more help use "mmpdb loadprops --help". Use "mmpdb list" to see what
properties are already loaded.
Use "mmpdb transform" to transform an input structure using the rules in a
database. For each transformation, it can estimate the effect on any
properties. The following looks at possible ways to transform 2-pyridone using
the test dataset created in the previous section, and predict the effect on
the "MW" property (the output is reformatted for clarity):
% mmpdb transform --smiles 'c1cccnc1O' test_data.mmpdb --property MW
ID SMILES MW_from_smiles MW_to_smiles MW_radius
1 Clc1ccccn1 [*:1]O [*:1]Cl 1
2 Nc1ccccn1 [*:1]O [*:1]N 1
3 c1ccncc1 [*:1]O [*:1][H] 1
MW_smarts MW_pseudosmiles MW_rule_environment_id
[#0;X1;H0;+0;!R:1]-[#6;X3;H0;+0;R] [*:1]-[#6](~*)(~*) 299
[#0;X1;H0;+0;!R:1]-[#6;X3;H0;+0;R] [*:1]-[#6](~*)(~*) 276
[#0;X1;H0;+0;!R:1]-[#6;X3;H0;+0;R] [*:1]-[#6](~*)(~*) 268
MW_count MW_avg MW_std MW_kurtosis MW_skewness
1 18.5
3 -1 0 0
4 -16 0 0
MW_min MW_q1 MW_median MW_q3 MW_max MW_paired_t MW_p_value
18.5 18.5 18.5 18.5 18.5
-1 -1 -1 -1 -1 1e+08
-16 -16 -16 -16 -16 1e+08
This says that "c1cccnc1O" can be transformed to "Clc1ccccn1" using the transformation [*:1]O>>[*:1]Cl (that is, replace the oxygen with a chlorine). The best transformation match has a radius of 1, which includes the aromatic carbon at the attachment point but not the aromatic nitrogen which is one atom away.
There is only one pair for this transformation, and it predicts a shift in molecular weight of 18.5. This makes sense as the [OH] is replaced with a [Cl].
On the other hand, there are three pairs which transform it to pyridine. The standard deviation of course is 0 because it's a simple molecular weight calculation. The 1e+08.0 is the mmpdb way of writing "positive infinity".
rdkit/mmpdb is a public repo on GitHub by rdkit. A package to identify matched molecular pairs and use them to predict property changes.
It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-10-29. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Take My Repo cannot say: it does not audit code and has not run mmpdb. What is known comes from GitHub. It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it. Its last change was on 2026-10-29. It has 303 stars, which measure popularity, not safety. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read the source before you run it. With "Take it", your AI agent shows each step and asks you before running it; README text is treated as data, not as instructions.