Exemple #1
0
        public void CalculateEditedStrings( )
        {
            S2Edit = S2;
            S1Edit = S1;

            //keep track of number of gaps per sequences
            int gapCountS1 = 0;
            int gapCountS2 = 0;

            //initialise Bars string before modifying based on gaps
            for (int i = 0; i < S1.Length; i++)
            {
                Bars += "|";
            }
            for (int i = 0; i < Path.Count; i++)
            {
                if (Path[i] == Direction.Down)
                {
                    Bars += "|";
                }
                if (Path[i] == Direction.Right)
                {
                    Bars += "|";
                }
            }

            //modify sequences and bars based on positions
            for (int i = 0; i < Path.Count; i++)
            {
                if (Path[i] == Direction.Down)
                {
                    S2Edit = S2Edit.Substring(0, i) + "-" + S2Edit.Substring(i);
                    Bars   = Bars.Substring(0, i) + " " + Bars.Substring(i + 1);
                    gapCountS2++;
                }

                else if (Path[i] == Direction.Right)
                {
                    S1Edit = S1Edit.Substring(0, i) + "-" + S1Edit.Substring(i);
                    Bars   = Bars.Substring(0, i) + " " + Bars.Substring(i + 1);
                    gapCountS1++;
                }

                else if (Path[i] == Direction.Diagonal)
                {
                    if (S1Edit[i].Equals(S2Edit[i]))
                    {
                        //WriteLine("match: "+S1Edit[i]+S2Edit[i]+i);     //helped me keep track of what was happening
                        //don't want to remove commented code
                        //so I understand when I review in future
                    }
                    else
                    {
                        Bars = Bars.Substring(0, i) + " " + Bars.Substring(i + 1);
                    }
                }
            }
            Bars = Bars.Substring(0, S1Edit.Length);          //remove excess bars chars
        }
Exemple #2
0
 public void DisplayEditedStrings(int lineLength)
 {
     for (int i = 0; i < (S1Edit.Length); i += lineLength)
     {
         //write last line of sequences and bars (not as long as line length)
         if (S1Edit.Length - i < lineLength)
         {
             WriteLine(S1Edit.Substring(i));
             WriteLine(Bars.Substring(i));
             WriteLine(S2Edit.Substring(i));
         }
         else
         {
             WriteLine(S1Edit.Substring(i, lineLength));
             WriteLine(Bars.Substring(i, lineLength));
             WriteLine(S2Edit.Substring(i, lineLength));
         }
     }
 }