Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A couple of minor improvements #96

Merged
merged 1 commit into from
Sep 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 Nodes Feature"
version="4.3.0.qualifier"
version="4.3.1.qualifier"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you merge this as planned with the RDKit binaries changes, you may just increment the version number together with the binaries change as discussed there. All version numbers should be in sync at the end.

Copy link
Member Author

@greglandrum greglandrum Sep 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, these changes were made as part of the RDKit binaries merge, so they are in sync now

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
Bundle-SymbolicName: org.rdkit.knime.nodes;singleton:=true
Automatic-Module-Name: org.rdkit.knime.nodes
Bundle-Version: 4.3.0.qualifier
Bundle-Version: 4.3.1.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 @@ -60,6 +60,7 @@
import org.RDKit.DrawColour;
import org.RDKit.Int_Vect;
import org.RDKit.MolDraw2DSVG;
import org.RDKit.MolDrawOptions;
import org.RDKit.ROMol;
import org.knime.base.data.xml.SvgCell;
import org.knime.base.data.xml.SvgCellFactory;
Expand Down Expand Up @@ -417,6 +418,8 @@ public DataCell[] process(final InputDataInfo[] arrInputDataInfo, final DataRow
}

final MolDraw2DSVG molDrawing = markForCleanup(new MolDraw2DSVG(300, 300), lUniqueWaveId);
MolDrawOptions opts = molDrawing.drawOptions();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this also be wrapped in markForCleanup(..., lUniqueWaveId) ? There is a chance that it gets cleaned up with its parent object MolDraw2DSVG, but if in doubt (and I usually am, because you cannot look into that type of code) I would always call the delete() function at the end. The cleanup code handles it properly, if marked for cleanup.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question, but that object doesn't own any memory of its own... it's just a reference to memory that the MolDraw2DSVG owns, so it should not cause a leak.

opts.setAddStereoAnnotation(true);
molDrawing.drawMolecule(mol, "", ivAtoms, ivBonds, mapRdkitAtomColors, mapRdkitBondColors);
molDrawing.finishDrawing();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;

import org.RDKit.RDKFuncs;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
Expand Down Expand Up @@ -137,7 +138,7 @@ public ImageData getImageData() {

// We use the pref store of the UI plugin
setPreferenceStore(RDKitNodePlugin.getDefault().getPreferenceStore());
setDescription("This section contains sub sections to control preferences for RDKit Nodes.");
setDescription("This section contains sub sections to control preferences for the RDKit Nodes.\nThe nodes are using version "+RDKFuncs.getRdkitVersion()+" of the RDKit backend.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I think this will be quite useful

}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ else if (value instanceof SmartsValue) {
MolDrawOptions opts = molDrawing.drawOptions();
// we've already prepared the molecule appropriately, so don't try again:
opts.setPrepareMolsBeforeDrawing(false);
opts.setAddStereoAnnotation(true);
molDrawing.drawMolecule((ROMol)mol);
molDrawing.finishDrawing();

Expand Down