Dotmatics Vortex script · Jython

Strip Salts and Solvents

Turn every structure in a workspace into its parent molecule: counter-ions and solvents removed, charges neutralised. The results go to a new workspace; the table you start from is not changed.

File My_Scripts/StripSaltsSolvents.vpy Menu Scripts › My_Scripts Method ChEMBL Structure Pipeline, as in iBabel

How it works

Each structure is split into its fragments (the parts separated by dots in SMILES). Then three steps run in order, the same rules as iBabel's Strip salts and solvents tool, which follows the ChEMBL Structure Pipeline:

An ibuprofen triethylammonium salt hydrate passes through three steps. Step 1 removes triethylamine and water, which are on the salt list. Step 2 finds no solvent left to remove. Step 3 neutralises the carboxylate, giving ibuprofen with status stripped, neutralised.
One record through the three steps. Triethylamine and water are both on ChEMBL's salt list.
  1. Salts. Fragments that are on the salt list are removed, unless that would remove every fragment. A record made only of salts, such as sodium acetate, is kept whole.
  2. Solvents. The same for the solvent list, on what is left. A record made only of solvents is kept whole.
  3. Neutralise. Charges are removed by moving H+: a positive N, P, O, S, As or Se with H loses one, and a negative atom gains one. Atoms next to an opposite charge are left alone, so nitro groups, N-oxides and quaternary ammonium stay as they are. If neutralising would give a net charge to a molecule that had none (betaine, for example), the record is not neutralised.

What counts as a match

A fragment is removed only when it is the same whole structure as a list entry, never when it merely contains one. Ethyl acetate is not acetate, and a drug with a benzoic acid in it is not benzoate.

Fragments and list entries are compared by the main layer of their standard InChI (formula, connections and H positions). That layer ignores charge, protonation and stereo, so:

CC(=O)[O-] = CC(=O)O[Na+] = [Na][Cl-] = ClN-H / O-H tautomers match

The tautomer point means one entry covers both forms of a counter-ion that can move an H between N and O. Orotic acid is listed in its hydroxy form, and the usual oxo form still matches it.

The InChI comes from Vortex's own calculator, and is worked out only for fragments whose heavy atoms could match a list entry, so large workspaces stay quick.

The dialog

Open the workspace you want to clean and choose Scripts › My_Scripts › StripSaltsSolvents.

The Strip Salts and Solvents dialog: four ticked options (strip salts and counter-ions, strip solvents, neutralise the parent, include an Input SMILES column), the new workspace name salt_test parents, and Cancel and OK buttons.
The dialog, run on the test workspace salt_test.csv.
OptionDefault
Table
Shown only when the workspace has more than one table.
current
Strip salts and counter-ions
Step 1.
on
Strip solvents
Step 2.
on
Neutralise the parent
Step 3. Turn off to keep charges as drawn.
on
Include an Input SMILES column
Adds the original structure next to the parent.
on
New workspace name
Taken from the source workspace.
… parents

Click OK to start. A progress bar shows each block of 20,000 rows, and you can cancel; nothing is created if you do.

The new workspace

When the progress bar closes, a new workspace opens with one row per source row, in the same order. Its columns are:

ColumnContents
SMILESThe parent structure. Vortex draws it as the structure column.
Input SMILESThe structure as it was, if you ticked that option.
RemovedWhat was taken off, by list name, for example Water; Chloride or Potassium ×2; Benzoate.
Parent statusWhat happened to the row (see below).
othersEvery other column of the source table. A column already called SMILES comes across as Original SMILES.

Parent status

strippedSalts or solvents were removed.
neutralisedCharges were removed. Can appear with stripped.
unchangedNothing to do.
all salts, keptEvery fragment is a salt, so the record was left whole.
all solvents, keptEvery fragment left is a solvent, so it was left whole.
explicit H, not neutralisedThe structure has explicit H atoms, which the neutraliser does not handle.
not processedThe row has no structure, or Vortex could not read it. The row is still copied.
The salt_test parents workspace: columns SMILES, Input SMILES, Removed and Parent status for 14 test rows, such as methylamine hydrochloride giving methylamine with Chloride removed, sodium acetate kept whole as all salts, and ibuprofen orotate giving ibuprofen with Orotic acid removed.
The test run. The Removed and Parent status columns are coloured by Vortex.
Summary message: 14 rows from salt_test. Stripped 9, neutralised 3, unchanged 2, all salts kept 1, all solvents kept 1, not neutralised because of net charge 1. Most often removed: Chloride 4, Potassium 2, then Benzoate, DMSO, Mesylate, Orotic acid, Triethylamine and Water 1 each. Time taken 0.2 s.
The summary for the 14-row test table.

The summary

A message then gives the counts for each status, the ten fragments removed most often, and how long the run took.

Not neutralised, net charge counts records the neutraliser left alone because it would have charged a neutral molecule. In the test that is betaine, which stays a zwitterion.

If any list entry could not be read by Vortex, it is named at the end of the message. That entry then never matches, so fix its SMILES.

The salt and solvent lists

The lists are part of the script, near the top, as SALTS and SOLVENTS: 166 salts and counter-ions, and 9 solvents. One entry per line, a name, a tab, then the SMILES. Lines starting with # are ignored. Edit them there; the name you give is what appears in the Removed column.

SALTS = r"""
Tetrafluoroboranuide	F[B-](F)(F)F
Arginine	NC(CCCNC(=N)N)C(=O)O
...
"""

They are ChEMBL's lists, the same ones iBabel uses, with one change: Orotic acid is written OC(c1nc(O)nc(O)c1)=O, because ChEMBL's version could not be read by Vortex.

Water and triethylamine are on the salt list. ChEMBL lists water as both a salt and a solvent, and a few amines, such as triethylamine, as counter-ions. So a hydrochloride hydrate loses both the chloride and the water in step 1.

Things to know

Installing and testing

Copy the script into your Vortex scripts folder. It appears in the Scripts menu straight away; no restart is needed.

~/vortex/scripts/My_Scripts/StripSaltsSolvents.vpy

Written for Vortex 26.05 (Jython 2.5). It uses only Vortex's built-in calculator, so no external tools or Python environments are needed.

This folder also holds salt_test.csv, the 14-row table used for the pictures, and test_strip.py, which checks the matching and neutralising logic outside Vortex with RDKit in place of the Vortex calculator:

python test_strip.py ~/vortex/scripts/My_Scripts/StripSaltsSolvents.vpy