Skip to content

CypST - CYP dataset curation, training, and MolBERT featurization

Cluster: XLence (UNIMI Dipartimento di Scienze Farmacologiche e Biomolecolari) Modules: cypst/1, cypst-molbert/1


Overview

Two environments for the cytochrome P450 substrate and inhibitor work. They are used one after the other and must never be loaded together.

cypst/1 is the working environment: it reads the published source tables, standardizes every SMILES string, decides what counts as the same molecule, and trains the model. cypst-molbert/1 does one thing only, and only because it has to: MolBERT is pinned to torch 1.4 and pytorch-lightning 0.8.4, which need Python 3.7, so turning a SMILES into a MolBERT vector happens in its own environment.

Why these are shared environments and not private conda installs: the canonical form of a molecule, and therefore the answer to "are these two rows the same compound", depends on the RDKit version. Measured on the substrate corpus of 220,217 rows, between RDKit 2025.03.6 (md/26) and RDKit 2026.09.1 (cypst/1): 93 input SMILES standardize differently, 79 of them to a different connectivity, which moves 1,322 rows and changes the assembled table by 16 molecules. Two people with two RDKit versions do not build the same dataset, and nothing in the output says so. Hence one environment, named in the report.


Software

cypst/1 - curation and training

Component Version Notes
Python 3.12.15
RDKit 2026.09.1 standardization, canonical SMILES, InChIKey
openpyxl 3.1.5 the journal supplementary spreadsheets
pandas / numpy / scipy 3.0.6 / 2.5.4 / 1.18.1
scikit-learn 1.9.1 baselines and metrics
torch 2.14.1, CUDA 13.4 tested on the RTX 2060 SUPER nodes
matplotlib / JupyterLab 3.11.2 / 4.6.4

cypst-molbert/1 - featurization only

Component Version Notes
Python 3.7.3 the last version torch 1.4 supports
torch 1.4.0 pinned by MolBERT
pytorch-lightning 0.8.4 pinned by MolBERT
transformers / tokenizers 3.5.1 / 0.9.3
sentencepiece 0.1.91
RDKit 2019.03.1 MolBERT's own featurizer only
scikit-learn / scipy 0.21.3 / 1.3.1
molbert 0.0.1 github.com/BenevolentAI/MolBERT @ b410cb6c

The RDKit in the legacy environment is from 2019 and must not be used to standardize molecules or to decide what is a duplicate: that is cypst/1's job. The legacy environment only converts an already standardized SMILES string into a vector.

The trained checkpoint (100 epochs, 1.0 GB, md5 fefc93e8c9dad3fe99437c78d4029cb1) is shared too, and MOLBERT_CHECKPOINT points at it once the module is loaded.


Loading

module load cypst
python src/assemble.py --task substrate --jobs 8
module load cypst-molbert
python -c "import os, molbert, torch; print(torch.__version__, os.environ['MOLBERT_CHECKPOINT'])"

Each module declares the other as a conflict, in both directions, so Lmod refuses the second one instead of silently shadowing a Python. Unload one before loading the other. Both also conflict with md, openff and miniforge3, which put their own Python first on PATH.

Both set PYTHONNOUSERSITE=1. Without it, a package installed with pip install --user in a home directory takes precedence over the one in the environment, which is exactly how two people run the same code with two different RDKit versions.


Paths

What Where
curation and training environment /sw/envs/cypst
legacy featurization environment /sw/envs/cypst-molbert
MolBERT checkpoint /sw/cypst/molbert_100epochs/checkpoints/last.ckpt
modulefiles /opt/modulefiles/cypst/1.lua, /opt/modulefiles/cypst-molbert/1.lua
build recipe and modulefile sources ~uliano.guerrini/cypst_module/

Rebuilding

cypst/1:

sudo env CONDA_PKGS_DIRS=/sw/pkgs /sw/miniforge3/20250911/bin/mamba create -y \
    -p /sw/envs/cypst -c conda-forge \
    python=3.12 rdkit pandas numpy scipy scikit-learn openpyxl matplotlib \
    tqdm pytest jupyterlab
sudo env CONDA_PKGS_DIRS=/sw/pkgs /sw/miniforge3/20250911/bin/mamba install -y \
    -p /sw/envs/cypst -c conda-forge pytorch-gpu

cypst-molbert/1, from the two frozen recipes in ~uliano.guerrini/cypst_module/:

sudo env CONDA_PKGS_DIRS=/sw/pkgs /sw/miniforge3/20250911/bin/mamba create -y \
    -p /sw/envs/cypst-molbert --file molbert-conda-explicit.txt
sudo /sw/envs/cypst-molbert/bin/pip install --no-cache-dir -r molbert-pip-requirements.txt

Two traps in that second one, both already handled in the files:

  1. molbert-pip-freeze.txt is the raw pip freeze and holds five entries written as name @ file:///home/conda/feedstock_root/..., which are the conda-built packages. pip stops with OSError on the first one. molbert-pip-requirements.txt is the same list with those five removed; they are installed by the conda step anyway.
  2. The MolBERT wheel does not ship its own data files, so the featurizer dies with FileNotFoundError: molbert/utils/data/elements.txt. Copy molbert/utils/data/{elements.txt,physchem_distributions.json} from a clone of the repository into the environment's lib/python3.7/site-packages/molbert/utils/data/.

Then, to match the other shared environments:

sudo chown -R root:interni /sw/envs/cypst /sw/envs/cypst-molbert /sw/cypst
sudo chmod -R go+rX        /sw/envs/cypst /sw/envs/cypst-molbert /sw/cypst

Verified on installation (18 October 2026)

  • cypst/1 reproduces the assembled substrate and inhibitor tables byte for byte (identical md5) against the reference environment.
  • torch.cuda.is_available() is true and a matmul runs on an RTX 2060 SUPER.
  • cypst-molbert/1 featurizes chloroform, paracetamol and ethanol to a (3, 768) matrix identical, to the bit, to the reference environment's.
  • Both modules load and run for a second user with no setup on their side.