Example #1
0
        public override void TestGetMonomerCount()
        {
            IPDBPolymer pdbPolymer = (IPDBPolymer)NewChemObject();

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

            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";
            IPDBAtom oPDBAtom1 = pdbPolymer.Builder.NewPDBAtom("C");
            IPDBAtom oPDBAtom2 = pdbPolymer.Builder.NewPDBAtom("C");
            IPDBAtom oPDBAtom3 = pdbPolymer.Builder.NewPDBAtom("C");

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

            Assert.AreEqual(2, pdbPolymer.GetMonomerMap().Count());
        }
Example #2
0
        private CMLMolecule CDKPDBPolymerToCMLMolecule(IPDBPolymer pdbPolymer, bool setIDs)
        {
            var cmlMolecule = new CMLMolecule
            {
                Convention = "PDB",
                DictRef    = "pdb:model"
            };

            var mapS = pdbPolymer.GetStrandMap();

            foreach (var key in mapS.Keys)
            {
                var strand       = mapS[key];
                var monomerNames = new List <string>(strand.GetMonomerNames());
                monomerNames.Sort();
                foreach (var name in monomerNames)
                {
                    IMonomer    monomer = strand.GetMonomer(name);
                    CMLMolecule clmono  = CDKMonomerToCMLMolecule(monomer, true);
                    cmlMolecule.Add(clmono);
                }
            }

            return(cmlMolecule);
        }
Example #3
0
        public void TestNewPDBPolymer()
        {
            IChemObjectBuilder builder = RootObject.Builder;
            IPDBPolymer        polymer = builder.NewPDBPolymer();

            Assert.IsNotNull(polymer);
        }
Example #4
0
        public override void TestClone()
        {
            IPDBPolymer polymer = (IPDBPolymer)NewChemObject();
            object      clone   = polymer.Clone();

            Assert.IsTrue(clone is IBioPolymer);
        }
Example #5
0
        public override void TestGetStrands()
        {
            IPDBPolymer pdbPolymer = (IPDBPolymer)NewChemObject();
            IStrand     oStrand1   = pdbPolymer.Builder.NewStrand();
            IStrand     oStrand2   = pdbPolymer.Builder.NewStrand();

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

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

            oMono2.MonomerName = "GLY123";
            IPDBAtom oPDBAtom1 = pdbPolymer.Builder.NewPDBAtom("C");
            IPDBAtom oPDBAtom2 = pdbPolymer.Builder.NewPDBAtom("C");

            pdbPolymer.AddAtom(oPDBAtom1, oMono1, oStrand1);
            pdbPolymer.AddAtom(oPDBAtom2, oMono2, oStrand2);
            IDictionary <string, IStrand> strands = new Dictionary <string, IStrand>
            {
                { "A", oStrand1 },
                { "B", oStrand2 }
            };

            Assert.IsTrue(Compares.AreDeepEqual(strands, pdbPolymer.GetStrandMap()));
        }
Example #6
0
        public override void TestGetMonomer_String_String()
        {
            IPDBPolymer pdbPolymer = (IPDBPolymer)NewChemObject();

            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";
            IPDBAtom oPDBAtom1 = pdbPolymer.Builder.NewPDBAtom("C");
            IPDBAtom oPDBAtom2 = pdbPolymer.Builder.NewPDBAtom("C");
            IPDBAtom oPDBAtom3 = pdbPolymer.Builder.NewPDBAtom("C");

            pdbPolymer.AddAtom(oPDBAtom1, oMono1, oStrand1);
            pdbPolymer.AddAtom(oPDBAtom2, oMono1, oStrand1);
            pdbPolymer.AddAtom(oPDBAtom3, oMono2, oStrand2);

            Assert.AreEqual(oMono1, pdbPolymer.GetMonomer("TRP279", "A"));
            Assert.AreEqual(oMono2, pdbPolymer.GetMonomer("HOH", "B"));
        }
Example #7
0
        public virtual void TestAddStructure_IPDBStructure()
        {
            IPDBPolymer   pdbPolymer = (IPDBPolymer)NewChemObject();
            IPDBStructure structure  = pdbPolymer.Builder.NewPDBStructure();

            pdbPolymer.Add(structure);
            Assert.AreEqual(1, pdbPolymer.GetStructures().Count());
        }
Example #8
0
        public override void TestToString()
        {
            IPDBPolymer pdbPolymer  = (IPDBPolymer)NewChemObject();
            string      description = pdbPolymer.ToString();

            for (int i = 0; i < description.Length; i++)
            {
                Assert.IsTrue('\n' != description[i]);
                Assert.IsTrue('\r' != description[i]);
            }
        }
Example #9
0
        public virtual void TestAddAtom_IPDBAtom()
        {
            IPDBPolymer pdbPolymer = (IPDBPolymer)NewChemObject();

            IPDBAtom oPDBAtom1 = pdbPolymer.Builder.NewPDBAtom("C");
            IPDBAtom oPDBAtom2 = pdbPolymer.Builder.NewPDBAtom("C");

            pdbPolymer.Add(oPDBAtom1);
            pdbPolymer.Add(oPDBAtom2);

            Assert.AreEqual(2, pdbPolymer.Atoms.Count);
        }
Example #10
0
        public override void TestGetStrand_String()
        {
            IPDBPolymer pdbPolymer = (IPDBPolymer)NewChemObject();
            IStrand     oStrand1   = pdbPolymer.Builder.NewStrand();

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

            oMono1.MonomerName = "TRP279";
            IPDBAtom oPDBAtom1 = pdbPolymer.Builder.NewPDBAtom("C");

            pdbPolymer.AddAtom(oPDBAtom1, oMono1, oStrand1);

            Assert.AreEqual(oStrand1, pdbPolymer.GetStrand("A"));
        }
Example #11
0
        public virtual void TestAddAtom_IPDBAtom_IMonomer()
        {
            IPDBPolymer pdbPolymer = (IPDBPolymer)NewChemObject();
            IPDBMonomer oMono1     = pdbPolymer.Builder.NewPDBMonomer();

            oMono1.MonomerName = "TRP279";
            IStrand oStrand1 = pdbPolymer.Builder.NewStrand();

            oStrand1.StrandName = "A";
            IPDBAtom oPDBAtom1 = pdbPolymer.Builder.NewPDBAtom("C");

            pdbPolymer.AddAtom(oPDBAtom1, oMono1, oStrand1);

            Assert.AreEqual(1, pdbPolymer.GetMonomer("TRP279", "A").Atoms.Count);
        }
Example #12
0
        public override void TestRemoveStrand_String()
        {
            IPDBPolymer pdbPolymer = (IPDBPolymer)NewChemObject();
            IStrand     oStrand1   = pdbPolymer.Builder.NewStrand();

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

            oMono1.MonomerName = "TRP279";
            IPDBAtom oPDBAtom1 = pdbPolymer.Builder.NewPDBAtom("C");

            pdbPolymer.AddAtom(oPDBAtom1, oMono1, oStrand1);

            Assert.IsTrue(pdbPolymer.GetStrandNames().Contains(oStrand1.StrandName));
            Assert.AreEqual(1, pdbPolymer.Atoms.Count);
            pdbPolymer.RemoveStrand("A");
            Assert.IsFalse(pdbPolymer.GetStrandNames().Contains(oStrand1.StrandName));
            Assert.AreEqual(0, pdbPolymer.Atoms.Count);
        }
Example #13
0
 public CMLMolecule CDKPDBPolymerToCMLMolecule(IPDBPolymer pdbPolymer)
 {
     return(CDKPDBPolymerToCMLMolecule(pdbPolymer, true));
 }