#include #include #include #include #define SIZE 300 #define NSQ 50 // no of sub sequences void Subsequence(int, int); void splicer(); void LCS(char *, char*, char *, int, int&); void substring(char* ,char* , int , int ); void mergeSub(char* ,char* ,char* , char * , int); void align(char**, int); void main() { char newSeq[SIZE], nextSeq[SIZE], overlap[SIZE], mergedSeq[4*SIZE]; int noSeq; int overlapSize,oldOverSize=0; int type; int i,j; ifstream ifp; ifp.open("subseq.dat"); //ifp>>noSeq; //same as NSQ, for test data char **data; data= new char*[NSQ]; for(i=0; i endse) { temp=start; start=endse; endse=temp; } cout<<"Start "<0 && type>0) //has a match, creates an empty mergedSubst if not checked, to be used later to define size of overlap { mergeSub(data[i], data[j],overlap, mergedSeq, type); //show only new sequences if((strlen(mergedSeq) > strlen(data[i])) && (strlen(mergedSeq) > strlen(data[j]))) { cout<<"\n..........................................................."<=c[i][j-1]) { c[i][j]=c[i-1][j]; b[i][j]=-1; } else { c[i][j]=c[i][j-1]; b[i][j]=-2; } } //the largest no is the length of the common string int len=c[x_l][y_l]; int start, stop=0, max, oldstart, oldstop, ctr, len2=0; int ystart, yend, jcopy; z[len]='\0'; i=x_l; j=y_l; //back track oldstop=0; stop=0; ctr=0; while(i>0 || j>0) { if(b[i][j]==-3) { i--; j--; len--; z[len]=x[i]; if(ctr==0) { start=i; jcopy=j; stop=0; ctr=1; } else { stop++; if(i==0) { if(stop>oldstop) { oldstop=stop; oldstart=start; yend=jcopy; } } } } else if(b[i][j]==-1) { i--; if(stop>oldstop) { oldstop=stop; oldstart=start; yend=jcopy; } ctr=0; } else if(b[i][j]==-2) { j--; if(stop>oldstop) { oldstop=stop; oldstart=start; yend=jcopy; } ctr=0; } } //////////////////////////Testing cout<<"new value "<= oldcount) { yend=j1; oldstart=i1; //xend oldstop=count; oldstop--; } } cout<<"new value "<0 && style==2) { int xstart=oldstart-oldstop; int xend=oldstart; ystart=yend-oldstop; substring(z, x, xstart, oldstart); //we only want it if its more than 1 char //cout<<"\nLongest common Substring "<>nosub; switch(type) { case 1: //similarity based exact matching // this would be the simplest and redundant/slow way of matching int overlap_size=24; for(i=0; i