Published June 1, 2008 | https://doi.org/10.59350/e0rrq-d0863

Finding differences between IChemObjects

Creators & Contributors

CDK trunk is getting into shape, thanx to the many people who contribute to this, and special thanx to Miguel for cleaning up his code related to charge, resonance, and ionization potential calculations!

At the moment, I am focusing at two issues:

  1. QSAR descriptors that change the input (causing other descriptors to randomly fail)
  2. Cloning of IChemObject (for which last week a rather serious bug was found)

Until some days ago, the CDK had one main method to introspect IChemObjects: their toString() results. However, finding the difference between IChemObjects using this approach is not trivial, particularly if there are several differences.

So, I started a new module called diff. If two objects are identical, it returns a zero-length String. If not, it lists the changes between the two classes, in a way much like that of the IChemObjects toString() methods.

For example, consider this bit of code:

IChemObject atom1 = new ChemObject();
IChemObject atom2 = new ChemObject();
atom2.setFlag(CDKConstants.ISAROMATIC, true);
String result = ChemObjectDiff.diff( atom1, atom2 );

The result value then looks like:

ChemObjectDiff(, flag5:F/T)

Now, output will likely change a bit over time. But at least, I now have a easier to use approach for debugging and writing unit tests. Don't be suprised to see test-* modules start depending on the new diff module.

Additional details

Description

CDK trunk is getting into shape, thanx to the many people who contribute to this, and special thanx to Miguel for cleaning up his code related to charge, resonance, and ionization potential calculations!

Identifiers

UUID
8742515c-8f8b-420c-bc6e-eb3e3d603e8e
GUID
https://doi.org/10.59350/e0rrq-d0863
URL
https://chem-bla-ics.linkedchemistry.info/2008/06/01/finding-differences-between.html

Dates

Issued
2008-06-01T00:00:00
Updated
2008-06-01T00:00:00