Beispiel #1
0
 public override void PerformTestCase()
 {
     if (!subsequence)
     {
         result = af.FindAlignment(v, w, out al);
     }
     else
     {
         result = af.FindSubsequenceAlignment(v, w, out al);
     }
 }
Beispiel #2
0
        private static void DebugTest(string v, string w, AlignmentFinder af, bool subsequence)
        {
            Console.WriteLine("------------------------");
            Console.WriteLine($"v={v}");
            Console.WriteLine($"w={w}");
            Alignment al;
            int       sc;

            if (!subsequence)
            {
                sc = af.FindAlignment(v, w, out al);
            }
            else
            {
                sc = af.FindSubsequenceAlignment(v, w, out al);
            }

            Console.WriteLine($"av={al.AlignedV}");
            Console.WriteLine($"aw={al.AlignedW}");
            Console.WriteLine($"returned={sc}");

            int score = 0;
            int n     = al.AlignedV.Length;

            for (int i = 0; i < n; ++i)
            {
                if (al.AlignedV[i] != '-' && al.AlignedW[i] != '-')
                {
                    score += af.Matrix[al.AlignedV[i], al.AlignedW[i]];
                }
                else if (al.AlignedV[i] == '-' && al.AlignedW[i] == '-')
                {
                    throw new ArgumentException("aligned gaps found");
                }
                else
                {
                    score += af.Epsilon;
                }
            }


            Console.WriteLine($"computed={score}");
        }