Пример #1
0
        public void ValidateCompoundNucleotideToAminoAcid()
        {
            ISequenceItem        seqItem1    = new Sequence(Alphabets.Protein, "KIET")[0];
            ISequenceItem        seqItem2    = new Sequence(Alphabets.DNA, "AGC")[0];
            List <ISequenceItem> seqItemList = new List <ISequenceItem>();

            seqItemList.Add(seqItem1);
            seqItemList.Add(seqItem2);
            double        weightItem1 = 35;
            double        weightItem2 = 33;
            List <double> weightList  = new List <double>();

            weightList.Add(weightItem1);
            weightList.Add(weightItem2);

            try
            {
                ICompoundSequenceItem seqItemObj =
                    new CompoundAminoAcid('B', "CompoundSeq'", seqItemList, weightList);
                Assert.IsTrue(null != seqItemObj);
            }
            catch (ArgumentException)
            {
                ApplicationLog.WriteLine(
                    "CompoundSequenceP2TestCases : Successfully validated the Nucleotide for AminoAcid exception");
                Console.WriteLine(
                    "CompoundSequenceP2TestCases : Successfully validated the Nucleotide for AminoAcid exception");
            }
        }
Пример #2
0
        public void InvalidateAminoAcidObjectData()
        {
            try
            {
                AminoAcid acidObj = new CompoundAminoAcid('A', "Item");
                acidObj.GetObjectData(null as SerializationInfo, new StreamingContext());

                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
                ApplicationLog.WriteLine(
                    "AminoAcid : Successfully validated the exception");
                Console.WriteLine(
                    "AminoAcid : Successfully validated the exception");
            }

            try
            {
                CompoundAminoAcid compAcidObj = new CompoundAminoAcid('A', "Item");
                compAcidObj.GetObjectData(null as SerializationInfo, new StreamingContext());

                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
                ApplicationLog.WriteLine(
                    "CompoundAminoAcid : Successfully validated the exception");
                Console.WriteLine(
                    "CompoundAminoAcid : Successfully validated the exception");
            }
        }
Пример #3
0
        public void InvalidateCompoundAminoAcidAdd()
        {
            CompoundAminoAcid aminoAcid = null;

            try
            {
                aminoAcid = new CompoundAminoAcid('A', "Item");
                aminoAcid.Add(null as ISequenceItem, 35);
                Assert.Fail();
            }
            catch (ArgumentException)
            {
                ApplicationLog.WriteLine(
                    "CompoundAminoAcid : Successfully validated the exception");
                Console.WriteLine(
                    "CompoundAminoAcid : Successfully validated the exception");
            }

            finally
            {
                if (aminoAcid != null)
                {
                    ((IDisposable)aminoAcid).Dispose();
                }
            }
            try
            {
                List <ISequenceItem> seq = new List <ISequenceItem>();
                seq.Add(new Sequence(Alphabets.Protein, "a")[0]);
                seq.Add(new Sequence(Alphabets.Protein, "a")[0]);

                List <double> weight = new List <double>();
                weight.Add(80);
                weight.Add(78);

                aminoAcid = new CompoundAminoAcid(
                    1, 'B', Constants.CompoundItemName,
                    false, false, seq, weight);

                Assert.Fail();
            }
            catch (ArgumentException)
            {
                ApplicationLog.WriteLine(
                    "CompoundAminoAcid : Successfully validated the exception");
                Console.WriteLine(
                    "CompoundAminoAcid : Successfully validated the exception");
            }
            finally
            {
                if (aminoAcid != null)
                {
                    ((IDisposable)aminoAcid).Dispose();
                }
            }
        }
Пример #4
0
        public void ValidateCompoundAminoAcidNegWeight()
        {
            ICompoundSequenceItem seqItem =
                new CompoundAminoAcid('B', "NegativeWeight");

            seqItem.Add(new Sequence(Alphabets.Protein, "KIET")[0], -35);
            Assert.AreEqual("Lysine", seqItem.SequenceItems[0].Name);
            ApplicationLog.WriteLine(
                "CompoundSequenceP2TestCases : Successfully validated the negative weight expression");
            Console.WriteLine(
                "CompoundSequenceP2TestCases : Successfully validated the negative weight expression");
        }
Пример #5
0
        public void ValidateCompoundAminoAcidNonGap()
        {
            ICompoundSequenceItem seqItemObj =
                new CompoundAminoAcid('X', "CompoundSeq", false, false);

            Assert.IsFalse(seqItemObj.IsGap);

            ApplicationLog.WriteLine(
                "CompoundSequenceP2TestCases : Successfully validated the Gap property");
            Console.WriteLine(
                "CompoundSequenceP2TestCases : Successfully validated the Gap property");
        }
