User c23c5e9da4
03-04-2007 22:19:43
If I have a RxnMolecule that I open up in a MSketchPane - after the user closes it is there any way to figure out which molecules have been edited vs which molecules have been added new? for instance if I set a property on a reactant and then open it in MSketchPane as long as the molecule doesn't change then the property is still attached to the molecule - but if the molecule is changed at all then I can't figure out how to tell if is an edited molecule or a new molecule - in this case the distinction being did they build it from nothing instead of building off an exiting molecule. Thanks.
Trevor
ChemAxon 7c2d26e5cf
05-04-2007 15:33:30
If I understand you correctly, you would like to compare the original molecule and the new one (that you retrieve from the sketcher).
The Object.equals(Object) method is not useful here because MSketchPane.getMol() returns with the clone of the used Molecule object.
Comparing the MRV sources of the old and new Molecule instances can be a good way to check whether the structure is changed or not.
Code: |
MSketchPane sketchpanel = ...
Molecule mol = ...
sketchPanel.setMol(mol);
...
Molecule sketchmol = sketchPanel.getMol();
if(mol.toFormat("mrv").equals(sketchmol.toFormat("mrv")) {
// the molecule was not changed
} else {
// the molecule was changed
} |
User c23c5e9da4
05-04-2007 15:46:57
The issue isn't about doing an exact match - the issue is tracking a instance of a molecule through a MSketchPane edit. For instance, If I have a reactant in a RxnMolecule which the user edits in an MSketchPane - associated with this reactant is a bunch of data (volume, conc, density, etc). If we store this data in the Molecule.get/setProperty feature it is visible in the reactant mlecule we get out of the sketcher if the molecule didn't change at all or if atoms and bonds were removed - but if anything is added then all the properties are cleared and we lose any information on that reactant. We would like all the marvin properties to be retained with that molecule unless the user completely erases it from the sketcher. Please let me know if this still isn't clear.
ChemAxon 7c2d26e5cf
05-04-2007 15:49:40
It's more clear but I have to think about the answer.
User f359e526a1
11-04-2007 07:16:50
User c23c5e9da4
11-04-2007 16:21:07
We are looking for more consistent behavior to when molecule properties are cleared - currently no properties are cleared if you delete a bond in a reaction component but if you add a bond then they are all cleared.
ChemAxon 7c2d26e5cf
12-04-2007 10:23:29
Please see the attached example. The starting molecule contains a property ("reaction_name"). On the right panel, the current value of this property is always visible.
The property value is preserved by modifying the structure (adding/removing bonds), unless the whole molecule is erased (File->New).
I think, it is a consistent behavior.
User c23c5e9da4
12-04-2007 15:33:20
I've attached a modified version of your example to show the issue. There is a new property called ID attached to the reactant. Watch what happens if you add a new bond to the reactant vs remove a bond.
ChemAxon 7c2d26e5cf
18-04-2007 09:19:08
Indeed. We are checking the issue.
User ef5e605ae6
18-04-2007 09:50:49
Properties are not cleared but the old reactant is removed and replaced by a new Molecule object. We fixed the issue by adding the properties of the removed object(s) to the new one. The bugfix will be available in Marvin 4.1.8.
User c23c5e9da4
24-07-2007 23:05:55
This issue still occurs if you delete the product and the redraw it - the properties on the reactant disappear. Run the attached example and delete the product - the arrow disappears so redraw the arrow and draw a new product - the id property on the reactant is no longer there.
User f359e526a1
26-07-2007 09:04:03
This needs a new feature - when you are assigning properties to a reaction, that will be stored in an RxnMolecule object. If you are assigning a property to one of the compounds, let's say to the reactant, that property will be assigned to that fragment but not to the whole RXN object. In this way you can assign properties to the reactants, agents and products and also to the whole RXN. So when you are deleting the reaction there will be only one Molecule object and some of the properties will disappear - we can merge them, but how to re-distribute the properties among fragments when you are creating a new reaction? Not speaking about property clash when the fragments have some property fields each (like "ID") which of these should be used at merging?
It is easy for reactions like CCC>>CC=C but can be confusing for something like CC.NNN>>C1CNN1.N . After deleting the right side I will have only CC.NNN and how will I merge the two ID properties?
Possible workarounds:
i) use DataSgroups
ii) when deleting the right side of the reaction, the default behaviour is to merge structures to a single Molecule object and delete the reaction. Alternatively we can change it to merge the fragments only when the arrow is deleted explicitly. Actually it is works like that right now if you have more fragments but needs modification for unimolecular reactions. In this way you can delete the righ/left side of the reaction, the properties will stay on fragments but still will disappear when you are deleting the arrow explicitly.
User c23c5e9da4
26-07-2007 14:36:54
we would prefer that the molecule remain a rxn unless you delete the reaction arrow explicitly but I will look into using DataSGroups.
Thanks,
Trevor
User f359e526a1
26-07-2007 14:40:15
User c23c5e9da4
23-08-2007 16:36:20
did this make it into the latest release?
ChemAxon 7c2d26e5cf
24-08-2007 14:06:57
Yes, the bugfix is available in the latest release (Marvin 4.1.12).
User c23c5e9da4
25-08-2007 01:34:33
confirmed - thanks - this is a huge help to us