Skip to content

Commit

Permalink
Aromatic phosphorus should be treated the same as nitrogen.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay committed Mar 15, 2023
1 parent d79481f commit aafd244
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/src/main/java/uk/ac/ebi/beam/Localise.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ static boolean predetermined(Graph g, int v) {
for (int j = 0; j < d; ++j) {
Edge e = g.edgeAt(v, j);
if (e.bond() == Bond.DOUBLE) {
if (q == 0 && (a.element() == Element.Nitrogen || (a.element() == Element.Sulfur && deg > 3))
)
if (q == 0 && (a.element() == Element.Nitrogen ||
a.element() == Element.Phosphorus ||
(a.element() == Element.Sulfur && deg > 3)))
return false;
return true;
}
Expand Down
4 changes: 4 additions & 0 deletions core/src/test/java/uk/ac/ebi/beam/LocaliseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ public void mixing_aromatic_and_aliphatic() throws Exception {
test("*1ccccc1", "*1=CC=CC=C1");
}

@Test public void aromphos() throws Exception {
test("O=p1ccccc1", "O=P1=CC=CC=C1");
}

static void test(String delocalised, String localised) throws Exception {
Graph g = Graph.fromSmiles(delocalised);
Graph h = Localise.localise(g);
Expand Down

0 comments on commit aafd244

Please sign in to comment.