Пример #6
0
        public void InvalidateCompoundAminoAcidListAdd()
        {
            CompoundAminoAcid cAminoAcid = null;

            try
            {
                List <ISequenceItem> seq = new List <ISequenceItem>();
                seq.Add(null);
                List <double> weight = new List <double>();

                cAminoAcid = new CompoundAminoAcid(
                    1, 'B', Constants.CompoundItemName,
                    false, false, seq, weight);;

                Assert.Fail();
            }
            catch (ArgumentException)
            {
                ApplicationLog.WriteLine(
                    "CompoundAminoAcid : Successfully validated the exception");
                Console.WriteLine(
                    "CompoundAminoAcid : Successfully validated the exception");
            }

            try
            {
                List <ISequenceItem> seq = new List <ISequenceItem>();
                seq.Add(new Sequence(Alphabets.DNA, "a")[0]);

                List <double> weight = new List <double>();

                cAminoAcid = new CompoundAminoAcid(
                    1, 'B', Constants.CompoundItemName,
                    false, false, seq, weight);;

                Assert.Fail();
            }
            catch (ArgumentException)
            {
                ApplicationLog.WriteLine(
                    "CompoundAminoAcid : Successfully validated the exception");
                Console.WriteLine(
                    "CompoundAminoAcid : Successfully validated the exception");
            }
            finally
            {
                if (cAminoAcid != null)
                {
                    ((IDisposable)cAminoAcid).Dispose();
                }
            }
        }
Пример #7
0
 public void ValidateCompoundAminoAcidInValidSymbol()
 {
     try
     {
         ICompoundSequenceItem seqItemObj = new CompoundAminoAcid('Ñ', "CompoundSeq");
         ISequence             seq        = new Sequence(Alphabets.Protein);
         seq.Add(seqItemObj);
     }
     catch (ArgumentException)
     {
         ApplicationLog.WriteLine(
             "CompoundSequenceP2TestCases : Successfully validated the invalid sequence Symbol");
         Console.WriteLine(
             "CompoundSequenceP2TestCases : Successfully validated the invalid sequence Symbol");
     }
 }
Пример #8
0
        public void ValidateCompoundAminoAcidInValidRemove()
        {
            List <ISequenceItem> seqItemList = null;
            List <double>        weightList  = null;

            GetSequenceItemWithWeight(out seqItemList, out weightList, false);

            ICompoundSequenceItem seqItem =
                new CompoundAminoAcid('B', "CompoundSeq", seqItemList, weightList);

            seqItem.Remove(new Sequence(Alphabets.DNA, "T")[0]);
            Assert.AreEqual(2, seqItem.SequenceItems.Count);

            ApplicationLog.WriteLine(
                "CompoundSequenceP2TestCases : Successfully validated the invalid remove");
            Console.WriteLine(
                "CompoundSequenceP2TestCases : Successfully validated the invalid remove");
        }
Пример #9
0
        public void ValidateCompoundAminoAcidDuplicateSequence()
        {
            List <ISequenceItem> seqItemList = null;
            List <double>        weightList  = null;

            GetSequenceItemWithWeight(out seqItemList, out weightList, false);

            ICompoundSequenceItem seqItemObj1 =
                new CompoundAminoAcid('B', "CompoundSeq", seqItemList, weightList);
            ICompoundSequenceItem seqItemObj2 =
                new CompoundAminoAcid('B', "CompoundSeq", seqItemList, weightList);

            Assert.AreEqual(seqItemObj1, seqItemObj2);

            ApplicationLog.WriteLine(
                "CompoundSequenceP2TestCases : Successfully validated the duplicate item");
            Console.WriteLine(
                "CompoundSequenceP2TestCases : Successfully validated the duplicate item");
        }
Пример #10
0
        public void ValidateCompoundAminoAcidSequenceListNull()
        {
            List <ISequenceItem> seqItemList = null;
            List <double>        weightList  = null;

            GetSequenceItemWithWeight(out seqItemList, out weightList, false);

            try
            {
                ICompoundSequenceItem seqItemObj =
                    new CompoundAminoAcid('B', "CompoundSeq", null, weightList);
                Assert.IsTrue(null != seqItemObj);
            }
            catch (ArgumentException)
            {
                ApplicationLog.WriteLine(
                    "CompoundSequenceP2TestCases : Successfully validated the sequence list null exception");
                Console.WriteLine(
                    "CompoundSequenceP2TestCases : Successfully validated the sequence list null exception");
            }
        }
Пример #11
0
        public void ValidateCompoundAminoAcidDuplicateSequenceItemSymbol()
        {
            List <ISequenceItem> seqItemList = null;
            List <double>        weightList  = null;

            GetSequenceItemWithWeight(out seqItemList, out weightList, false);

            ICompoundSequenceItem seqItemObj1 =
                new CompoundAminoAcid('B', "CompoundSeq", seqItemList, weightList);
            ICompoundSequenceItem seqItemObj2 =
                new CompoundAminoAcid('B', "CompoundSeq", seqItemList, weightList);

            Sequence originalSeq = new Sequence(Alphabets.DNA);

            originalSeq.Add(seqItemObj1);
            originalSeq.Add(seqItemObj2);

            Assert.AreEqual("BB", originalSeq.ToString());

            ApplicationLog.WriteLine(
                "CompoundSequenceP2TestCases : Successfully validated the duplicate item & symbol");
            Console.WriteLine(
                "CompoundSequenceP2TestCases : Successfully validated the duplicate item & symbol");
        }