Example #1
0
        public void TestCompareIdentity()
        {
            var ligand = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[0]);
            var rule   = new MassNumberRule();

            Assert.AreEqual(0, rule.Compare(ligand, ligand));
        }
Example #2
0
        public void TestCompare_Identity()
        {
            ILigand ligand = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[0]);
            ISequenceSubRule <ILigand> rule = new AtomicNumberRule();

            Assert.AreEqual(0, rule.Compare(ligand, ligand));
        }
Example #3
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);
        }
Example #4
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));
        }
Example #5
0
        public void TestImplicitHydrogen()
        {
            var ligand1 = new ImplicitHydrogenLigand(molecule, new VisitedAtoms(), molecule.Atoms[1]);
            var ligand2 = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[3]);
            var rule    = new MassNumberRule();

            Assert.AreEqual(-1, rule.Compare(ligand1, ligand2));
            Assert.AreEqual(1, rule.Compare(ligand2, ligand1));
        }
        public void TestCompare()
        {
            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 CombinedAtomicMassNumberRule();

            Assert.AreEqual(-1, rule.Compare(ligand1, ligand2));
            Assert.AreEqual(1, rule.Compare(ligand2, ligand1));
        }
Example #7
0
        public void TestImplicitHydrogen()
        {
            ILigand ligand1 = new ImplicitHydrogenLigand(molecule, new VisitedAtoms(), molecule.Atoms[1]);
            ILigand ligand2 = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[3]);
            ISequenceSubRule <ILigand> rule = new AtomicNumberRule();

            Assert.AreEqual(-1, rule.Compare(ligand1, ligand2));
            Assert.AreEqual(1, rule.Compare(ligand2, ligand1));
        }
Example #8
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));
        }
Example #9
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));
        }
        public void TestOrder()
        {
            var ligand1 = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[4]);
            var ligand2 = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[3]);
            var ligand3 = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[2]);
            var ligand4 = new Ligand(molecule, new VisitedAtoms(), molecule.Atoms[1], molecule.Atoms[0]);
            var ligands = new List <ILigand>
            {
                ligand1,
                ligand2,
                ligand3,
                ligand4
            };

            ligands.Sort(new CombinedAtomicMassNumberRule());
            Assert.AreEqual("H", ligands[0].LigandAtom.Symbol);
            Assert.AreEqual("C", ligands[1].LigandAtom.Symbol);
            Assert.AreEqual("C", ligands[2].LigandAtom.Symbol);
            Assert.AreEqual(13, ligands[2].LigandAtom.MassNumber.Value);
            Assert.AreEqual("Br", ligands[3].LigandAtom.Symbol);
        }
Example #11
0
        public void TestOrder()
        {
            VisitedAtoms   visitedAtoms = new VisitedAtoms();
            ILigand        ligand1      = new Ligand(molecule, visitedAtoms, molecule.Atoms[1], molecule.Atoms[4]);
            ILigand        ligand2      = new Ligand(molecule, visitedAtoms, molecule.Atoms[1], molecule.Atoms[3]);
            ILigand        ligand3      = new Ligand(molecule, visitedAtoms, molecule.Atoms[1], molecule.Atoms[2]);
            ILigand        ligand4      = new Ligand(molecule, visitedAtoms, molecule.Atoms[1], molecule.Atoms[0]);
            List <ILigand> ligands      = new List <ILigand>
            {
                ligand1,
                ligand2,
                ligand3,
                ligand4
            };

            ligands.Sort(new AtomicNumberRule());
            Assert.AreEqual("H", 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);
        }