예제 #1
0
        public void TestCBrIFCl()
        {
            var molecule = smiles.ParseSmiles("FC(Br)(Cl)I");
            var ligandF  = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[0]);
            var ligandBr = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[2]);
            var ligandCl = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[3]);
            var ligandI  = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[4]);
            var rule     = new CIPLigandRule();

            Assert.AreEqual(-1, rule.Compare(ligandF, ligandI));
            Assert.AreEqual(-1, rule.Compare(ligandF, ligandBr));
            Assert.AreEqual(-1, rule.Compare(ligandF, ligandCl));
            Assert.AreEqual(-1, rule.Compare(ligandCl, ligandI));
            Assert.AreEqual(-1, rule.Compare(ligandCl, ligandBr));
            Assert.AreEqual(-1, rule.Compare(ligandBr, ligandI));

            var ligands = new List <ILigand>
            {
                ligandI,
                ligandBr,
                ligandF,
                ligandCl
            };

            ligands.Sort(new CIPLigandRule());

            Assert.AreEqual("F", ligands[0].LigandAtom.Symbol);
            Assert.AreEqual("Cl", ligands[1].LigandAtom.Symbol);
            Assert.AreEqual("Br", ligands[2].LigandAtom.Symbol);
            Assert.AreEqual("I", ligands[3].LigandAtom.Symbol);
        }
예제 #2
0
        public void TestCompareIdentity()
        {
            var molecule = smiles.ParseSmiles("CC(Br)([13C])[H]");
            var ligand   = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[0]);
            var rule     = new CIPLigandRule();

            Assert.AreEqual(0, rule.Compare(ligand, ligand));
        }
예제 #3
0
        public void TestCompare()
        {
            var molecule = smiles.ParseSmiles("CC(Br)([13C])[H]");
            var ligand1  = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[0]);
            var ligand2  = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[2]);
            var rule     = new CIPLigandRule();

            Assert.AreEqual(-1, rule.Compare(ligand1, ligand2));
            Assert.AreEqual(1, rule.Compare(ligand2, ligand1));
        }
예제 #4
0
        public void TestImplicitHydrogenSame()
        {
            var molecule = smiles.ParseSmiles("CC(Br)([13C])[H]");
            var ligand1  = new ImplicitHydrogenLigand(molecule, new VisitedAtoms(), molecule.Atoms[1]);
            var ligand2  = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[4]);
            var rule     = new CIPLigandRule();

            Assert.AreEqual(0, rule.Compare(ligand1, ligand2));
            Assert.AreEqual(0, rule.Compare(ligand2, ligand1));
        }
예제 #5
0
        public void TestDeepRecursion()
        {
            var molecule = smiles.ParseSmiles("CC([H])(CCCCCCCCCC)CCCCCCCCC");
            var ligand1  = CIPTool.DefineLigand(molecule, new VisitedAtoms(), 1, 3);
            var ligand2  = CIPTool.DefineLigand(molecule, new VisitedAtoms(), 1, 13);
            var rule     = new CIPLigandRule();

            Assert.AreEqual(1, rule.Compare(ligand1, ligand2));
            Assert.AreEqual(-1, rule.Compare(ligand2, ligand1));
        }
예제 #6
0
        public void TestTwoVersusDoubleBondedOxygen()
        {
            var molecule = smiles.ParseSmiles("OC(O)C([H])(C)C=O");
            var ligand1  = CIPTool.DefineLigand(molecule, new VisitedAtoms(), 3, 1);
            var ligand2  = CIPTool.DefineLigand(molecule, new VisitedAtoms(), 3, 6);
            var rule     = new CIPLigandRule();

            Assert.AreEqual(-1, rule.Compare(ligand1, ligand2));
            Assert.AreEqual(1, rule.Compare(ligand2, ligand1));
        }
예제 #7
0
        public void TestSideChainsRecursive()
        {
            var molecule = smiles.ParseSmiles("CCCC([H])(C)CC");
            var ligand1  = CIPTool.DefineLigand(molecule, new VisitedAtoms(), 3, 6);
            var ligand2  = CIPTool.DefineLigand(molecule, new VisitedAtoms(), 3, 1);
            var rule     = new CIPLigandRule();

            Assert.AreEqual(-1, rule.Compare(ligand1, ligand2));
            Assert.AreEqual(1, rule.Compare(ligand2, ligand1));
        }