Skip to content

Commit

Permalink
Anonymise should copy coordinates from the input.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay committed Jun 26, 2018
1 parent 60b2bcc commit 9966e60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
import org.openscience.cdk.stereo.ExtendedTetrahedral;
import org.openscience.cdk.stereo.TetrahedralChirality;

import javax.vecmath.Point2d;
import javax.vecmath.Point3d;

/**
* Class with convenience methods that provide methods to manipulate
* AtomContainer's. For example:
Expand Down Expand Up @@ -1491,7 +1494,15 @@ public static IAtomContainer anonymise(IAtomContainer src) {
IBond[] bonds = new IBond[src.getBondCount()];

for (int i = 0; i < atoms.length; i++) {
atoms[i] = builder.newInstance(IAtom.class, "C");
atoms[i] = builder.newAtom();
atoms[i].setAtomicNumber(6);
atoms[i].setSymbol("C");
atoms[i].setImplicitHydrogenCount(0);
IAtom srcAtom = src.getAtom(i);
if (srcAtom.getPoint2d() != null)
atoms[i].setPoint2d(new Point2d(srcAtom.getPoint2d()));
if (srcAtom.getPoint3d() != null)
atoms[i].setPoint3d(new Point3d(srcAtom.getPoint3d()));
}
for (int i = 0; i < bonds.length; i++) {
IBond bond = src.getBond(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ public static TemplateHandler createFromSubstructure(Pattern ptrn, IAtomContaine
IdentityTemplateLibrary toIdentityTemplateLibrary() {
IdentityTemplateLibrary lib = IdentityTemplateLibrary.empty();
for (IAtomContainer mol : templates) {
lib.add(mol);
lib.add(AtomContainerManipulator.anonymise(mol));
}
return lib;
Expand Down

0 comments on commit 9966e60

Please sign in to comment.