Beispiel #1
0
        public override void TestGetMonomerCount()
        {
            IBioPolymer oBioPolymer = (IBioPolymer)NewChemObject();

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

            IStrand oStrand1 = oBioPolymer.Builder.NewStrand();

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

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

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

            oMono2.MonomerName = "HOH";
            IAtom oAtom1 = oBioPolymer.Builder.NewAtom("C");
            IAtom oAtom2 = oBioPolymer.Builder.NewAtom("C");
            IAtom oAtom3 = oBioPolymer.Builder.NewAtom("C");

            oBioPolymer.Atoms.Add(oAtom1);
            oBioPolymer.AddAtom(oAtom2, oMono1, oStrand1);
            oBioPolymer.AddAtom(oAtom3, oMono2, oStrand2);
            Assert.IsNotNull(oBioPolymer.Atoms[0]);
            Assert.IsNotNull(oBioPolymer.Atoms[1]);
            Assert.IsNotNull(oBioPolymer.Atoms[2]);
            Assert.AreEqual(oAtom1, oBioPolymer.Atoms[0]);
            Assert.AreEqual(oAtom2, oBioPolymer.Atoms[1]);
            Assert.AreEqual(oAtom3, oBioPolymer.Atoms[2]);

            Assert.AreEqual(2, oBioPolymer.GetMonomerMap().Count());
        }
Beispiel #2
0
        public virtual void TestGetStrands()
        {
            IBioPolymer oBioPolymer = (IBioPolymer)NewChemObject();
            IStrand     oStrand1    = oBioPolymer.Builder.NewStrand();
            IStrand     oStrand2    = oBioPolymer.Builder.NewStrand();

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

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

            oMono2.MonomerName = "GLY123";
            IAtom oAtom1 = oBioPolymer.Builder.NewAtom("C");
            IAtom oAtom2 = oBioPolymer.Builder.NewAtom("C");

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

            Assert.IsTrue(Compares.AreDeepEqual(strands, oBioPolymer.GetStrandMap()));
        }
Beispiel #3
0
        public virtual void TestGetMonomer_String_String()
        {
            IBioPolymer oBioPolymer = (IBioPolymer)NewChemObject();

            IStrand oStrand1 = oBioPolymer.Builder.NewStrand();

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

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

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

            oMono2.MonomerName = "HOH";
            IAtom oAtom1 = oBioPolymer.Builder.NewAtom("C");
            IAtom oAtom2 = oBioPolymer.Builder.NewAtom("C");
            IAtom oAtom3 = oBioPolymer.Builder.NewAtom("C");

            oBioPolymer.AddAtom(oAtom1, oMono1, oStrand1);
            oBioPolymer.AddAtom(oAtom2, oMono1, oStrand1);
            oBioPolymer.AddAtom(oAtom3, oMono2, oStrand2);

            Assert.AreEqual(oMono1, oBioPolymer.GetMonomer("TRP279", "A"));
            Assert.AreEqual(oMono2, oBioPolymer.GetMonomer("HOH", "B"));
        }
Beispiel #4
0
        public virtual void TestAddAtom_IAtom_IMonomer_IStrand()
        {
            IBioPolymer oBioPolymer = (IBioPolymer)NewChemObject();
            IStrand     oStrand1    = oBioPolymer.Builder.NewStrand();

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

            oMono1.MonomerName = "TRP279";
            IAtom oAtom1 = oBioPolymer.Builder.NewAtom("C");
            IAtom oAtom2 = oBioPolymer.Builder.NewAtom("C");

            oBioPolymer.AddAtom(oAtom1, oMono1, oStrand1);
            oBioPolymer.AddAtom(oAtom2, oMono1, oStrand1);
            oBioPolymer.AddAtom(oAtom1, null, oStrand1);

            Assert.AreEqual(2, oBioPolymer.GetMonomer("TRP279", "A").Atoms.Count);
            Assert.AreEqual(0, oBioPolymer.GetMonomer("", "A").Atoms.Count);
        }
Beispiel #5
0
 private static IBioPolymer AddAminoAcid(IBioPolymer protein, IAminoAcid aaToAdd, IStrand strand)
 {
     foreach (var atom in aaToAdd.Atoms)
     {
         protein.AddAtom(atom, aaToAdd, strand);
     }
     foreach (var bond in aaToAdd.Bonds)
     {
         protein.Bonds.Add(bond);
     }
     return(protein);
 }
Beispiel #6
0
        public virtual void TestGetStrand_String()
        {
            IBioPolymer oBioPolymer = (IBioPolymer)NewChemObject();
            IStrand     oStrand1    = oBioPolymer.Builder.NewStrand();

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

            oMono1.MonomerName = "TRP279";
            IAtom oAtom1 = oBioPolymer.Builder.NewAtom("C");

            oBioPolymer.AddAtom(oAtom1, oMono1, oStrand1);

            Assert.AreEqual(oStrand1, oBioPolymer.GetStrand("A"));
        }
Beispiel #7
0
        public virtual void TestRemoveStrand_String()
        {
            IBioPolymer oBioPolymer = (IBioPolymer)NewChemObject();
            IStrand     oStrand1    = oBioPolymer.Builder.NewStrand();

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

            oMono1.MonomerName = "TRP279";
            IAtom oAtom1 = oBioPolymer.Builder.NewAtom("C");

            oBioPolymer.AddAtom(oAtom1, oMono1, oStrand1);

            Assert.IsTrue(oBioPolymer.GetStrandNames().Contains(oStrand1.StrandName));
            Assert.AreEqual(1, oBioPolymer.Atoms.Count);
            oBioPolymer.RemoveStrand("A");
            Assert.IsFalse(oBioPolymer.GetStrandNames().Contains(oStrand1.StrandName));
            Assert.AreEqual(0, oBioPolymer.Atoms.Count);
        }