예제 #1
0
        public void ProlineNamedCorrectly()
        {
            var aminoAcidReference = AminoAcidLibrary.Proline(1);

            PdbAminoAcidAtomNamer.AssignNames(aminoAcidReference);

            var moleculeStructure = aminoAcidReference.Molecule.MoleculeStructure;
            var nitrogen          = moleculeStructure.GetVertexFromId(aminoAcidReference.FirstAtomId).Object;

            Assume.That(nitrogen.Element, Is.EqualTo(ElementName.Nitrogen));
            Assert.That(nitrogen.AminoAcidAtomName, Is.EqualTo("N"));

            var carbonEnd = moleculeStructure.GetVertexFromId(aminoAcidReference.LastAtomId).Object;

            Assume.That(carbonEnd.Element, Is.EqualTo(ElementName.Carbon));
            Assert.That(carbonEnd.AminoAcidAtomName, Is.EqualTo("C"));

            var remainingNonHydrogenAtoms = moleculeStructure.Vertices
                                            .Select(v => v.Object)
                                            .Where(atom => atom.Element != ElementName.Hydrogen)
                                            .Except(new[] { nitrogen, carbonEnd })
                                            .ToList();

            Assert.That(remainingNonHydrogenAtoms.Count, Is.EqualTo(5));
            var oxygen = remainingNonHydrogenAtoms.Single(atom => atom.Element == ElementName.Oxygen);

            Assert.That(oxygen.AminoAcidAtomName, Is.EqualTo("O"));

            var sideChainCarbons = remainingNonHydrogenAtoms.Where(atom => atom.Element == ElementName.Carbon).ToList();

            Assert.That(sideChainCarbons.Count, Is.EqualTo(4));
            Assert.That(sideChainCarbons.Select(atom => atom.AminoAcidAtomName), Is.EquivalentTo(new[] { "CA", "CB", "CG", "CD" }));
        }
예제 #2
0
        public void TestMasses()
        {
            var newlibrary1 = new AminoAcidLibrary();
            //Dictionary<string, Compound> dictionaryIn1 = newlibrary1.LoadLibrary();
            //foreach (KeyValuePair<string, Compound> matterObject in dictionaryIn1)
            //{
            //    totalMass += matterObject.Value.MassMonoIsotopic;
            //    textM = matterObject.Value.MassMonoIsotopic.ToString() + "," + matterObject.Value.Symbol.ToString() + "," + matterObject.Value.Name.ToString() + Environment.NewLine;
            //    //Console.Write(textM);
            //}

            //Assert.AreEqual(totalMass, 2475.1616262881598);

            var newlibrary2 = new CrossRingLibrary();
            //Dictionary<string, Compound> dictionaryIn2 = newlibrary2.LoadLibrary();
            //foreach (KeyValuePair<string, Compound> matterObject in dictionaryIn2)
            //{
            //    totalMass += matterObject.Value.MassMonoIsotopic;
            //    textM = matterObject.Value.MassMonoIsotopic.ToString() + "," + matterObject.Value.Symbol.ToString() + "," + matterObject.Value.Name.ToString() + Environment.NewLine;
            //    //Console.Write(textM);
            //}

            //Assert.AreEqual(totalMass, 1432.3950300356437);

            var newlibrary3 = new ElementLibrary();
            //Dictionary<string, Element> dictionaryIn3 = newlibrary3.LoadLibrary();
            //foreach (KeyValuePair<string, Element> matterObject in dictionaryIn3)
            //{
            //    totalMass += matterObject.Value.MassMonoIsotopic;
            //    textM = matterObject.Value.MassMonoIsotopic.ToString() + "," + matterObject.Value.Symbol.ToString() + "," + matterObject.Value.Name.ToString() + Environment.NewLine;
            //    //Console.Write(textM);
            //}

            //Assert.AreEqual(totalMass, 12899.589616552506);

            var newlibrary4 = new MiscellaneousMatterLibrary();
            //Dictionary<string, Compound> dictionaryIn4 = newlibrary4.LoadLibrary();
            //foreach (KeyValuePair<string, Compound> matterObject in dictionaryIn4)
            //{
            //    totalMass += matterObject.Value.MassMonoIsotopic;
            //    textM = matterObject.Value.MassMonoIsotopic.ToString() + "," + matterObject.Value.Symbol.ToString() + "," + matterObject.Value.Name.ToString() + Environment.NewLine;
            //    //Console.Write(textM);
            //}

            //Assert.AreEqual(totalMass, 295.99644294548898);

            var newlibrary5 = new MonosaccharideLibrary();
            //Dictionary<string, Compound> dictionaryIn5 = newlibrary5.LoadLibrary();
            //foreach (KeyValuePair<string, Compound> matterObject in dictionaryIn5)
            //{
            //    totalMass += matterObject.Value.MassMonoIsotopic;
            //    textM = matterObject.Value.MassMonoIsotopic.ToString() + "," + matterObject.Value.Symbol.ToString() + "," + matterObject.Value.Name.ToString() + Environment.NewLine;
            //    //Console.Write(textM);
            //}

            //Assert.AreEqual(totalMass, 1687.5704282280092);

            var newlibrary6 = new SubAtomicParticleLibrary();
            //Dictionary<string, SubAtomicParticle> dictionaryIn6 = newlibrary6.LoadLibrary();
            //foreach (KeyValuePair<string, SubAtomicParticle> matterObject in dictionaryIn6)
            //{
            //    totalMass += matterObject.Value.MassMonoIsotopic;
            //    textM = matterObject.Value.MassMonoIsotopic.ToString() + "," + matterObject.Value.Symbol.ToString() + "," + matterObject.Value.Name.ToString() + Environment.NewLine;
            //    //Console.Write(textM);
            //}

            //Assert.AreEqual(totalMass, 2.0164899626494304);
        }