Skip to content

Commit

Permalink
Don't allow 'Z' in loose SMARTS. RDKit now match CACTVS so 2:1.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay committed Oct 25, 2018
1 parent 3ce35ed commit 23b39d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ else if (isFlavor(FLAVOR_OECHEM))
default: // Z=None
unget();
num = nextUnsignedInt();
if (isFlavor(FLAVOR_LOOSE | FLAVOR_DAYLIGHT)) {
if (isFlavor(FLAVOR_DAYLIGHT)) {
if (num < 0)
expr = new Expr(IS_IN_RING);
else if (num == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ public void hetero() {
@Test
public void ringSize() {
IAtomContainer mol = new AtomContainer();
assertTrue(Smarts.parse(mol, "[Z8]", Smarts.FLAVOR_LOOSE));
assertTrue(Smarts.parse(mol, "[Z8]", Smarts.FLAVOR_DAYLIGHT));
Expr actual = getAtomExpr(mol.getAtom(0));
Expr expected = expr(RING_SIZE, 8);
assertThat(actual, is(expected));
Expand All @@ -439,7 +439,7 @@ public void ringSize() {
@Test
public void ringSize0() {
IAtomContainer mol = new AtomContainer();
assertTrue(Smarts.parse(mol, "[Z0]", Smarts.FLAVOR_LOOSE));
assertTrue(Smarts.parse(mol, "[Z0]", Smarts.FLAVOR_DAYLIGHT));
Expr actual = getAtomExpr(mol.getAtom(0));
Expr expected = expr(IS_IN_CHAIN);
assertThat(actual, is(expected));
Expand All @@ -448,7 +448,7 @@ public void ringSize0() {
@Test
public void ringSizeDefault() {
IAtomContainer mol = new AtomContainer();
assertTrue(Smarts.parse(mol, "[Z]", Smarts.FLAVOR_LOOSE));
assertTrue(Smarts.parse(mol, "[Z]", Smarts.FLAVOR_DAYLIGHT));
Expr actual = getAtomExpr(mol.getAtom(0));
Expr expected = expr(IS_IN_RING);
assertThat(actual, is(expected));
Expand Down Expand Up @@ -697,7 +697,9 @@ public void atomStereoLeftOrUnspec() {
@Test
public void atomStereoSimpleLeft() {
Expr actual = getAtomExpr("[C@H]");
System.out.println(actual);
assertThat(actual, is(new Expr(ALIPHATIC_ELEMENT, 6)
.and(new Expr(STEREOCHEMISTRY, 1))
.and(new Expr(TOTAL_H_COUNT, 1))));
}

@Test
Expand Down

0 comments on commit 23b39d3

Please sign in to comment.