Validate
Validate REINVENT4 input SMILES files and TOML configs before launching jobs. Use when the user wants to check, validate, or verify their inputs.From its SKILL.md
npx -y skills add pregHosh/Solitarius-mcp --skill validateAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
5.3 KB, as published. Nobody here has run it
REINVENT4 Input Validation
Validate SMILES files and TOML configs using Python/RDKit directly.
No MCP server needed — requires RDKit and the toml package.
Workflow
1. Resolve paths
readlink -f <relative_path>
2. Detect file type
From $ARGUMENTS:
.smi,.csv,.smiles→ SMILES validation (Step 3a).toml→ TOML config validation (Step 3b)- If ambiguous, ask the user
3a. SMILES validation
Run this Python snippet (adapt the path and generator):
from rdkit import Chem
from collections import Counter
path = "/absolute/path/to/file.smi" # or .csv
generator = "reinvent" # reinvent | libinvent | linkinvent | mol2mol
smiles_list = []
with open(path) as f:
for line in f:
tok = line.strip().split()
if tok:
smiles_list.append(tok[0])
errors, dupes = [], Counter()
valid = []
for i, smi in enumerate(smiles_list, 1):
mol = Chem.MolFromSmiles(smi)
if mol is None:
errors.append((i, smi, "invalid SMILES"))
continue
can = Chem.MolToSmiles(mol)
# Generator-specific checks
if generator == "libinvent" and "[*:0]" not in smi:
errors.append((i, smi, "missing [*:0] attachment point"))
continue
if generator == "linkinvent" and "|" not in smi:
errors.append((i, smi, "linkinvent requires two fragments separated by |"))
continue
valid.append(can)
dupes[can] += 1
dup_count = sum(v - 1 for v in dupes.values() if v > 1)
print(f"Total: {len(smiles_list)}, Valid: {len(valid)}, Invalid: {len(errors)}, Duplicates: {dup_count}")
for idx, smi, reason in errors[:10]:
print(f" Line {idx}: {smi!r} — {reason}")
Report all findings. If invalid entries or duplicates exist, offer to write a cleaned file:
seen = set()
cleaned = []
for smi in smiles_list:
mol = Chem.MolFromSmiles(smi)
if mol is None:
continue
can = Chem.MolToSmiles(mol)
if can not in seen:
seen.add(can)
cleaned.append(can)
out_path = path.replace(".smi", "_cleaned.smi")
with open(out_path, "w") as f:
f.write("\n".join(cleaned) + "\n")
print(f"Wrote {len(cleaned)} molecules to {out_path}")
3b. TOML config validation
Primary: Pydantic validation via REINVENT's own config model (preferred, catches schema errors):
import sys, tempfile, pathlib
toml_path = "/absolute/path/to/config.toml"
try:
from reinvent.runmodes.constructors.reinvent_config import ReinventConfig
import tomllib
with open(toml_path, "rb") as f:
raw = tomllib.load(f)
cfg = ReinventConfig(**raw)
print("Pydantic validation PASSED")
except ImportError:
print("ReinventConfig not importable — falling back to manual checks")
except Exception as e:
print(f"Pydantic validation FAILED: {e}")
Fallback: manual field checks (if REINVENT not importable in current env):
import toml, sys
path = "/absolute/path/to/config.toml"
try:
cfg = toml.load(path)
except toml.TomlDecodeError as e:
print(f"TOML parse error: {e}")
sys.exit(1)
run_type = cfg.get("run_type")
valid_types = {"sampling", "transfer_learning", "staged_learning"}
if run_type not in valid_types:
print(f"ERROR: run_type={run_type!r}, expected one of {valid_types}")
else:
print(f"OK: run_type={run_type}, device={cfg.get('device', 'not set')}")
params = cfg.get("parameters", {})
required = {
"sampling": ["model_file", "output_file"],
"transfer_learning": ["input_model_file", "smiles_file", "output_model_file"],
"staged_learning": ["prior_file", "agent_file", "summary_csv_prefix"],
}
for field in required.get(run_type, []):
if field not in params:
print(f"WARNING: missing parameters.{field}")
Common errors and fixes:
| Error | Likely cause | Fix |
|---|---|---|
run_type not recognised | Typo or wrong value | Must be sampling, transfer_learning, or staged_learning |
model_file / prior_file not found | Relative path passed | Always use absolute paths (readlink -f) |
output_file missing for sampling | Key omitted | Add output_file = "/abs/workdir/sampling.csv" under [parameters] |
summary_csv_prefix missing for RL | Key omitted | Add summary_csv_prefix = "/abs/workdir/run" under [parameters] |
Stage has no chkpt_file | Missing checkpoint path | Each [[stage]] needs chkpt_file = "/abs/workdir/stage1.chkpt" |
Transform type unknown | Typo | Valid types: sigmoid, reverse_sigmoid, double_sigmoid, step |
| Filter component has transform | Incorrect config | Remove transform.* from custom_alerts / MatchingSubstructure endpoints |
If errors found, show the relevant TOML section and the exact fix.
Generator-specific SMILES requirements
| Generator | Requirement |
|---|---|
reinvent | Standard valid SMILES |
libinvent | Must contain [*:0] attachment point(s) |
linkinvent | Two fragment SMILES separated by |, both valid |
mol2mol | Valid reference molecule SMILES |
Example
/validate data/training_smiles.smi
/validate configs/rl_config.toml