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

Not to keep flags in VABCVolume.calculate(IAtomContainer) #404

Closed
wants to merge 1 commit into from

Conversation

k-ujihara
Copy link
Contributor

Current implementation keeps only molecule's flags. It makes inconsistency between a molecule and containing atoms/bonds.

Current implementation keeps only molecule's flags. It makes inconsistency between molecule and containing atoms/bonds.
@egonw egonw self-requested a review December 31, 2017 10:52
@egonw
Copy link
Member

egonw commented Dec 31, 2017

Algorithms are not supposed to change flag (decision from a long time ago), unless they are meant to change them (of course). The noted inconsistency should be fixed, but then it should be fixed that atom and bond flags are also not changed.

So, I would suggest to not apply this patch, but:

  1. add a test to make sure atom and bond flags are not changed either
  2. (likely) fix this class that it does not change atom and bond flags

@johnmay, do you agree?

@@ -103,7 +103,6 @@ public static double calculate(IAtomContainer molecule) throws CDKException {
}
sum -= 5.92 * (molecule.getBondCount() + totalHCount);

boolean[] originalFlags = molecule.getFlags();
Copy link
Member

Choose a reason for hiding this comment

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

See comments on the PR.

@johnmay
Copy link
Member

johnmay commented Dec 31, 2017

What was the issue with the current code, i.e. which flags were being set/cleared?

A lot of the QSAR descriptors are in a bit of a mess as to avoid the non-modify rule a lot of the implementations simply clone the input (expensive).

@k-ujihara
Copy link
Contributor Author

I consider aromaticity model has to be applied only in caller code because unexpected aromaticity model change can affect the other descriptor results using the same molecule.
In this case, removing Aromaticity.cdkLegacy().apply(molecule); is the simple way but breaks existing codes.

@johnmay
Copy link
Member

johnmay commented Jan 1, 2018

Although I don't like it, the simple fix here is to clone the container (see others).

IMO the better design choice is to decide on a "normal form" of a molecule, it has: a) bond orders assigned, b) non-null hydrogen counts, c) ring flags assigned (isInRing), and d) some aromaticity applied, e) maybe atom types assigned but I don't think they're needed - everything else should be internal to the descriptor (e.g. using a thread local cache). Although there are different aromaticity models and some particular descriptor may need some specific model - providing the caller can choose and assign a different model thats okay.

@k-ujihara
Copy link
Contributor Author

I agree with John. I consider it is by cdk's design.
Anyway, molecule's flags are not required to keep in this method under the design.

@k-ujihara
Copy link
Contributor Author

This is fixed in #407.

@k-ujihara k-ujihara closed this Jan 16, 2018
@k-ujihara k-ujihara deleted the patch/VABC branch January 17, 2018 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants