/// <summary> /// Obtain the chem objects (atoms and bonds) that have 'hit' in the target molecule. /// </summary> /// <example> /// <include file='IncludeExamples.xml' path='Comments/Codes[@id="NCDK.Isomorphisms.Mappings_Example.cs+ToChemObjects"]/*' /> /// </example> /// <returns>lazy iterable of chem objects</returns> public IEnumerable <IChemObject> ToChemObjects() { var mapper = new AtomBondMaper(query, target); foreach (var a in GetMapping(n => mapper.Apply(n)).Select(map => map.Values)) { foreach (var b in a) { yield return(b); } } yield break; }
/// <summary> /// Obtain the mapped substructures (atoms/bonds) of the target compound. The atoms /// and bonds are the same as in the target molecule but there may be less of them. /// </summary> /// <example> /// <include file='IncludeExamples.xml' path='Comments/Codes[@id="NCDK.Isomorphisms.Mappings_Example.cs+ToSubstructures"]/*' /> /// </example> /// <returns>lazy iterable of molecules</returns> public IEnumerable <IAtomContainer> ToSubstructures() { var mapper = new AtomBondMaper(query, target); return(GetMapping(n => mapper.Apply(n)).Select(map => { var submol = target.Builder.NewAtomContainer(); foreach (var atom in query.Atoms) { submol.Atoms.Add((IAtom)map[atom]); } foreach (var bond in query.Bonds) { submol.Bonds.Add((IBond)map[bond]); } return submol; })); }
/// <summary> /// Convert the permutations to an atom-atom bond-bond map. /// </summary> /// <example> /// <include file='IncludeExamples.xml' path='Comments/Codes[@id="NCDK.Isomorphisms.Mappings_Example.cs+ToAtomBondMap"]/*' /> /// </example> /// <returns>iterable of atom-atom and bond-bond mappings</returns> public IEnumerable <IReadOnlyDictionary <IChemObject, IChemObject> > ToAtomBondMaps() { var map = new AtomBondMaper(query, target); return(GetMapping(n => map.Apply(n))); }