// compute the invariants for the first atom in a SMILES string static SMARTSAtomInvariants InvariantOfFirstAtom(string smiles) { var container = sp.ParseSmiles(smiles); SMARTSAtomInvariants.ConfigureDaylightWithRingInfo(container); return(container.Atoms[0].GetProperty <SMARTSAtomInvariants>(SMARTSAtomInvariants.Key)); }
public void RingNumber_cyclophane() { var container = sp.ParseSmiles("C1CC23CCC11CCC4(CC1)CCC(CC2)(CC3)CC4"); SMARTSAtomInvariants.ConfigureDaylightWithRingInfo(container); int R1 = 0, R2 = 0, R3 = 0; foreach (var atom in container.Atoms) { SMARTSAtomInvariants inv = atom.GetProperty <SMARTSAtomInvariants>(SMARTSAtomInvariants.Key); switch (inv.RingNumber) { case 1: R1++; break; case 2: R2++; break; case 3: R3++; break; } } Assert.AreEqual(8, R1); Assert.AreEqual(8, R2); Assert.AreEqual(4, R3); }
public void TargetTest() { var container = sp.ParseSmiles("CCC"); SMARTSAtomInvariants.ConfigureDaylightWithRingInfo(container); foreach (var atom in container.Atoms) { Assert.AreEqual(container, (atom.GetProperty <SMARTSAtomInvariants>(SMARTSAtomInvariants.Key)).Target); } }
/// <summary> /// Do not use - temporary method until the SMARTS packages are cleaned up. /// </summary> /// <remarks> /// Prepares a target molecule for matching with SMARTS. /// </remarks> /// <param name="container">the container to initialise</param> /// <param name="ringQuery">whether the smarts will check ring size queries</param> public static void Prepare(IAtomContainer container, bool ringQuery) { if (ringQuery) { SMARTSAtomInvariants.ConfigureDaylightWithRingInfo(container); } else { SMARTSAtomInvariants.ConfigureDaylightWithoutRingInfo(container); } }
public void RingSize_cyclophane() { var container = sp.ParseSmiles("C1CC23CCC11CCC4(CC1)CCC(CC2)(CC3)CC4"); SMARTSAtomInvariants.ConfigureDaylightWithRingInfo(container); foreach (var atom in container.Atoms) { SMARTSAtomInvariants inv = atom.GetProperty <SMARTSAtomInvariants>(SMARTSAtomInvariants.Key); Assert.IsTrue(inv.RingSize.Contains(6)); Assert.IsFalse(inv.RingSize.Contains(12)); } }
public void RingSize_imidazole() { var container = sp.ParseSmiles("N1C=NC2=CC=CC=C12"); SMARTSAtomInvariants.ConfigureDaylightWithRingInfo(container); int ringSize5 = 0, ringSize6 = 0; foreach (var atom in container.Atoms) { SMARTSAtomInvariants inv = atom.GetProperty <SMARTSAtomInvariants>(SMARTSAtomInvariants.Key); if (inv.RingSize.Contains(5)) { ringSize5++; } if (inv.RingSize.Contains(6)) { ringSize6++; } } Assert.AreEqual(5, ringSize5); Assert.AreEqual(4, ringSize6); }