rdkit / knime-rdkit

The RDKit nodes for the KNIME Analytics Platform
26 stars 13 forks source link

Trying to understand the RDKit Aromatizer node and the comparison to 0 to determine success #108

Open TraceLD opened 2 years ago

TraceLD commented 2 years ago

I'm trying to understand an existing RDKit-based KNIME workflow and having used RDKit in Python previously I can't understand the RDKit Aromatizer node. It calls .setAromaticity(temp) where temp is a RDKit molecule and then compares the result to 0 to determine success but what is happening here? SetAromaticity in the C++ API which the Java KNIME is wrapping returns void and in Python it returns None. What does the comparison to 0 do here?

Line I'm referencing: https://github.com/rdkit/knime-rdkit/blob/d7604170eec455d04e735b11348c7735450b3106/org.rdkit.knime.nodes/src/org/rdkit/knime/nodes/aromatize/RDKitAromatizeNodeModel.java#L242

greglandrum commented 2 years ago

@TraceLD : the C++ setAromaticity() call which is being used by the KNIME node (the KNIME node actually uses the Java wrapper around this call) is this one: https://github.com/rdkit/rdkit/blob/f0cf0b0f202b469726a4aa86c4b14022f3ac7067/Code/GraphMol/MolOps.h#L552

TraceLD commented 2 years ago

@TraceLD : the C++ setAromaticity() call which is being used by the KNIME node (the KNIME node actually uses the Java wrapper around this call) is this one: https://github.com/rdkit/rdkit/blob/f0cf0b0f202b469726a4aa86c4b14022f3ac7067/Code/GraphMol/MolOps.h#L552

I see, why does it then seemingly get wrapped in Python into a function that returns None? https://www.rdkit.org/docs/source/rdkit.Chem.rdmolops.html#rdkit.Chem.rdmolops.SetAromaticity

greglandrum commented 2 years ago

I see, why does it then seemingly get wrapped in Python into a function that returns None? https://www.rdkit.org/docs/source/rdkit.Chem.rdmolops.html#rdkit.Chem.rdmolops.SetAromaticity

The Python wrappers and Java wrappers are created with different technologies and don't have a one-to-one mapping

TraceLD commented 2 years ago

The Python wrappers and Java wrappers are created with different technologies and don't have a one-to-one mapping

I suppose what I'm asking then is if there's a way to determine if SetAromaticity succeeded in Python akin to how it's done in KNIME, since for the same input in KNIME I get like 200 failures, whereas in Python I don't get anything since SetAromaticity just returns None and modifies the Mol in place (and there's no warning/exception either)