Esempio n. 1
0
        public MAlignment(int size1)
        {
            result1=new List<char>(size1*size1);
            result2=new List<char>(size1*size1);

            size1++;
            scoreTab = new cell[size1, size1];
            scoreTab1 = new cell[size1, size1];
            scoreTab2 = new cell[size1, size1];

            for (int i = 0; i < size1; i++)
                for (int j = 0; j < size1; j++)
                {
                    scoreTab[i, j] = new cell();
                    scoreTab1[i, j] = new cell();
                    scoreTab2[i, j] = new cell();
                }
        }
Esempio n. 2
0
        public MAlignment(int size1)
        {
            result1 = new List <char>(size1 * size1);
            result2 = new List <char>(size1 * size1);

            size1++;
            scoreTab  = new cell[size1, size1];
            scoreTab1 = new cell[size1, size1];
            scoreTab2 = new cell[size1, size1];

            for (int i = 0; i < size1; i++)
            {
                for (int j = 0; j < size1; j++)
                {
                    scoreTab[i, j]  = new cell();
                    scoreTab1[i, j] = new cell();
                    scoreTab2[i, j] = new cell();
                }
            }
        }
Esempio n. 3
0
        alignSeq TraceBack(string str1, string str2)
        {
            result1.Clear();
            result2.Clear();
            //string result1="";
            //string result2="";
            alignSeq alignRes;
            int      val1, val2, val3;

            val1 = scoreTab[size1 - 1, size2 - 1].value;
            val2 = scoreTab1[size1 - 1, size2 - 1].value;
            val3 = scoreTab2[size1 - 1, size2 - 1].value;

            cell aux = scoreTab[size1 - 1, size2 - 1];

            if (val1 > val2 && val1 > val3)
            {
                aux = scoreTab[size1 - 1, size2 - 1];
            }
            else
            if (val2 >= val1 && val2 >= val3)
            {
                aux = scoreTab1[size1 - 1, size2 - 1];
            }
            else
            {
                aux = scoreTab2[size1 - 1, size2 - 1];
            }

            do
            {
                if (aux.direction == 2)
                {
                    result1.Add(str1[aux.ai - 1]);
                    result2.Add(str2[aux.aj - 1]);
                }
                else
                if (aux.direction == 0)
                {
                    result2.Add('-');
                    result1.Add(str1[aux.ai - 1]);
                }
                else
                {
                    result1.Add('-');
                    result2.Add(str2[aux.aj - 1]);
                }
                aux = aux.tab[aux.i, aux.j];
            }while (aux.ai != 0 && aux.aj != 0);


            while (aux.ai > 0)
            {
                result1.Add(str1[--aux.ai]);
                result2.Add('-');
            }

            while (aux.aj > 0)
            {
                result2.Add(str1[--aux.aj]);
                result1.Add('-');
            }

            alignRes.seq1 = ReverseString(result1);
            alignRes.seq2 = ReverseString(result2);

            return(alignRes);
        }