This is a data repository associated with the manuscript titled "Enhancing Predictive Models for Solubility in Multi-Solvent Systems using Semi-Supervised Graph Neural Networks" by Hojin Jung‡, Christopher D. Stubbs‡, Sabari Kumar, Raúl Pérez-Soto, Su-min Song, Yeonjoon Kim, and Seonah Kim (‡Equal contribution).
This repository consists of:
- A novel small molecule solubility database (for solutes in 1-3 solvents)
- Code to train multicomponent solubility models (for solutes in 1-3 solvents)
- Code to perform semi-supervised distillation (for up to student 5 with thresholds of 0.3 and 1 / Here, we are providing a subset of COSMO-RS generated database. Contact us for the full data.)
To use the database and models in this repository, you will need a working installation of Python (v3.8-3.10) on your computer alongside the required packages (see "Packages Required"). All code was tested in Windows 10 64-bit and CentOS Stream 8, and so it should work on most modern operating systems. Please report any issues with using this code on GitHub.
- All model training requires a working Python environment, with GPU access and a CUDA setup ideal but not necessary (see "Packages Required" and "Using this Repository"). Getting CUDA and TensorFlow to work together on a GPU can be challenging, so the GNN model code falls back to a CPU if a GPU cannot be found.
- For all GNN models, descriptor generation is included as part of model training. Descriptors used can be changed in gnn_multisol.py (atom_features, bond_features, global_features functions). Note that changing the number of features will generally require changing the shapes specified in any preprocessor used.
- To train GNN models, first check whether your machine has CUDA and TensorFlow GPU support setup. This is often a machine-specific process, and depends on your graphics card, its supported CUDA versions, the CUDA versions installed, and the TensorFlow version installed (among other factors)
- GPU use is not required for GNN model training, but significant slowdowns may occur if a GPU is not used
- To train GNN models, use the following code snippets as an example (other options available by using the --help flag or checking source code).
- Subgraph Binary:
nohup python train_subgraph_binary.py -n "Example_BinarySubgraph" > Log_ExampleBinarySubgraph.txt & - Subgraph Ternary:
nohup python train_subgraph_ternary.py -n "Example_TernarySubgraph" > Log_Example_TernarySubgraph.txt & - Concat Binary:
nohup python train_concat_binary.py -n "Example_BinaryConcat" > Log_ExampleBinaryConcat.txt & - Concat Ternary:
nohup python train_concat_ternary.py -n "Example_TernaryConcat" > Log_Example_TernaryConcat.txt &
- Subgraph Binary:
- Trained GNN models will be saved in models/.../model_files. Each folder has the preprocessor used, the best model (best_model.h5), and the prediction results (kfold_#.csv)
The pretrained Student5_ShuffleSplit_Fold0_Threshold0.3 subgraph + SSD model is included in model_files/, together with its matching preprocessor.json, training parameters, and saved metrics.
Create the inference environment and run the example from the repository root:
conda env create -f environment.yml
conda activate multicompsol
python predict.py examples/prediction_input.csvThis writes examples/prediction_input_pred.csv. For your own systems:
python predict.py systems.csv --output systems_pred.csvThe output preserves input rows and columns and appends DGsolv_pred, the predicted solvation free energy in kcal/mol. Existing output files are never overwritten. No measured target values are needed.
Use one system per row, with these column names (the example includes all three solvent counts in one file):
can_smiles_solute,can_smiles_solvent1,can_smiles_solvent2,can_smiles_solvent3,mol_frac_solvent1,mol_frac_solvent2,mol_frac_solvent3,T_K
CCCO,O,,,1,,,298.15
CCCO,CO,O,,0.3,0.7,,323.15
CCCO,CO,CCO,O,0.2,0.3,0.5,298.15- Required columns:
can_smiles_solute,can_smiles_solvent1,mol_frac_solvent1, andT_K. - Add solvent 2 and 3 SMILES and mole fractions when needed. Unused optional slots or entire optional columns may be omitted; blank optional fractions mean zero.
- Fill active solvent slots consecutively, starting at solvent 1. Each positive fraction requires a valid SMILES string. SMILES are canonicalized internally.
- Fractions must lie between 0 and 1 and sum to 1 within
1e-6. Supply mole fractions directly; temperature must be positive and in kelvin. - The script fills unused model inputs with methane (
C) at zero mole fraction, preserving the SSD preprocessing convention. - Extra columns, such as system identifiers, are retained. To use another checkpoint with the same SSD input architecture, pass
--model-dir path/to/model_directory; it must contain bothbest_model.h5and its ownpreprocessor.json.
environment.yml pins the inference dependencies based on the Python 3.10 / TensorFlow 2.15 recipe. It is a reconstructed inference environment. Dependency pins and Student5 inference were tested with Python 3.10.22 on macOS ARM64 using the CPU.
All of the following were retrieved from PyPI, but should also be available on conda-forge. Most model development was done in Python 3.8.13, but should work fine for Python 3.8 - 3.10 (3.7 may also work, but hasn't been tested). Note that a few packages require specific version numbers (nfp, TensorFlow, pandas, RDKit). Other packages have their version specified for reproducibility, and it is recommended to use the versions specified when possible.
- matplotlib (v3.5.3)
- seaborn (v0.12.0)
- JupyterLab (v3.4.5)
- mordred (v1.2.0)
- RDKit (v2022.3.5)
- numpy (v1.23.2)
- scipy (v1.9.0)
- pandas (v1.4.3)
- scikit-learn (v1.1.2) (<1.3)
- tensorflow (v2.9.1)
- tensorflow-addons (v0.18.0)
- Keras (v2.9.0)
- nfp (v0.3.0 exactly)
Please report all issues or errors with code on GitHub wherever possible.