/// <summary> /// Filter the mappings for those which cover a unique set of bonds in the /// target. /// </summary> /// <returns>fluent-api instance</returns> /// <seealso cref="GetUniqueAtoms"/> public Mappings GetUniqueBonds() { // we need the unique predicate to be reset for each new iterator - // otherwise multiple iterations are always filtered (seen before) int[][] g = GraphUtil.ToAdjList(query); var m = new UniqueBondMatches(g); return(new Mappings(query, target, iterable.Where(n => m.Apply(n)))); }
public void UniqueBonds() { IAtomContainer query = Smi("C1CCC1"); IAtomContainer target = Smi("C12C3C1C23"); var mappings = VentoFoggia.CreateSubstructureFinder(query).MatchAll(target); // using unique atoms we may think we only found 1 mapping { var p = new UniqueAtomMatches(); Assert.AreEqual(1, mappings.Count(n => p.Apply(n))); } // when in fact we found 4 different mappings { var p = new UniqueBondMatches(GraphUtil.ToAdjList(query)); Assert.AreEqual(3, mappings.Count(n => p.Apply(n))); } }