Exemple #1
0
/*>int align(char *seq1, int length1, char *seq2, int length2, 
             BOOL verbose, BOOL identity, int penalty,
             char *align1, char *align2, int *align_len)
   -----------------------------------------------------------
   Input:   char  *seq1         First sequence
            int   length1       First sequence length
            char  *seq2         Second sequence
            int   length2       Second sequence length
            BOOL  verbose       Display N&W matrix
            BOOL  identity      Use identity matrix
            int   penalty       Gap insertion penalty value
   Output:  char  *align1       Sequence 1 aligned
            char  *align2       Sequence 2 aligned
            int   *align_len    Alignment length
   Returns: int                 Alignment score (0 on error)
            
   Perform simple N&W alignment of seq1 and seq2. No window is used, so
   will be slow for long sequences.

   A single gap penalty is used, so gap extension incurrs no further
   penalty.

   Note that you must allocate sufficient memory for the aligned 
   sequences.
   The easy way to do this is to ensure that align1 and align2 are
   of length (length1+length2).

   06.03.00 Implemented as a wrapper to affinealign() which is the old
            align() routine, plus support for affine gap penalties,
            plus new traceback code based on storing the path as we
            go
*/
int align(char *seq1, 
          int  length1, 
          char *seq2, 
          int  length2, 
          BOOL verbose, 
          BOOL identity, 
          int  penalty, 
          char *align1, 
          char *align2,
          int  *align_len)
{
   return(affinealign(seq1, length1, seq2, length2, verbose, identity,
                      penalty, 0, align1, align2, align_len));
}
Exemple #2
0
int main(int argc, char **argv)
{
   char seq1[] = "ACTCLMCT",
        seq2[] = "ACTCCT",
        align1[100],
        align2[100];
   int  score, al_len;
   int  i, j;
   
   ReadMDM("pet91.mat");

   for(i=0; i<sMDMSize; i++)
   {
      printf("  %c", sMDM_AAList[i]);
   }
   printf("\n");
   
   for(i=0; i<sMDMSize; i++)
   {
      for(j=0; j<sMDMSize; j++)
      {
         printf("%3d", sMDMScore[i][j]);
      }
      printf("\n");
   }
   
   score = affinealign(seq1, strlen(seq1), seq2, strlen(seq2), 
                       TRUE, FALSE,
                       10, 1, align1, align2, &al_len);

   align1[al_len] = '\0';
   align2[al_len] = '\0';

   printf("%s\n", align1);
   printf("%s\n", align2);
   
   return(0);
}