public void Parse_ShouldAcceptGaps()
        {
            string expectedSequence      = "ABC-";
            var    aminoAcidSequenceData = AminoAcidSequence.Parse(expectedSequence);

            Assert.AreEqual(expectedSequence, aminoAcidSequenceData.Characters);
        }
        public void Parse_ShouldAcceptTranslationStop()
        {
            string expectedSequence      = "ABC*";
            var    aminoAcidSequenceData = AminoAcidSequence.Parse(expectedSequence);

            Assert.AreEqual(expectedSequence, aminoAcidSequenceData.Characters);
        }
        public void ToString_ProducesExpectedOutput()
        {
            string expectedSequence      = "ABC-";
            var    aminoAcidSequenceData = AminoAcidSequence.Parse(expectedSequence);

            Assert.AreEqual(expectedSequence, aminoAcidSequenceData.ToString());
        }
Пример #4
0
        public void ToInterleavedLines_ShouldProduceExpectedOutputForNonDefaultLineLength()
        {
            string inputSequence = "MDSKGSSQKGSRLLLLLVVSNLLLCQGVVSTPVCPNGPGNCQVSLRDLFDRAVMVSHYIHDLSS"
                                   + "EMFNEFDKRYAQGKGFITMALNSCHTSSLPTPEDKEQAQQTHHEVLMSLILGLLRSWNDPLYHL";

            IEnumerable <string> expectedOutputLines = new string[] {
                ">lcl|123",
                "MDSKGSSQ",
                "KGSRLLLL",
                "LVVSNLLL",
                "CQGVVSTP",
                "VCPNGPGN",
                "CQVSLRDL",
                "FDRAVMVS",
                "HYIHDLSS",
                "EMFNEFDK",
                "RYAQGKGF",
                "ITMALNSC",
                "HTSSLPTP",
                "EDKEQAQQ",
                "THHEVLMS",
                "LILGLLRS",
                "WNDPLYHL"
            };

            Identifier      identifier          = new LocalIdentifier("123");
            Header          header              = new Header(identifier);
            IActualSequence sequence            = AminoAcidSequence.Parse(inputSequence);
            var             singleFASTAFileData = new Sequence(header, sequence);

            IEnumerable <string> actualOutputLines = singleFASTAFileData.ToInterleavedLines(8);

            CollectionAssert.AreEqual(expectedOutputLines.ToList(), actualOutputLines.ToList());
        }
        public void ToLines_RejectsNegativeLineLength()
        {
            string sequence = "ABCDEF";

            var aminoAcidSequenceData = AminoAcidSequence.Parse(sequence);

            _ = aminoAcidSequenceData.ToLines(-1);
        }
        public void ToLines_RejectsLineLengthOfZero()
        {
            string sequence = "ABCDEF";

            var aminoAcidSequenceData = AminoAcidSequence.Parse(sequence);

            _ = aminoAcidSequenceData.ToLines(0);
        }
        public void ToLines_ProducesExpectedOutput()
        {
            string sequence      = "ABCDEF";
            var    expectedLines = new string[] { "ABCD", "EF" };

            var aminoAcidSequenceData        = AminoAcidSequence.Parse(sequence);
            IEnumerable <string> actualLines = aminoAcidSequenceData.ToLines(4);

            Assert.IsTrue(actualLines.SequenceEqual(expectedLines));
        }
        public void ToMultilineString_ProducesExpectedOutput()
        {
            string sequence      = "ABCDEF";
            string expectedLines = $"ABCD{Environment.NewLine}EF";

            var    aminoAcidSequenceData = AminoAcidSequence.Parse(sequence);
            string actualLines           = aminoAcidSequenceData.ToMultilineString(4);

            Assert.AreEqual(expectedLines, actualLines);
        }
Пример #9
0
        public void ToInterleavedLines_ShouldRejectLineLengthOfZero()
        {
            string inputSequence = "MDSKGSSQKGSRLLLLLVVSNLLLCQGVVSTPVCPNGPGNCQVSLRDLFDRAVMVSHYIHDLSS"
                                   + "EMFNEFDKRYAQGKGFITMALNSCHTSSLPTPEDKEQAQQTHHEVLMSLILGLLRSWNDPLYHL";

            Identifier      identifier          = new LocalIdentifier("123");
            Header          header              = new Header(identifier);
            IActualSequence sequence            = AminoAcidSequence.Parse(inputSequence);
            var             singleFASTAFileData = new Sequence(header, sequence);

            _ = singleFASTAFileData.ToInterleavedLines(0).ToList();
        }
        public void Parse_ShouldConvertMultilineSequenceToSingleLine()
        {
            var aminoAcidSequenceData = AminoAcidSequence.Parse("ABC\nDEF");

            Assert.AreEqual("ABCDEF", aminoAcidSequenceData.Characters);
        }
        public void Parse_ShouldConvertLowercaseSequenceToUppercase()
        {
            var aminoAcidSequenceData = AminoAcidSequence.Parse("abc");

            Assert.AreEqual("ABC", aminoAcidSequenceData.Characters);
        }
 public void Parse_ShouldRejectInvalidCharacterAtEnd()
 {
     _ = AminoAcidSequence.Parse("ABC2");
 }
 public void Parse_ShouldRejectInvalidCharacterAtStart()
 {
     _ = AminoAcidSequence.Parse("2ABC");
 }
 public void Parse_ShouldRejectNullString()
 {
     _ = AminoAcidSequence.Parse(null);
 }