Пример #1
0
        public void TestGetMonomerNamesInSequentialOrder()
        {
            PDBPolymer pdbPolymer = new PDBPolymer();

            Assert.AreEqual(0, pdbPolymer.GetMonomerNames().Count());

            IStrand oStrand1 = pdbPolymer.Builder.NewStrand();

            oStrand1.StrandName = "A";
            IMonomer oMono1 = pdbPolymer.Builder.NewMonomer();

            oMono1.MonomerName = "TRP279";
            IMonomer oMono2 = pdbPolymer.Builder.NewMonomer();

            oMono2.MonomerName = "CYS280";
            IPDBAtom oPDBAtom2 = pdbPolymer.Builder.NewPDBAtom("C");
            IPDBAtom oPDBAtom3 = pdbPolymer.Builder.NewPDBAtom("C");

            pdbPolymer.AddAtom(oPDBAtom2, oMono1, oStrand1);
            pdbPolymer.AddAtom(oPDBAtom3, oMono2, oStrand1);
            Assert.IsNotNull(pdbPolymer.Atoms[0]);
            Assert.IsNotNull(pdbPolymer.Atoms[1]);
            Assert.AreEqual(oPDBAtom2, pdbPolymer.Atoms[0]);
            Assert.AreEqual(oPDBAtom3, pdbPolymer.Atoms[1]);

            var monomers = pdbPolymer.GetMonomerNamesInSequentialOrder().GetEnumerator();

            monomers.MoveNext();
            Assert.AreEqual("TRP279", monomers.Current);
            monomers.MoveNext();
            Assert.AreEqual("CYS280", monomers.Current);
        }
Пример #2
0
        public void TestPDBPolymer()
        {
            IPDBPolymer pdbPolymer = new PDBPolymer();

            Assert.IsNotNull(pdbPolymer);
            Assert.AreEqual(pdbPolymer.GetMonomerMap().Count(), 0);

            IStrand oStrand1 = pdbPolymer.Builder.NewStrand();

            oStrand1.StrandName = "A";
            IStrand oStrand2 = pdbPolymer.Builder.NewStrand();

            oStrand2.StrandName = "B";
            IMonomer oMono1 = pdbPolymer.Builder.NewMonomer();

            oMono1.MonomerName = "TRP279";
            IMonomer oMono2 = pdbPolymer.Builder.NewMonomer();

            oMono2.MonomerName = "HOH";
            IMonomer oMono3 = pdbPolymer.Builder.NewMonomer();

            oMono3.MonomerName = "GLYA16";
            IPDBAtom oPDBAtom1 = pdbPolymer.Builder.NewPDBAtom("C");
            IPDBAtom oPDBAtom2 = pdbPolymer.Builder.NewPDBAtom("C");
            IPDBAtom oPDBAtom3 = pdbPolymer.Builder.NewPDBAtom("C");
            IPDBAtom oPDBAtom4 = pdbPolymer.Builder.NewPDBAtom("C");
            IPDBAtom oPDBAtom5 = pdbPolymer.Builder.NewPDBAtom("C");

            pdbPolymer.Atoms.Add(oPDBAtom1);
            pdbPolymer.AddAtom(oPDBAtom2, oStrand1);
            pdbPolymer.AddAtom(oPDBAtom3, oMono1, oStrand1);
            pdbPolymer.AddAtom(oPDBAtom4, oMono2, oStrand2);
            pdbPolymer.AddAtom(oPDBAtom5, oMono3, oStrand2);
            Assert.IsNotNull(pdbPolymer.Atoms[0]);
            Assert.IsNotNull(pdbPolymer.Atoms[1]);
            Assert.IsNotNull(pdbPolymer.Atoms[2]);
            Assert.IsNotNull(pdbPolymer.Atoms[3]);
            Assert.IsNotNull(pdbPolymer.Atoms[4]);
            Assert.AreEqual(oPDBAtom1, pdbPolymer.Atoms[0]);
            Assert.AreEqual(oPDBAtom2, pdbPolymer.Atoms[1]);
            Assert.AreEqual(oPDBAtom3, pdbPolymer.Atoms[2]);
            Assert.AreEqual(oPDBAtom4, pdbPolymer.Atoms[3]);
            Assert.AreEqual(oPDBAtom5, pdbPolymer.Atoms[4]);

            Assert.IsNull(pdbPolymer.GetMonomer("0815", "A"));
            Assert.IsNull(pdbPolymer.GetMonomer("0815", "B"));
            Assert.IsNull(pdbPolymer.GetMonomer("0815", ""));
            Assert.IsNull(pdbPolymer.GetStrand(""));
            Assert.IsNotNull(pdbPolymer.GetMonomer("TRP279", "A"));
            Assert.AreEqual(oMono1, pdbPolymer.GetMonomer("TRP279", "A"));
            Assert.AreEqual(pdbPolymer.GetMonomer("TRP279", "A").Atoms.Count, 1);
            Assert.IsNotNull(pdbPolymer.GetMonomer("HOH", "B"));
            Assert.AreEqual(oMono2, pdbPolymer.GetMonomer("HOH", "B"));
            Assert.AreEqual(pdbPolymer.GetMonomer("HOH", "B").Atoms.Count, 1);
            Assert.AreEqual(pdbPolymer.GetStrand("B").Atoms.Count, 2);
            Assert.AreEqual(pdbPolymer.GetStrand("B").GetMonomerMap().Count(), 2);
            Assert.IsNull(pdbPolymer.GetStrand("C"));
            Assert.IsNotNull(pdbPolymer.GetStrand("B"));
        }