public void AlignEmptySequence()
        {
            var scorer = new StringScorer();
            var msa = new MultipleAlignmentAlgorithm<string, char>(scorer, new[] {"car", "", "bar"}, GetChars) {UseInputOrder = true};
            msa.Compute();
            Alignment<string, char> alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                "| c a r |",
                "| - - - |",
                "| b a r |"
                ));
        }
        public void AlignEmptySequence()
        {
            var scorer = new StringScorer();
            var msa    = new MultipleAlignmentAlgorithm <string, char>(scorer, new[] { "car", "", "bar" }, GetChars)
            {
                UseInputOrder = true
            };

            msa.Compute();
            Alignment <string, char> alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                                      "| c a r |",
                                      "| - - - |",
                                      "| b a r |"
                                      ));
        }
        public void ZeroMaxScore()
        {
            var scorer = new ZeroMaxScoreStringScorer();
            var msa    = new MultipleAlignmentAlgorithm <string, char>(scorer, new[] { "car", "bar", "carp" }, GetChars)
            {
                UseInputOrder = true
            };

            msa.Compute();
            Alignment <string, char> alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                                      "| c a r - |",
                                      "| b a r - |",
                                      "| c a r p |"
                                      ));
            Assert.That(alignment.NormalizedScore, Is.EqualTo(0));
        }
        public void AlignMoreThanTwoSequences()
        {
            var scorer = new StringScorer();
            var msa    = new MultipleAlignmentAlgorithm <string, char>(scorer, new[] { "car", "bar", "carp" }, GetChars)
            {
                UseInputOrder = true
            };

            msa.Compute();
            Alignment <string, char> alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                                      "| c a r - |",
                                      "| b a r - |",
                                      "| c a r p |"
                                      ));

            msa = new MultipleAlignmentAlgorithm <string, char>(scorer, new[] { "car", "bar", "star" }, GetChars)
            {
                UseInputOrder = true
            };
            msa.Compute();
            alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                                      "| - c a r |",
                                      "| - b a r |",
                                      "| s t a r |"
                                      ));

            msa = new MultipleAlignmentAlgorithm <string, char>(scorer, new[] { "car", "bar", "stare" }, GetChars)
            {
                UseInputOrder = true
            };
            msa.Compute();
            alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                                      "| - c a r - |",
                                      "| - b a r - |",
                                      "| s t a r e |"
                                      ));

            msa = new MultipleAlignmentAlgorithm <string, char>(scorer, new[] { "scar", "car", "bar", "stare" }, GetChars)
            {
                UseInputOrder = true
            };
            msa.Compute();
            alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                                      "| s c a r - |",
                                      "| - c a r - |",
                                      "| - b a r - |",
                                      "| s t a r e |"
                                      ));

            msa = new MultipleAlignmentAlgorithm <string, char>(scorer, new[] { "sane", "scar", "car", "bar", "stare" }, GetChars)
            {
                UseInputOrder = true
            };
            msa.Compute();
            alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                                      "| s - a n e |",
                                      "| s c a r - |",
                                      "| - c a r - |",
                                      "| - b a r - |",
                                      "| s t a r e |"
                                      ));

            msa = new MultipleAlignmentAlgorithm <string, char>(scorer, new[] { "sane", "scar", "she", "car", "bar", "stare" }, GetChars)
            {
                UseInputOrder = true
            };
            msa.Compute();
            alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                                      "| s - a n e |",
                                      "| s c a r - |",
                                      "| s - - h e |",
                                      "| - c a r - |",
                                      "| - b a r - |",
                                      "| s t a r e |"
                                      ));
        }
Пример #5
0
 public override IEnumerable <Alignment <Word, ShapeNode> > GetAlignments()
 {
     yield return(_algorithm.GetAlignment());
 }
        public void AlignMoreThanTwoSequences()
        {
            var scorer = new StringScorer();
            var msa = new MultipleAlignmentAlgorithm<string, char>(scorer, new[] {"car", "bar", "carp"}, GetChars) {UseInputOrder = true};
            msa.Compute();
            Alignment<string, char> alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                "| c a r - |",
                "| b a r - |",
                "| c a r p |"
                ));

            msa = new MultipleAlignmentAlgorithm<string, char>(scorer, new[] {"car", "bar", "star"}, GetChars) {UseInputOrder = true};
            msa.Compute();
            alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                "| - c a r |",
                "| - b a r |",
                "| s t a r |"
                ));

            msa = new MultipleAlignmentAlgorithm<string, char>(scorer, new[] {"car", "bar", "stare"}, GetChars) {UseInputOrder = true};
            msa.Compute();
            alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                "| - c a r - |",
                "| - b a r - |",
                "| s t a r e |"
                ));

            msa = new MultipleAlignmentAlgorithm<string, char>(scorer, new[] {"scar", "car", "bar", "stare"}, GetChars) {UseInputOrder = true};
            msa.Compute();
            alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                "| s c a r - |",
                "| - c a r - |",
                "| - b a r - |",
                "| s t a r e |"
                ));

            msa = new MultipleAlignmentAlgorithm<string, char>(scorer, new[] {"sane", "scar", "car", "bar", "stare"}, GetChars) {UseInputOrder = true};
            msa.Compute();
            alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                "| s - a n e |",
                "| s c a r - |",
                "| - c a r - |",
                "| - b a r - |",
                "| s t a r e |"
                ));

            msa = new MultipleAlignmentAlgorithm<string, char>(scorer, new[] {"sane", "scar", "she", "car", "bar", "stare"}, GetChars) {UseInputOrder = true};
            msa.Compute();
            alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                "| s - a n e |",
                "| s c a r - |",
                "| s - - h e |",
                "| - c a r - |",
                "| - b a r - |",
                "| s t a r e |"
                ));
        }
        public void ZeroMaxScore()
        {
            var scorer = new ZeroMaxScoreStringScorer();
            var msa = new MultipleAlignmentAlgorithm<string, char>(scorer, new[] {"car", "bar", "carp"}, GetChars) {UseInputOrder = true};
            msa.Compute();
            Alignment<string, char> alignment = msa.GetAlignment();

            AssertAlignmentsEqual(alignment, CreateAlignment(
                "| c a r - |",
                "| b a r - |",
                "| c a r p |"
                ));
            Assert.That(alignment.NormalizedScore, Is.EqualTo(0));
        }