FischerRecognition fischerRecon = new FischerRecognition(container, graph, bondMap, centers); CyclicCarbohydrateRecognition cycleRecon = new CyclicCarbohydrateRecognition(container, graph, bondMap, centers); elements.addAll(fischerRecon.recognise(projections)); elements.addAll(cycleRecon.recognise(projections));
IBond[] cardinalBonds = cardinalBonds(focus, bonds); if (!isPlanarSigmaBond(cardinalBonds[NORTH]) || !isPlanarSigmaBond(cardinalBonds[SOUTH])) return null; if (isPlanarSigmaBond(cardinalBonds[EAST])) { neighbors[EAST] = cardinalBonds[EAST].getOther(focus); if (isPlanarSigmaBond(cardinalBonds[WEST])) { neighbors[WEST] = cardinalBonds[WEST].getOther(focus);
@Test public void doNotCreateCenterWhenEastAndWestAreMissing() { IAtom focus = atom("C", 0, 0.80d, 0.42d); IAtom north = atom("C", 0, 0.80d, 1.24d); IAtom south = atom("C", 2, 0.80d, -0.41d); IBond[] bonds = new IBond[]{ new Bond(focus, north), new Bond(focus, south) }; ITetrahedralChirality element = FischerRecognition.newTetrahedralCenter(focus, bonds); Assert.assertNull(element); }
continue; ITetrahedralChirality element = newTetrahedralCenter(focus, neighbors(v, graph, bonds)); IAtom west = element.getLigands()[WEST]; if (!east.equals(focus) && !isTerminal(east, atomToIndex)) continue; if (!west.equals(focus) && !isTerminal(west, atomToIndex)) continue;
@Test public void obtainCardinalBonds() { IAtom focus = atom("C", 0, 0.80d, 0.42d); IAtom north = atom("C", 0, 0.80d, 1.24d); IAtom east = atom("O", 1, 1.63d, 0.42d); IAtom south = atom("C", 2, 0.80d, -0.41d); IAtom west = atom("H", 0, -0.02d, 0.42d); IBond[] expected = new IBond[]{ new Bond(focus, north), new Bond(focus, east), new Bond(focus, south), new Bond(focus, west) }; IBond[] actual = FischerRecognition.cardinalBonds(focus, new IBond[]{expected[1], expected[2], expected[3], expected[0]} ); Assert.assertThat(expected, is(actual)); }
/** * In reality, bonds may not be perfectly orthogonal. Here the N, E, S, and * W atoms are all slightly offset from the focus. */ @Test public void obtainNonPerfectCardinalBonds() { IAtom focus = atom("C", 0, -0.40d, 3.37d); IAtom north = atom("C", 0, -0.43d, 4.18d); IAtom east = atom("O", 1, 0.44d, 3.33d); IAtom south = atom("C", 2, -0.42d, 2.65d); IAtom west = atom("H", 0, -1.21d, 3.36d); IBond[] expected = new IBond[]{ new Bond(focus, north), new Bond(focus, east), new Bond(focus, south), new Bond(focus, west) }; IBond[] actual = FischerRecognition.cardinalBonds(focus, new IBond[]{expected[1], expected[2], expected[3], expected[0]} ); Assert.assertThat(expected, is(actual)); }
FischerRecognition recogniser = new FischerRecognition(m, graph, bondMap, Stereocenters.of(m)); List<IStereoElement> elements = recogniser.recognise(Collections.singleton(Projection.Fischer)); Assert.assertThat(elements.size(), is(1)); assertTetrahedralCenter(elements.get(0),
@Test public void createCenterWithThreeNeighbors_right() { IAtom focus = atom("C", 0, 0.80d, 0.42d); IAtom north = atom("C", 0, 0.80d, 1.24d); IAtom east = atom("O", 1, 1.63d, 0.42d); IAtom south = atom("C", 2, 0.80d, -0.41d); IBond[] bonds = new IBond[]{ new Bond(focus, south), new Bond(focus, north), new Bond(focus, east) }; ITetrahedralChirality element = FischerRecognition.newTetrahedralCenter(focus, bonds); Assert.assertThat(element.getChiralAtom(), is(sameInstance(focus))); Assert.assertThat(element.getStereo(), is(ANTI_CLOCKWISE)); Assert.assertThat(element.getLigands()[0], is(sameInstance(north))); Assert.assertThat(element.getLigands()[1], is(sameInstance(east))); Assert.assertThat(element.getLigands()[2], is(sameInstance(south))); Assert.assertThat(element.getLigands()[3], is(sameInstance(focus))); }
FischerRecognition recogniser = new FischerRecognition(m, graph, bondMap, Stereocenters.of(m)); List<IStereoElement> elements = recogniser.recognise(Collections.singleton(Projection.Fischer)); Assert.assertThat(elements.size(), is(1)); assertTetrahedralCenter(elements.get(0),
@Test public void createCenterWithThreeNeighbors_left() { IAtom focus = atom("C", 0, 0.80d, 0.42d); IAtom north = atom("C", 0, 0.80d, 1.24d); IAtom south = atom("C", 2, 0.80d, -0.41d); IAtom west = atom("O", 1, -0.02d, 0.42d); IBond[] bonds = new IBond[]{ new Bond(focus, south), new Bond(focus, north), new Bond(focus, west) }; ITetrahedralChirality element = FischerRecognition.newTetrahedralCenter(focus, bonds); Assert.assertThat(element.getChiralAtom(), is(sameInstance(focus))); Assert.assertThat(element.getStereo(), is(ANTI_CLOCKWISE)); Assert.assertThat(element.getLigands()[0], is(sameInstance(north))); Assert.assertThat(element.getLigands()[1], is(sameInstance(focus))); Assert.assertThat(element.getLigands()[2], is(sameInstance(south))); Assert.assertThat(element.getLigands()[3], is(sameInstance(west))); }
FischerRecognition recogniser = new FischerRecognition(m, graph, bondMap, Stereocenters.of(m)); List<IStereoElement> elements = recogniser.recognise(Collections.singleton(Projection.Fischer)); Assert.assertThat(elements.size(), is(1)); assertTetrahedralCenter(elements.get(0),
@Test public void doNotCreateCenterWhenSouthIsMissing() { IAtom focus = atom("C", 0, 0.80d, 0.42d); IAtom north = atom("C", 0, 0.80d, 1.24d); IAtom east = atom("O", 1, 1.63d, 0.42d); IAtom west = atom("H", 0, -0.02d, 0.42d); IBond[] bonds = new IBond[]{ new Bond(focus, north), new Bond(focus, west), new Bond(focus, east) }; ITetrahedralChirality element = FischerRecognition.newTetrahedralCenter(focus, bonds); Assert.assertNull(element); }
FischerRecognition recogniser = new FischerRecognition(m, graph, bondMap, Stereocenters.of(m)); List<IStereoElement> elements = recogniser.recognise(Collections.singleton(Projection.Fischer));
@Test public void createCenterWithFourNeighbors() { IAtom focus = atom("C", 0, 0.80d, 0.42d); IAtom north = atom("C", 0, 0.80d, 1.24d); IAtom east = atom("O", 1, 1.63d, 0.42d); IAtom south = atom("C", 2, 0.80d, -0.41d); IAtom west = atom("H", 0, -0.02d, 0.42d); IBond[] bonds = new IBond[]{ new Bond(focus, south), new Bond(focus, west), new Bond(focus, north), new Bond(focus, east) }; ITetrahedralChirality element = FischerRecognition.newTetrahedralCenter(focus, bonds); Assert.assertThat(element.getChiralAtom(), is(sameInstance(focus))); Assert.assertThat(element.getStereo(), is(ANTI_CLOCKWISE)); Assert.assertThat(element.getLigands()[0], is(sameInstance(north))); Assert.assertThat(element.getLigands()[1], is(sameInstance(east))); Assert.assertThat(element.getLigands()[2], is(sameInstance(south))); Assert.assertThat(element.getLigands()[3], is(sameInstance(west))); }
FischerRecognition recogniser = new FischerRecognition(m, graph, bondMap, Stereocenters.of(m)); Assert.assertTrue(recogniser.recognise(Collections.singleton(Projection.Fischer)).isEmpty());
@Test public void doNotCreateCenterWhenNorthIsMissing() { IAtom focus = atom("C", 0, 0.80d, 0.42d); IAtom east = atom("O", 1, 1.63d, 0.42d); IAtom south = atom("C", 2, 0.80d, -0.41d); IAtom west = atom("H", 0, -0.02d, 0.42d); IBond[] bonds = new IBond[]{ new Bond(focus, south), new Bond(focus, west), new Bond(focus, east) }; ITetrahedralChirality element = FischerRecognition.newTetrahedralCenter(focus, bonds); Assert.assertNull(element); }
FischerRecognition recogniser = new FischerRecognition(m, graph, bondMap, Stereocenters.of(m)); Assert.assertTrue(recogniser.recognise(Collections.singleton(Projection.Fischer)).isEmpty());
@Test public void doNotCreateCenterWhenWestIsOffCenter() { IAtom focus = atom("C", 0, 0.80d, 0.42d); IAtom north = atom("C", 0, 0.80d, 1.24d); IAtom east = atom("O", 1, 1.63d, 0.8d); IAtom south = atom("C", 2, 0.80d, -0.41d); IAtom west = atom("H", 0, -0.02d, 0.42d); IBond[] bonds = new IBond[]{ new Bond(focus, north), new Bond(focus, south), new Bond(focus, west), new Bond(focus, east) }; ITetrahedralChirality element = FischerRecognition.newTetrahedralCenter(focus, bonds); Assert.assertNull(element); }
@Test public void doNotCreateCenterWhenNorthIsOffCenter() { IAtom focus = atom("C", 0, 0.80d, 0.42d); IAtom north = atom("C", 0, 1d, 1.24d); IAtom east = atom("O", 1, 1.63d, 0.42d); IAtom south = atom("C", 2, 0.80d, -0.41d); IAtom west = atom("H", 0, -0.02d, 0.42d); IBond[] bonds = new IBond[]{ new Bond(focus, north), new Bond(focus, south), new Bond(focus, west), new Bond(focus, east) }; ITetrahedralChirality element = FischerRecognition.newTetrahedralCenter(focus, bonds); Assert.assertNull(element); }
@Test public void doNotCreateCenterWhenEastIsOffCenter() { IAtom focus = atom("C", 0, 0.80d, 0.42d); IAtom north = atom("C", 0, 0.80d, 1.24d); IAtom east = atom("O", 1, 1.63d, 0.8d); IAtom south = atom("C", 2, 0.80d, -0.41d); IAtom west = atom("H", 0, -0.02d, 0.42d); IBond[] bonds = new IBond[]{ new Bond(focus, north), new Bond(focus, south), new Bond(focus, west), new Bond(focus, east) }; ITetrahedralChirality element = FischerRecognition.newTetrahedralCenter(focus, bonds); Assert.assertNull(element); }