function alignment = get_seq_to_align(alignment)
%---------------------------DESCRIPTION-----------------------------------%
%This method returns two of sequences that will be aligned according to
%distance matrix
%-------------------------------------------------------------------------%

%Pass to local variable
distance_matrix = alignment.distance_matrix;

ok = 0;

    while ok == 0
        
        %Get the value of highest distance (most related)
        max_dist_val = max(max(distance_matrix));

        %Find position of maximum, indicies are sequences which are related to this
        %value
        [y, x] = find(distance_matrix == max_dist_val);

        %After we find position of the maximum we replace it with zero so it does
        %not mess in next cycle
        distance_matrix(y,x) = 0;

        alignment.distance_matrix = distance_matrix;

        %Find if we already had aligned these sequences
        [row, column] = find(alignment.log_table == x);
        result_check_1 = alignment.log_table(row, 2);

        [row_2, column_2] = find(alignment.log_table == y);
        result_check_2 = alignment.log_table(row_2, 2);

        if result_check_1 == 0 && result_check_2 == 0

            %Havent aligned before so both of sequences can go for further
            %processing but we have to flag them that they will be no longer
            %processed if ever selected
            alignment.log_table(row, 2) = 9999;
            alignment.log_table(row_2, 2) = 9999;

            %Flag that we can end this cyckle
            ok = 1;

        elseif result_check_1 == 0

            %Add flag processed
            alignment.log_table(row, 2) = 9999;

            %We have to pass x to y, because sequence 1 will be overwritten by
            %consensus sequence and we want to process sequence 1 as it is sequence
            %2
            y = x;

            %Flag that we can end this cyckle
            ok = 1;

        else

            %Add flag processed
            alignment.log_table(row_2, 2) = 9999;

            %Flag that we can end this cyckle
            ok = 1;

        end
    
    end

%Determine sequences which are to be aligned
alignment.seq_to_align_01 = char(alignment.seqs(x));
alignment.seq_to_align_02 = char(alignment.seqs(y));