1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
function NEW_INDS = Align2Ref(REF_SEQ, ALIGN, ALIGN_INDS, ALPHA)
% Align2Ref
% Uses a profile alignment to change a set of indicices in the
% "alignment space" to the "reference space".
%
%
% NEW_INDS = Align2Ref(REF_SEQ, ALIGN, ALIGN_INDS)
%
if nargin == 3
ALPHA = 'aa';
end
ref_prof = seqprofile(REF_SEQ, 'alphabet', ALPHA);
align_prof = seqprofile(ALIGN, 'alphabet', ALPHA);
[~, ind1, ind2] = profalign(ref_prof, align_prof);
ninds = ind2(ALIGN_INDS);
mask = sum(bsxfun(@le, ind1(:)', ninds(:)),2);
mask(mask == 0) = 1;
NEW_INDS = reshape(ind1(mask), size(ALIGN_INDS));
|