diff --git a/core/src/main/java/uk/ac/ebi/beam/Localise.java b/core/src/main/java/uk/ac/ebi/beam/Localise.java index c194db0..846e345 100644 --- a/core/src/main/java/uk/ac/ebi/beam/Localise.java +++ b/core/src/main/java/uk/ac/ebi/beam/Localise.java @@ -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; } diff --git a/core/src/test/java/uk/ac/ebi/beam/LocaliseTest.java b/core/src/test/java/uk/ac/ebi/beam/LocaliseTest.java index 963a6e3..a92e791 100644 --- a/core/src/test/java/uk/ac/ebi/beam/LocaliseTest.java +++ b/core/src/test/java/uk/ac/ebi/beam/LocaliseTest.java @@ -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);