a=1;e=t1;
l4=P4[e]%length;
l3=P4[e]/length;
S5[0]=S1[l4];
S6[0]=S2[l3];
int t=S3[e];
////printf("\n\n S5[e]====%c\tS6[]=====%c",S5[0],S6[0]);
////printf("\n\n e======%d\tp4[e]====%d\tS3[]=====%d",e,P4[e],S3[e]);
l=0;
//printf("\n\n e======%d\tp4[e]====%d",e,P4[e]);
if(S3[e]>=1)//checks whether sequence characters match if mismatch occurs next element is accessed
{ l4=0;
do
{
for(h=0;h<s;h++)//CHECKING P4 ARRAY for top digonal and left elment
{
if(P4[h]==(P4[e]-1))
b=h;//left element
else if(P4[h]==(P4[e]-length))
c=h;//top element
else if(P4[h]==(P4[e]-(length+1)))
d=h;//digonal element
}//4th four
//Comparing top diagonal and left element to find greatest of them
if(S3[b]==S3[d]==S3[c]||S3[d]==S3[e]-1)
g=d;
else if(S3[b]>S3[d]&&S3[b]>S3[c])
g=b;
else if(S3[c]>S3[d])
g=c;
else
g=d;
e=g;
//printf("\n\n e======%d\tS3[e]====%d\t p4[E]==%d\tl4====%d\tl===%d\tt==%d",e,S3[e],P4[e],l4,l,t);
if(S3[e]<1 || t<=1)
break;
l=P4[e]%length;
l4=P4[e]/length;
if(S1[l]==S2[l4])
{
S6[a]=S2[l4];
S5[a]=S1[l];
}
else
{
S6[a]='_';
S5[a]='_';
}
a++;
l4=0,l=0;b=0;c=0;d=0;
t--;
}while(S3[e]>=1 || t>=1);
S5[a]='\0';
S6[a]='\0';
printf("\n\nThe alignment is ===%s\nThe alignment is ===%s",S5,S6);
*S5=NULL;
*S6=NULL;
}//1st if
}//1st for
The code is for Smith waterman algorithm in this alogorithm 2 character sequences are matched for possible similar regions i have scorred the matrix but now i have to get the matched string . there are two arrays first is S3 and P4. S3 stores scores in sorted order and P4 stores priginal postion of each element before sorting. the for loop is to find out top, left and digonal elemet of a given position . i want to convert this code in cuda but i can do it success fully plz someone help me. iam attaching my code with this post have a llok at it
SMWH.cu (20 KB)