long running time

2 ビュー (過去 30 日間)
huda nawaf
huda nawaf 2012 年 4 月 17 日
hi,
i have code (smith_waterman) algorithm of sequence alignment.
I have to align one sequence to large set of squences (database) when run it, it take very long time .
can any one reduce the running time by reducing steps?
Note: I do not know why be the running time longer when used large database. i.e when I align one sequence to 100 sequences from array with size(7000*1000) for example the time will be longer when align one sequence to 100 sequences from array with size(200*1000)
this is code:
f1=fopen('d:\matlab11\r2011a\bin\webscopdata\webscop\action.txt');
c=textscan(f1,'%d%d');fclose(f1);c1=double(c{1});c2={2};
[p,o]=hist(c1,unique(c1));celcod=dlmread('d:\matlab11\r2011a\bin\webscopdata\webscop\webfinal.txt');
gap = -1;
for b=1
f=0;cc=1;
for b1=1:10
if b~=b1
match=2;mismatch=-1;align1=[];align2=[];x=celcod(b,:); y=celcod(b1,:);
x1(1:length(y),1:length(x))=0; trac(1:length(y),1:length(x))=0;
txt(1:length(y),1:length(x))=' '; mat=struct('scor',x1,'pointer',txt);
for j=1:length(x)
mat(1,j).scor=x1(1,j); mat(1,j).pointer='none';
end
for i=1:length(y)
mat(i,1).scor=x1(i,1); mat(i,1).pointer='none';
end
max_i=1;max_j=1;max_scor=1;score=0;
for i=2:length(y)
for j=2:length(x)
letter1=x(j);letter2=y(i);
if strcmp(letter1,letter2)
dig_scor=mat(i-1,j-1).scor+match;
else
dig_scor=mat(i-1,j-1).scor+mismatch;
end
up_scor=mat(i-1,j).scor+gap; eft_scor=mat(i,j-1).scor+gap;
if (dig_scor<=0 && up_scor<=0 && left_scor<=0)
mat(i,j).scor = 0; mat(i,j).pointer='none';
continue
end
if dig_scor>=up_scor
if dig_scor>=left_scor
mat(i,j).scor=dig_scor; mat(i,j).pointer='diagonal';
else
mat(i,j).scor=left_scor; mat(i,j).pointer='left';
end
else
if up_scor>=left_scor
mat(i,j).scor=up_scor; mat(i,j).pointer='up';
else
mat(i,j).scor=left_scor; mat(i,j).pointer='left';
end
end
if mat(i,j).scor > max_scor
max_i=i; max_j=j; max_scor=mat(i,j).scor;
end;end;end
max_scor;j=max_j; i=max_i;
while i>1 & j>1
if strcmp(mat(i,j).pointer,'none')==1
break; end
if strcmp(mat(i,j).scor,'0')==1
break;
end
if strcmp(mat(i,j).pointer,'diagonal')==1
align1= [align1 x(j)];align2=[align2 y(i)]; trac(i,j)=1;
if strcmp(x(j),y(i))==1
score=score+2;
else
score=score-1; end
i=i-1; j=j-1;
elseif strcmp(mat(i,j).pointer,'left')==1;
align1= [align1 x(j)];align2=[align2 '-'];
trac(i,j)=1;j=j-1;score=score-1;
else mat(i,j).pointer=='up'
align1= [align1 '-' ]; align2=[align2 y(i)];trac(i,j)=1;
i=i-1; score=score-1;
end; end
align1=fliplr(align1);align2=fliplr(align2);
[align1;align2];
for i=1:length(y)
for j=1:length(x)
mat1(i,j)=mat(i,j).scor; mat2{i,j}=mat(i,j).pointer;
end
end
scor(b1)=max_scor;
end
end
end
thanks in advance

回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by