Column Rename node doesn't convert chemical structures to String

The Column Rename node doesn't convert molecules to String.  For example, I'm trying to convert a SMILES column (which has been previously cast as such in order to perform calculations on it) back to type String. 

I select this column in 'Column Rename', keep the name identical, and select the drop down to change SmilesValue to StringValue.  It appears to work, as the output table has the String icon for this column; but in reality, it is changed to "Non-Native [interface org.knime.core.data.StringValue, interface org.knime.chem.types.SmilesValue, interface org.knime.core.data.DataValue]" and thus String operations cannot be performed on it.  I've spent a lot of time struggling with this, to no avail.  It would be nice if this, or some other node could cast a molecular structure back to String, kind of like an inverse of the 'Molecule Type Cast'.

I need this column of type String because there is already another column that is a molecular structure type, and 'JChem Update' doesn't allow more than one structure column in a table that is to be uploaded to a MySQL database.  So my plan is to keep it as "String" in the database until I need to use it later (by casting it back to molecule).

I've attached a simplified workflow which exemplifies the problem.

You have to use string replacer

hope this help you

I hope that you found a solution for that, i face the same problem

The simplest way is a Java Snippet as shown (in this case, for an incoming Mol column, but the same works for any of the other molecule types - sdf, SMILES, SMARTS, Mol2, pdb etc):

The one thing you do need to watch out for is if your molecule column is in an adapter cell holding multiple representations.

Steve

1 Like

Hi there,

you can also use String Manipulation node with string() function to convert it successfully.

And avoid using Column Rename node for changing column types…

Br,
Ivan

Thank you i used column rename and after string replacer and it works but those solusions are convenient