public void TestFindMatchingAtomType_IAtomContainer_IAtom() { var matcher = SybylAtomTypeMatcher.GetInstance(); Assert.IsNotNull(matcher); var ethane = TestMoleculeFactory.MakeAlkane(2); var expectedTypes = new[] { "C.3", "C.3" }; AssertAtomTypes(testedAtomTypes, expectedTypes, ethane); }
public void TestNonExistingType() { var mol = builder.NewAtomContainer(); var atom = builder.NewAtom(); mol.Atoms.Add(atom); var matcher = SybylAtomTypeMatcher.GetInstance(); var type = matcher.FindMatchingAtomType(mol, atom); Assert.IsNotNull(type); Assert.AreEqual("X", type.AtomTypeName); }
public void TestAdenine() { var mol = TestMoleculeFactory.MakeAdenine(); var expectedTypes = new[] { "C.ar", "C.ar", "C.ar", "N.ar", "N.ar", "N.ar", "N.ar", "N.3", "C.ar", "C.ar" }; var matcher = SybylAtomTypeMatcher.GetInstance(); var types = matcher.FindMatchingAtomTypes(mol).ToReadOnlyList(); for (int i = 0; i < expectedTypes.Length; i++) { AssertAtomType(testedAtomTypes, $"Incorrect perception for atom {i}", expectedTypes[i], types[i]); } }
public void TestBenzene_AtomContainer() { var benzene = TestMoleculeFactory.MakeBenzene(); // test if the perceived atom types match that var matcher = SybylAtomTypeMatcher.GetInstance(); var types = matcher.FindMatchingAtomTypes(benzene); foreach (var type in types) { Assert.AreEqual("C.ar", type.AtomTypeName); } }
private static void PercieveAtomTypesAndConfigureAtoms(IAtomContainer container) { var matcher = SybylAtomTypeMatcher.GetInstance(); var atoms = container.Atoms.GetEnumerator(); while (atoms.MoveNext()) { var atom = atoms.Current; atom.AtomTypeName = null; var matched = matcher.FindMatchingAtomType(container, atom); if (matched != null) { AtomTypeManipulator.Configure(atom, matched); } } }
public void TestFindMatchingAtomType_IAtomContainer() { var filename = "NCDK.Data.Mol2.atomtyping.mol2"; var ins = ResourceLoader.GetAsStream(filename); var reader = new Mol2Reader(ins); var mol = reader.Read(builder.NewAtomContainer()); // just check consistency; other methods do perception testing var matcher = SybylAtomTypeMatcher.GetInstance(); var types = matcher.FindMatchingAtomTypes(mol).ToReadOnlyList(); for (int i = 0; i < types.Count; i++) { IAtomType type = matcher.FindMatchingAtomType(mol, mol.Atoms[i]); Assert.AreEqual(type.AtomTypeName, types[i].AtomTypeName); } }
public void TestAniline() { var benzene = TestMoleculeFactory.MakeBenzene(); var nitrogen = benzene.Builder.NewAtom("N"); benzene.Atoms.Add(nitrogen); benzene.Bonds.Add(benzene.Builder.NewBond(benzene.Atoms[0], nitrogen, BondOrder.Single)); // test if the perceived atom types match that var matcher = SybylAtomTypeMatcher.GetInstance(); var types = matcher.FindMatchingAtomTypes(benzene).ToReadOnlyList(); for (int i = 0; i < 6; i++) { AssertAtomType(testedAtomTypes, "Incorrect perception for atom " + i, "C.ar", types[i]); } AssertAtomType(testedAtomTypes, "Incorrect perception for atom " + 6, "N.3", types[6]); }
public override IAtomTypeMatcher GetAtomTypeMatcher(IChemObjectBuilder builder) { return(SybylAtomTypeMatcher.GetInstance()); }
public void TestGetInstance_IChemObjectBuilder() { var matcher = SybylAtomTypeMatcher.GetInstance(); Assert.IsNotNull(matcher); }