Utilities for selecting a substructure of a molecule.#889
Conversation
|
I haven't worked (enough) with stereo chemistry in the CDK to say anything useful about your change to When it comes to your changes in
@johnmay Do you want me to provide test cases for this? |
|
Ah it's because I'm a C programmer :-) memcpy(dest, src) makes most sense to me because it's like an assignment, Yeah I was putting the implementation out there to show how it could be, feel free to write some tests if not I'll do it at some point. |
…are implemented we want to do a single pass over them.
|
Just started on writing up a test case or two for the added methods and came across the method
in
Given the new method |
|
@johnmay Regarding your implementation of How meaningful is it to carry over the bond properties to the subgraph: The properties It probably depends on the use case, i.e., query substructure or just a regular, non-query substructure. |
- added a first very simply test for the copy method in AtomContainerManipulatorTest
- improved javadocs for new copy method in AtomContainerManipulator
|
The existing
Correct but the job here is to copy everything and make no assumptions/changes. If the uses wants to clear aromaticity/ring membership they can do that. I think it is useful to keep these in place and mirrors the addition of atoms (i.e. the atoms carry over these properties). I think technically the isInRing/Aromatic are implemented by the flags (which we should also copy) but this may not be the case in future. |
|
Wrote a first simple test, PR submitted. It tried testing it with AtomContainer
I fully understand why this is happening but wasn't quite sure how much work we should put in getting this working with the old AtomContainer2Interestingly enough,
on this line
The reason for this is the put operation within the for loop:
which - depending on the atom container - may replace (atom, atom) pairs with (atom, bond) pairs in the A possible solution might be to put the (atom, bond) pairs in a separate map and then fuse the (atom,atom) and (atom,bond) maps before calling |
…bstructure(IAtomContainer,Collection) instead - put an ignore on the method to test extractSubstructure(IAtomContainer,int[]) in AtomContainerManipulatorTest
I'd second both marking the existing method
Agreed. Just wanted to raise the issue, but I am fine with that. |
… remapping is indexed correctly.
|
Thanks should be fixed now, AtomContainer2 is going to become AtomContainer - it just to give people time to adjust we have the option to use the old one but the builder (correct) always gives you a new one. It is probably time to make that rename, given your code the other day I expect a lot of people are creating them wrong and so haven't really had a chance to see the changes that happens (i.e. enforcing you can't add a bond to atoms which don't belong to the molecule). |
- re-wrote extractSubstructure(IAtomContainer,int[]) to use extractSu…
|
Tweaked some things, maybe do want to keep the redundant exception as it is part of the signature. |
Yes, I kept the |
…ntainer,Predicate,Predicate) - added more tests for the copy method to AtomContainerManipulatorTest
|
Added more tests, fixed a bug, all in #893 Thanks for fixing the order of actual, expected in the tests. @johnmay Happy for you to make the decision whether to bring back the |
- fixed a bug in AtomContainerManipulator.copy(IAtomContainer,IAtomCo…
|
I quite like the assertThat (blog post I wrote on it: http://efficientbits.blogspot.com/2013/04/assert-that-assert-this.html) but they've deprecated and you now have to use the one that comes in from JUnit's Hamcrest dependency. |
…rest's assertThat
Thanks for pointing that out. I spend a few mins to migrate the tests I've written to Hamcrest's PR #895 |
re-wrote tests for methods copy and extractSubstructure based on Hamc…
|
Kudos, SonarCloud Quality Gate passed! |
|
OK to merge @egonw ? |
|
Yes, I was waiting for it to be finished, but it looked good |








Draft: needs tests.
@uli-f asked on the mailing list about this, makes sense to have the util functions to do it.