Converting an atom in a substructure to another atom


I have a group of compounds all with a common substructure and I would like to convert one of the atoms in the substructure to another, (F to O-). I’ve tried the atom replacer, but it replaces all the F atoms, and not just the ones on the substructure. Is there a way to only change the atoms on the substructure through a series of nodes?


Hi @Clinton, can you provide your workflow for us to look at, as well as samples of the inputs and desired outputs?


I currently just have an SDF Reader linked to an Atom Replacer, but this replaces all F atoms, and cannot add O-, but rather adds OH instead.

It would be great if it could add O-, or add OH to only the F in the SO2F substructure, then somehow deprotonate it so it results in O-, but I’m not sure how I would go about doing that.

I can’t seem to upload .sdf files, but I have included my desired output as well within the workflow which was made from manually changing the atoms with another program.

Thanks again

Functional_Group_Modification.knwf (35.9 KB)

By using the Atom Replacer node right after the SDF Reader you’re telling KNIME to replace every F with O, and since atom labels don’t include charges, it’ll understand to use OH.

My suggestion would be to use the RDKit One Component Reaction node, using the following Reaction SMARTS (or something similar):


This node carries out a chemical reaction on a single molecule. The SMARTS Reaction string tells KNIME to

  1. look for an aromatic carbon and label it as atom 1
  2. look for a sulfur atom bound to that aromatic carbon and also to 2 oxygen atoms (with double bonds) and an F atom, and label it as atom 2
  3. replace the F with O-

Follow this up with the RDKit Generate Coords node and you get something that looks like this:

The SMARTS I used is quite basic, and may fail if you have more complicated molecules. To help come up with your own, you can read more about SMILES and SMARTS molecular representation here: They’re quite useful for things like this.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.