Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

IUPAC DNA support

svn path=/bioperl-ext/trunk/; revision=14779
  • Loading branch information...
commit fcc7e1126b45c0724b5341e3137f9b983f18842f 1 parent b9becbf
authored

Showing 1 changed file with 30 additions and 0 deletions. Show diff stats Hide diff stats

  1. 30  Bio/Ext/Align/libs/linspc.c
30  Bio/Ext/Align/libs/linspc.c
@@ -64,6 +64,16 @@ dpAlign_Local_DNA_MillerMyers(char * seq1, char * seq2, int match, int mismatch,
64 64
 	    dpAlign_fatal("Cannot allocate memory for scoring matrix col!\n");
65 65
         for (j = 0; j < 17; ++j) {
66 66
             if (i == 16 || j == 16) s[i][j] = mismatch; /* X mismatches all */
  67
+            else if (i == 15 || j == 15) s[i][j] = match; /* N matches all but X */
  68
+            else if (i == 14 && j != 0 || i != 0 && j == 14) s[i][j] = match; /* B is not A */
  69
+            else if (i == 13 && j != 3 && j != 4 || i != 3 && i != 4 && j == 13) s[i][j] = match; /* V is not T/U */
  70
+            else if (i == 12 && j != 2 || i != 2 && j == 12) s[i][j] = match; /* H is not G */
  71
+            else if (i == 11 && j != 1 || i != 1 && j == 11) s[i][j] = match; /* D is not C */
  72
+            else if (i == 10 && j != 0 && j != 1 && j != 7 || i != 0 && i != 1 && i != 7 && j == 10) s[i][j] = match; /* K is not A/C/M */
  73
+            else if (i == 9 && j != 0 && j != 3 && j != 4 && j != 8 || i != 0 && i != 3 && i != 4 && i != 8 && j == 9) s[i][j] = match; /* S is not T/U/A/W */
  74
+            else if (i == 8 && j != 1 && j != 2 && j != 9 || i != 1 && i != 2 && i != 9 && j == 10) s[i][j] = match; /* W is not G/C/S */
  75
+            else if (i == 7 && j != 2 && j != 3 && j != 4 && j != 10 || i != 2 && i != 3 && i != 4 && i != 10 && j == 7) s[i][j] = match; /* M is not T/U/G/K */
  76
+            else if (i == 3 && j == 4 || i == 4 && j == 3) s[i][j] = match; /* T matches U */ 
67 77
 	    else if (i == j) s[i][j] = match;
68 78
             else s[i][j] = mismatch;
69 79
         }
@@ -131,6 +141,16 @@ dpAlign_EndsFree_DNA_MillerMyers(char * seq1, char * seq2, int match, int mismat
131 141
 	    dpAlign_fatal("Cannot allocate memory for scoring matrix col!\n");
132 142
         for (j = 0; j < 17; ++j) {
133 143
             if (i == 16 || j == 16) s[i][j] = mismatch; /* X mismatches all */
  144
+            else if (i == 15 || j == 15) s[i][j] = match; /* N matches all but X */
  145
+            else if (i == 14 && j != 0 || i != 0 && j == 14) s[i][j] = match; /* B is not A */
  146
+            else if (i == 13 && j != 3 && j != 4 || i != 3 && i != 4 && j == 13) s[i][j] = match; /* V is not T/U */
  147
+            else if (i == 12 && j != 2 || i != 2 && j == 12) s[i][j] = match; /* H is not G */
  148
+            else if (i == 11 && j != 1 || i != 1 && j == 11) s[i][j] = match; /* D is not C */
  149
+            else if (i == 10 && j != 0 && j != 1 && j != 7 || i != 0 && i != 1 && i != 7 && j == 10) s[i][j] = match; /* K is not A/C/M */
  150
+            else if (i == 9 && j != 0 && j != 3 && j != 4 && j != 8 || i != 0 && i != 3 && i != 4 && i != 8 && j == 9) s[i][j] = match; /* S is not T/U/A/W */
  151
+            else if (i == 8 && j != 1 && j != 2 && j != 9 || i != 1 && i != 2 && i != 9 && j == 10) s[i][j] = match; /* W is not G/C/S */
  152
+            else if (i == 7 && j != 2 && j != 3 && j != 4 && j != 10 || i != 2 && i != 3 && i != 4 && i != 10 && j == 7) s[i][j] = match; /* M is not T/U/G/K */
  153
+            else if (i == 3 && j == 4 || i == 4 && j == 3) s[i][j] = match; /* T matches U */ 
134 154
 	    else if (i == j) s[i][j] = match;
135 155
             else s[i][j] = mismatch;
136 156
         }
@@ -194,6 +214,16 @@ dpAlign_Global_DNA_MillerMyers(char * seq1, char * seq2, int match, int mismatch
194 214
 	    dpAlign_fatal("Cannot allocate memory for scoring matrix col!\n");
195 215
         for (j = 0; j < 17; ++j) {
196 216
             if (i == 16 || j == 16) s[i][j] = mismatch; /* X mismatches all */
  217
+            else if (i == 15 || j == 15) s[i][j] = match; /* N matches all but X */
  218
+            else if (i == 14 && j != 0 || i != 0 && j == 14) s[i][j] = match; /* B is not A */
  219
+            else if (i == 13 && j != 3 && j != 4 || i != 3 && i != 4 && j == 13) s[i][j] = match; /* V is not T/U */
  220
+            else if (i == 12 && j != 2 || i != 2 && j == 12) s[i][j] = match; /* H is not G */
  221
+            else if (i == 11 && j != 1 || i != 1 && j == 11) s[i][j] = match; /* D is not C */
  222
+            else if (i == 10 && j != 0 && j != 1 && j != 7 || i != 0 && i != 1 && i != 7 && j == 10) s[i][j] = match; /* K is not A/C/M */
  223
+            else if (i == 9 && j != 0 && j != 3 && j != 4 && j != 8 || i != 0 && i != 3 && i != 4 && i != 8 && j == 9) s[i][j] = match; /* S is not T/U/A/W */
  224
+            else if (i == 8 && j != 1 && j != 2 && j != 9 || i != 1 && i != 2 && i != 9 && j == 10) s[i][j] = match; /* W is not G/C/S */
  225
+            else if (i == 7 && j != 2 && j != 3 && j != 4 && j != 10 || i != 2 && i != 3 && i != 4 && i != 10 && j == 7) s[i][j] = match; /* M is not T/U/G/K */
  226
+            else if (i == 3 && j == 4 || i == 4 && j == 3) s[i][j] = match; /* T matches U */ 
197 227
 	    else if (i == j) s[i][j] = match;
198 228
             else s[i][j] = mismatch;
199 229
         }

0 notes on commit fcc7e11

Please sign in to comment.
Something went wrong with that request. Please try again.