Skip to content

Commit

Permalink
Add enhanced stereochemistry support to SubstructureCounter and RDKit…
Browse files Browse the repository at this point in the history
…MoleculeSubstructFilter (#89)

* version bump

* Add enhanced stereo support to SubstructureCounter

* Add enhanced stereo support to RDKitMoleculeSubstructFilter
  • Loading branch information
greglandrum authored Mar 18, 2021
1 parent 575ca0b commit 5fe11f9
Show file tree
Hide file tree
Showing 21 changed files with 103 additions and 20 deletions.
4 changes: 2 additions & 2 deletions org.rdkit.knime.bin.linux.x86_64/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: RDKit binaries for 64bit Linux
Bundle-SymbolicName: org.rdkit.knime.bin.linux.x86_64;singleton:=true
Bundle-Version: 4.2.0.qualifier
Fragment-Host: org.rdkit.knime.types;bundle-version="4.2.0"
Bundle-Version: 4.3.0.qualifier
Fragment-Host: org.rdkit.knime.types;bundle-version="4.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Eclipse-PlatformFilter: (&(osgi.os=linux)(osgi.arch=x86_64))
Bundle-Vendor: NIBR
4 changes: 2 additions & 2 deletions org.rdkit.knime.bin.macosx.x86_64/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: RDKit binaries for 64bit MacOSX
Bundle-SymbolicName: org.rdkit.knime.bin.macosx.x86_64;singleton:=true
Bundle-Version: 4.2.0.qualifier
Fragment-Host: org.rdkit.knime.types;bundle-version="4.2.0"
Bundle-Version: 4.3.0.qualifier
Fragment-Host: org.rdkit.knime.types;bundle-version="4.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Eclipse-PlatformFilter: (&(osgi.os=macosx)(osgi.arch=x86_64))
Bundle-Vendor: NIBR
4 changes: 2 additions & 2 deletions org.rdkit.knime.bin.win32.x86_64/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: RDKit binaries for 64bit Windows
Bundle-SymbolicName: org.rdkit.knime.bin.win32.x86_64;singleton:=true
Bundle-Version: 4.2.0.qualifier
Fragment-Host: org.rdkit.knime.types;bundle-version="4.2.0"
Bundle-Version: 4.3.0.qualifier
Fragment-Host: org.rdkit.knime.types;bundle-version="4.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Eclipse-PlatformFilter: (&(osgi.os=win32)(osgi.arch=x86_64))
Bundle-Vendor: NIBR
2 changes: 1 addition & 1 deletion org.rdkit.knime.binaries.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="org.rdkit.knime.binaries.feature"
label="RDKit Binaries for Java"
version="4.2.0.qualifier"
version="4.3.0.qualifier"
provider-name="NIBR">

<description>
Expand Down
2 changes: 1 addition & 1 deletion org.rdkit.knime.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="org.rdkit.knime.feature"
label="RDKit KNIME integration"
version="4.2.0.qualifier"
version="4.3.0.qualifier"
provider-name="NIBR"
plugin="org.rdkit.knime.nodes">

Expand Down
2 changes: 1 addition & 1 deletion org.rdkit.knime.nodes/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: RDKit Nodes for Knime
Bundle-SymbolicName: org.rdkit.knime.nodes;singleton:=true
Automatic-Module-Name: org.rdkit.knime.nodes
Bundle-Version: 4.2.0.qualifier
Bundle-Version: 4.3.0.qualifier
Bundle-Vendor: NIBR
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.ui;bundle-version="[3.109.0,4.0.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,17 @@ protected RDKitMoleculeSubstructFilterNodeDialog() {
final DialogComponent compQueryColumn = add(new DialogComponentColumnNameSelection(
createQueryColumnNameModel(), "Query Mol column: ", 1,
arrClassesQueryType));
final DialogComponent compUseChirality = add(new DialogComponentBoolean(createUseChiralityModel(),


final SettingsModelBoolean modelUseChiralityOption = createUseChiralityModel();
final DialogComponent compUseChirality = add(new DialogComponentBoolean(modelUseChiralityOption,
"Use stereochemistry"));
final DialogComponent compUseEnhancedStereo = add(
new DialogComponentBoolean(createUseEnhancedStereoModel(modelUseChiralityOption),
"Use enhanced stereochemistry when matching"));



final SettingsModelEnumeration<MatchingCriteria> modelMatchingCriteria =
createMatchingCriteriaModel();
final DialogComponent compMatchingCriteria = add(new DialogComponentEnumButtonGroup<MatchingCriteria>(
Expand Down Expand Up @@ -136,6 +145,10 @@ protected RDKitMoleculeSubstructFilterNodeDialog() {
0, iRow++, LayoutUtils.REMAINDER, 1,
LayoutUtils.NONE, LayoutUtils.CENTER, 0.0d, 0.0d,
0, 10, 0, 10);
LayoutUtils.constrain(panel, compUseEnhancedStereo.getComponentPanel(),
0, iRow++, LayoutUtils.REMAINDER, 1,
LayoutUtils.NONE, LayoutUtils.CENTER, 0.0d, 0.0d,
0, 10, 0, 10);
LayoutUtils.constrain(panel, new JLabel("Match:", SwingConstants.RIGHT),
0, iRow, 1, 1,
LayoutUtils.HORIZONTAL, LayoutUtils.NORTHEAST, 1.0d, 0.0d,
Expand Down Expand Up @@ -269,6 +282,32 @@ static final SettingsModelString createNewColumnNameModel() {
static final SettingsModelBoolean createUseChiralityModel() {
return new SettingsModelBoolean("use_chirality", false);
}

/**
* Creates the settings model to be used to specify the option
* to use enhanced stereo in the matching.
* Added in March 2021.
*
* @return Settings model for useEnhancedStereo option.
*/
static final SettingsModelBoolean createUseEnhancedStereoModel(final SettingsModelBoolean modelUseChiralityOption) {
final SettingsModelBoolean modelWithDependency = new SettingsModelBoolean("useEnhancedStereo", false);

// React on any changes
modelUseChiralityOption.addChangeListener(new ChangeListener() {

@Override
public void stateChanged(final ChangeEvent e) {
// Enable or disable the model
modelWithDependency.setEnabled(modelUseChiralityOption.getBooleanValue());
}
});

// Enable this model based on the dependent model's state
modelWithDependency.setEnabled(modelUseChiralityOption.getBooleanValue());

return modelWithDependency;
}

/**
* Creates the settings model to be used to specify the option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<option name="Query Mol column">Select the column from the second input table that contains the query molecules.
Acceptable types are SMARTS, SMILES, SDF and RDKit Mol.</option>
<option name="Use chirality">If this is set, information about stereochemistry will be used in the substructure search.</option>
<option name="Use enhanced stereochemistry">If this is set, information about enhanced stereochemistry will be used in the substructure search.</option>
<option name="Matches">Select the minimum number of patterns that must match for each molecule so that it is
included in the first output table</option>
<option name="New column name for matching substructures">Enter here the name of the new column that will contain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
import org.rdkit.knime.nodes.rdkfingerprint.DefaultFingerprintSettings;
import org.rdkit.knime.nodes.rdkfingerprint.FingerprintSettings;
import org.rdkit.knime.nodes.rdkfingerprint.FingerprintType;
import org.rdkit.knime.nodes.substructfilter.RDKitSubstructFilterNodeDialog;
import org.rdkit.knime.nodes.substructfilter.RDKitSubstructFilterNodeModel;
import org.rdkit.knime.types.RDKitAdapterCell;
import org.rdkit.knime.types.RDKitMolValue;
Expand Down Expand Up @@ -193,6 +194,10 @@ public String toString() {
protected final SettingsModelBoolean m_modelUseChirality =
registerSettings(RDKitMoleculeSubstructFilterNodeDialog.createUseChiralityModel(), true);

/** Settings model for the option to use enhanced stereo in the match. Added in March 2021. */
private final SettingsModelBoolean m_modelUseEnhancedStereo =
registerSettings(RDKitMoleculeSubstructFilterNodeDialog.createUseEnhancedStereoModel(m_modelUseChirality), true);

/** Settings model for the matching criteria. */
protected final SettingsModelEnumeration<MatchingCriteria> m_modelMatchingCriteria =
registerSettings(RDKitMoleculeSubstructFilterNodeDialog.createMatchingCriteriaModel(), true);
Expand Down Expand Up @@ -456,6 +461,7 @@ public DataCell[] process(final InputDataInfo[] arrInputDataInfo, final DataRow

final SubstructMatchParameters ps = new SubstructMatchParameters();
ps.setUseChirality(m_modelUseChirality.getBooleanValue());
ps.setUseEnhancedStereo(m_modelUseEnhancedStereo.getBooleanValue());

for (int i = 0; i < m_arrQueryMols.length; i++) {
final ROMol molPattern = m_arrQueryMols[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,14 @@ public class SubstructureCounterNodeDialog extends DefaultNodeSettingsPane {
super.addDialogComponent(
new DialogComponentBoolean(createUniqueMatchesOnlyModel(),
"Count unique matches only"));
final SettingsModelBoolean modelUseChiralityOption = createUseChiralityModel();
super.addDialogComponent(
new DialogComponentBoolean(createUseChiralityModel(),
new DialogComponentBoolean(modelUseChiralityOption,
"Use chirality when matching"));
super.addDialogComponent(
new DialogComponentBoolean(createUseEnhancedStereoModel(modelUseChiralityOption),
"Use enhanced stereochemistry when matching"));


createNewGroup("Output");
// Add query name option settings
Expand Down Expand Up @@ -177,6 +182,32 @@ static final SettingsModelBoolean createUseChiralityModel() {
return new SettingsModelBoolean("useChirality", false);
}

/**
* Creates the settings model to be used to specify the option
* to use enhanced stereo in the matching.
* Added in March 2021.
*
* @return Settings model for useEnhancedStereo option.
*/
static final SettingsModelBoolean createUseEnhancedStereoModel(final SettingsModelBoolean modelUseChiralityOption) {
final SettingsModelBoolean modelWithDependency = new SettingsModelBoolean("useEnhancedStereo", false);

// React on any changes
modelUseChiralityOption.addChangeListener(new ChangeListener() {

@Override
public void stateChanged(final ChangeEvent e) {
// Enable or disable the model
modelWithDependency.setEnabled(modelUseChiralityOption.getBooleanValue());
}
});

// Enable this model based on the dependent model's state
modelWithDependency.setEnabled(modelUseChiralityOption.getBooleanValue());

return modelWithDependency;
}

/**
* Creates the settings model to be used to specify the option
* to use data of specific input table column as column names
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<tab name="Search">
<option name="Count Unique Matches Only?">This option is selected if user requires unique matches of the query molecule in an input molecule.</option>
<option name="Use chirality">If this is set, information about stereochemistry will be used in the substructure search.</option>
<option name="Use enhanced stereochemistry">If this is set, information about enhanced stereochemistry will be used in the substructure search.</option>
</tab>
<tab name="Output">
<option name="Instead of query molecules use names as result header titles (and tags)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ public class SubstructureCounterNodeModel extends AbstractRDKitCalculatorNodeMod
private final SettingsModelBoolean m_modelUseChirality =
registerSettings(SubstructureCounterNodeDialog.createUseChiralityModel(), true);

/** Settings model for the option to use enhanced stereo in the match. Added in March 2021. */
private final SettingsModelBoolean m_modelUseEnhancedStereo =
registerSettings(SubstructureCounterNodeDialog.createUseEnhancedStereoModel(m_modelUseChirality), true);

/** Settings model for the option to use a query name column. */
private final SettingsModelBoolean m_modelUseQueryNameColumn =
registerSettings(SubstructureCounterNodeDialog.createUseQueryNameColumnModel(), true);
Expand Down Expand Up @@ -522,6 +526,7 @@ protected AbstractRDKitCellFactory[] createOutputFactories(final int outPort, fi

final SubstructMatchParameters ps = markForCleanup(new SubstructMatchParameters());
ps.setUseChirality(m_modelUseChirality.getBooleanValue());
ps.setUseEnhancedStereo(m_modelUseEnhancedStereo.getBooleanValue());
ps.setUniquify(m_modelUniqueMatchesOnly.getBooleanValue());

// Generate factory
Expand Down Expand Up @@ -668,7 +673,7 @@ else if (mol.getNumAtoms() > 0 && mol.getAtomWithIdx(0).hasQuery()) {

// Or a SMILES (or SMARTS conversion failed)
if (strQueryMolString == null) {
strQueryMolString = mol.MolToSmiles(true);
strQueryMolString = RDKFuncs.MolToCXSmiles(mol);
}

// Fallback, if SMARTS/SMILES conversion failed
Expand Down
2 changes: 1 addition & 1 deletion org.rdkit.knime.testing.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="org.rdkit.knime.testing.feature"
label="RDKit KNIME JUnit Test"
version="4.2.0.qualifier"
version="4.3.0.qualifier"
provider-name="NIBR">

<description>
Expand Down
4 changes: 2 additions & 2 deletions org.rdkit.knime.testing/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
Bundle-Name: Testing
Bundle-SymbolicName: org.rdkit.knime.testing;singleton:=true
Automatic-Module-Name: org.rdkit.knime.testing
Bundle-Version: 4.2.0.qualifier
Fragment-Host: org.rdkit.knime.nodes;bundle-version="4.2.0"
Bundle-Version: 4.3.0.qualifier
Fragment-Host: org.rdkit.knime.nodes;bundle-version="4.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.knime.testing;bundle-version="[3.7.0,5.0.0)",
org.knime.chem.base;bundle-version="[3.6.0,5.0.0)"
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion org.rdkit.knime.types/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Bundle-ActivationPolicy: lazy
Bundle-ClassPath: rdkit-chem.jar,
lib/org.RDKit.jar,
lib/org.RDKitDoc.jar
Bundle-Version: 4.2.0.qualifier
Bundle-Version: 4.3.0.qualifier
Bundle-Name: RDKit Chemistry Type Definition Plugin
Bundle-Activator: org.rdkit.knime.RDKitTypesPluginActivator
Bundle-ManifestVersion: 2
Expand Down
2 changes: 1 addition & 1 deletion org.rdkit.knime.update/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="org.rdkit.knime.update"
label="RDKit Update Site"
version="4.2.0.qualifier">
version="4.3.0.qualifier">

<description url="http://www.example.com/description">
[Enter Feature Description here.]
Expand Down
2 changes: 1 addition & 1 deletion org.rdkit.knime.wizards.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="org.rdkit.knime.wizards.feature"
label="RDKit KNIME Wizards"
version="4.2.0.qualifier"
version="4.3.0.qualifier"
provider-name="NIBR"
plugin="org.rdkit.knime.wizards">

Expand Down
2 changes: 1 addition & 1 deletion org.rdkit.knime.wizards.samples/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: RDKit Node Wizards Samples
Bundle-SymbolicName: org.rdkit.knime.wizards.samples;singleton:=true
Automatic-Module-Name: org.rdkit.knime.wizards.samples
Bundle-Version: 4.2.0.qualifier
Bundle-Version: 4.3.0.qualifier
Bundle-Activator: org.rdkit.knime.wizards.samples.Activator
Bundle-Vendor: NIBR
Require-Bundle: org.knime.base;bundle-version="[3.6.2,5.0.0)",
Expand Down
2 changes: 1 addition & 1 deletion org.rdkit.knime.wizards/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: RDKit Nodes Wizards
Bundle-SymbolicName: org.rdkit.knime.wizards;singleton:=true
Automatic-Module-Name: org.rdkit.knime.wizards
Bundle-Version: 4.2.0.qualifier
Bundle-Version: 4.3.0.qualifier
Bundle-Activator: org.rdkit.knime.wizards.RDKitNodesWizardsPlugin
Bundle-Vendor: NIBR
Require-Bundle: org.knime.base;bundle-version="[3.6.2,5.0.0)",
Expand Down

0 comments on commit 5fe11f9

Please sign in to comment.