예제 #1
0
        [TestMethod(), Ignore()] // moved to SMILES2Mol2WriterTest
        public void TestWriter1()
        {
            IAtomContainer molecule = new Mock <IAtomContainer>().Object;

            StringWriter swriter = new StringWriter();
            Mol2Writer   writer  = new Mol2Writer(swriter);

            writer.Write(molecule);
            writer.Close();
            Assert.IsTrue(swriter.ToString().IndexOf("1 C1 0.000 0.000 0.000 C.3") > 0);
            Assert.IsTrue(swriter.ToString().IndexOf("1 2 1 1") > 0);
        }
예제 #2
0
        public void TestWriter1()
        {
            var sp       = CDK.SmilesParser;
            var molecule = sp.ParseSmiles("C([H])([H])([H])([H])");

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(molecule);

            StringWriter swriter = new StringWriter();
            Mol2Writer   writer  = new Mol2Writer(swriter);

            writer.Write(molecule);
            writer.Close();
            Assert.IsTrue(swriter.ToString().IndexOf("1 C1 0.000 0.000 0.000 C.3") > 0);
            Assert.IsTrue(swriter.ToString().IndexOf("1 1 2 1") > 0);
        }
예제 #3
0
        [TestMethod(), Ignore()] // moved to SMILES2Mol2WriterTest
        public void TestWriter2()
        {
            IAtomContainer molecule = new Mock <IAtomContainer>().Object;

            Aromaticity.CDKLegacy.Apply(molecule);

            StringWriter swriter = new StringWriter();
            Mol2Writer   writer  = new Mol2Writer(swriter);

            writer.Write(molecule);
            writer.Close();

            Assert.IsTrue(swriter.ToString().IndexOf("1 C1 0.000 0.000 0.000 C.ar") > 0, "Aromatic atom not properly reported");
            Assert.IsTrue(swriter.ToString().IndexOf("8 O8 0.000 0.000 0.000 O.2") > 0);
            Assert.IsTrue(swriter.ToString().IndexOf("7 C7 0.000 0.000 0.000 C.2") > 0);
            Assert.IsTrue(swriter.ToString().IndexOf("1 2 1 ar") > 0, "Aromatic bond not properly reported");
            Assert.IsTrue(swriter.ToString().IndexOf("8 8 7 2") > 0);
        }
예제 #4
0
        [TestMethod(), Ignore()] // moved to SMILES2Mol2WriterTest
        public void TestWriterForAmide()
        {
            IAtomContainer molecule = new Mock <IAtomContainer>().Object;

            Aromaticity.CDKLegacy.Apply(molecule);

            StringWriter swriter = new StringWriter();
            Mol2Writer   writer  = new Mol2Writer(swriter);

            writer.Write(molecule);
            writer.Close();

            Assert.IsTrue(swriter.ToString().IndexOf("1 C1 0.000 0.000 0.000 C.3") > 0);
            Assert.IsTrue(swriter.ToString().IndexOf("3 O3 0.000 0.000 0.000 O.") > 0);
            Assert.IsTrue(swriter.ToString().IndexOf("4 N4 0.000 0.000 0.000 N.a") > 0);
            Assert.IsTrue(swriter.ToString().IndexOf("1 2 1 1") > 0);
            Assert.IsTrue(swriter.ToString().IndexOf("3 4 2 am") > 0, "Amide bond not properly reported");
            Assert.IsTrue(swriter.ToString().IndexOf("4 5 4 1") > 0);
        }
예제 #5
0
        public void TestWriterForAmide()
        {
            var sp       = CDK.SmilesParser;
            var molecule = sp.ParseSmiles("CC(=O)NC");

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(molecule);

            StringWriter swriter = new StringWriter();
            Mol2Writer   writer  = new Mol2Writer(swriter);

            writer.Write(molecule);
            writer.Close();

            Assert.IsTrue(swriter.ToString().IndexOf("1 C1 0.000 0.000 0.000 C.3") > 0);
            Assert.IsTrue(swriter.ToString().IndexOf("3 O3 0.000 0.000 0.000 O.") > 0);
            Assert.IsTrue(swriter.ToString().IndexOf("4 N4 0.000 0.000 0.000 N.a") > 0);
            Assert.IsTrue(swriter.ToString().IndexOf("1 1 2 1") > 0);
            Assert.IsTrue(swriter.ToString().IndexOf("3 2 4 am") > 0, "Amide bond not properly reported");
            Assert.IsTrue(swriter.ToString().IndexOf("4 4 5 1") > 0);
        }
예제 #6
0
        public void TestWriter2()
        {
            var sp       = CDK.SmilesParser;
            var molecule = sp.ParseSmiles("c1ccccc1C=O");

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(molecule);
            Aromaticity.CDKLegacy.Apply(molecule);

            StringWriter swriter = new StringWriter();
            Mol2Writer   writer  = new Mol2Writer(swriter);

            writer.Write(molecule);
            writer.Close();

            Assert.IsTrue(swriter.ToString().IndexOf("1 C1 0.000 0.000 0.000 C.ar") > 0, "Aromatic atom not properly reported");
            Assert.IsTrue(swriter.ToString().IndexOf("8 O8 0.000 0.000 0.000 O.2") > 0);
            Assert.IsTrue(swriter.ToString().IndexOf("7 C7 0.000 0.000 0.000 C.2") > 0);
            Assert.IsTrue(swriter.ToString().IndexOf("1 1 2 ar") > 0, "Aromatic bond not properly reported");
            Assert.IsTrue(swriter.ToString().IndexOf("8 7 8 2") > 0);
        }
예제 #7
0
        public void TestMissingAtomType()
        {
            var       filename     = "NCDK.Data.MDL.ligand-1a0i.sdf";
            var       ins          = ResourceLoader.GetAsStream(filename);
            var       reader       = new MDLV2000Reader(ins);
            IChemFile fileContents = (IChemFile)reader.Read(builder.NewChemFile());

            reader.Close();
            var            molecules = ChemFileManipulator.GetAllAtomContainers(fileContents).ToReadOnlyList();
            IAtomContainer mol       = molecules[0];

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol);
            Aromaticity.CDKLegacy.Apply(mol);

            StringWriter writer    = new StringWriter();
            Mol2Writer   molwriter = new Mol2Writer(writer);

            molwriter.Write(mol);
            molwriter.Close();

            string mol2file = writer.ToString();

            Assert.IsTrue(mol2file.Contains("-1.209 -18.043 49.44 X") || mol2file.Contains("-1.209 -18.043 49.440 X"));
        }
예제 #8
0
        public void TestAccepts()
        {
            Mol2Writer writer = new Mol2Writer(new StringWriter());

            Assert.IsTrue(writer.Accepts(typeof(AtomContainer)));
        }