-
Notifications
You must be signed in to change notification settings - Fork 10
/
ConvertAlignmentToStringDisplay.m
33 lines (32 loc) · 1.04 KB
/
ConvertAlignmentToStringDisplay.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
% Name: ConvertAlignmentToStringDisplay.m
% Description: Convert the alignment to a readable format.
% Authors: Tsu-Wei Chen, Meena AbdelMaseeh and Daniel Stashuk
% Data: March 23, 2015
function [AlignmentDisplay] = ConvertAlignmentToStringDisplay(NumericS, NumericT, SubstitutionMatrix, Symbols, Alignment)
AlignmentLength = size(Alignment,1);
AlignmentDisplay1 = '';
AlignmentDisplay2 = '';
PrevP1 = 0;
PrevP2 = 0;
for k = 1:AlignmentLength
AlignedP1 = Alignment(k,1) - 1;
AlignedP2 = Alignment(k,2) - 1;
AlignedChar1 = '';
AlignedChar2 = '';
if (AlignedP1 == 0 || AlignedP1 == PrevP1)
AlignedChar1 = '-';
else
AlignedChar1 = Symbols(NumericS(AlignedP1));
end
if (AlignedP2 == 0 || AlignedP2 == PrevP2)
AlignedChar2 = '-';
else
AlignedChar2 = Symbols(NumericT(AlignedP2));
end
AlignmentDisplay1(k) = AlignedChar1;
AlignmentDisplay2(k) = AlignedChar2;
PrevP1 = AlignedP1;
PrevP2 = AlignedP2;
end
AlignmentDisplay = [AlignmentDisplay1(2:end); AlignmentDisplay2(2:end)];
end