forked from jduffield65/iss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchange_bled_codes.m
28 lines (25 loc) · 1.05 KB
/
change_bled_codes.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
function BledCodes = change_bled_codes(o,NewBleedMatrix)
%% BledCode = change_bled_codes(o,NewBleedMatrix)
%
% Given a new bleed matrix, this returns the corresponding bled codes
%
% o:iss object
% NewBleedMatrix: desired bleed matrix, different to o.BleedMatrix
% BledCodes: bled codes due to NewBleedMatrix, different to o.BledCodes
%%
nCodes = length(o.GeneNames);
% create numerical code (e.g. 33244 for CCGAA)
FullCharCodes = cell2mat(o.CharCodes)';
numCharCode = str2double(regexp(FullCharCodes(:)','\d','match'))+1;
NumericalCode = reshape(numCharCode,[o.nRounds,nCodes])';
BledCodes = zeros(nCodes, o.nBP*o.nRounds);
% make starting point using bleed vectors (means for each base on each day)
for i=1:nCodes
for r=1:o.nRounds
if any(o.UseChannels == NumericalCode(i,o.UseRounds(r))) == 0 continue; end
BledCodes(i,o.UseChannels+o.nBP*(r-1)) = NewBleedMatrix(:, find(o.UseChannels == NumericalCode(i,o.UseRounds(r))), r);
end
end
% if o.ArtificialGenes
% BledCodes(74:end,:) = o.pBledCodes(74:end,:); %Artificial genes remain same
% end