Info

この質問は閉じられています。 編集または回答するには再度開いてください。

I Have this scoring matrix, I want to change just the first column and row from zeros to 0, -2, -4, -6, -8 and so on. I don't know how to change it. any help please ??

1 回表示 (過去 30 日間)
Moon Shadow
Moon Shadow 2016 年 9 月 19 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
seq1 = 'GGATCGA';
seq2 = 'GAATTCAGTTA';
n = length(seq1);
m = length(seq2);
w = -2;
score = zeros(n+1, m+1);
back = cell(n+1, m+1);
% fill the score matrix
for i=2: n+1
for j=2: m+1
sij = -1;
if seq1(i-1) == seq2(j-1)
sij = 2;
end
a = [score(i-1,j-1)+sij, score(i,j-1)+w, score(i-1,j)+w];
[smax, imax] = max(a);
score(i,j) = smax;
switch imax
case 1
back{i,j} = [i-1, j-1];
case 2
back{i,j} = [i, j-1];
case 3
back{i,j} = [i-1, j];
end
end
end
score

回答 (1 件)

Luuk van Oosten
Luuk van Oosten 2016 年 9 月 19 日
Just to be sure: is the following what you are trying to do (just implemented for the first column though)?
for i = 1:length(score(:,1))-1
score(i+1,1)=-2*i
end
If this is what you are looking for, I am sure you can make it work for the first row as well.
  3 件のコメント
Moon Shadow
Moon Shadow 2016 年 9 月 19 日
sorry to 0, -2, -4, -6,...
Luuk van Oosten
Luuk van Oosten 2016 年 9 月 20 日
All right, but you did add my three lines of codes at the end of your script, didn't you? I've attached my outcome as well (only for the first column).
PS: you are aware of the fact that there are some tools for this in the BioInformatics toolbox? (click)

この質問は閉じられています。

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by