|
Last change
on this file was
19480,
checked in by westram, 2 years ago
|
|
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | #include "Flatio.c" |
|---|
| 2 | #define BLACK 8 |
|---|
| 3 | #define RED 3 |
|---|
| 4 | #define BLUE 6 |
|---|
| 5 | #define YELLOW 1 |
|---|
| 6 | #define AQUA 4 |
|---|
| 7 | |
|---|
| 8 | int match(a,b) |
|---|
| 9 | char a,b; |
|---|
| 10 | { |
|---|
| 11 | char aa,bb; |
|---|
| 12 | aa=a|32; |
|---|
| 13 | bb=b|32; |
|---|
| 14 | |
|---|
| 15 | fprintf(stderr,"%c %c\n",aa,bb); |
|---|
| 16 | |
|---|
| 17 | if(a=='-' || a=='~') |
|---|
| 18 | { |
|---|
| 19 | if((b=='-') || (b=='~')) |
|---|
| 20 | return(BLACK); |
|---|
| 21 | else |
|---|
| 22 | return(RED); |
|---|
| 23 | } |
|---|
| 24 | else if(aa=='a' && (bb=='t' || bb=='u')) |
|---|
| 25 | return(BLUE); |
|---|
| 26 | else if(bb=='a' && (aa=='t' || aa=='u')) |
|---|
| 27 | return(BLUE); |
|---|
| 28 | else if(bb=='c' && aa=='g' ) |
|---|
| 29 | return(BLUE); |
|---|
| 30 | else if(bb=='g' && aa=='c' ) |
|---|
| 31 | return(BLUE); |
|---|
| 32 | else if(aa=='g' && (bb=='t' || bb=='u')) |
|---|
| 33 | return(AQUA); |
|---|
| 34 | else if(bb=='g' && (aa=='t' || aa=='u')) |
|---|
| 35 | return(AQUA); |
|---|
| 36 | else return(YELLOW); |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | int main() |
|---|
| 41 | { |
|---|
| 42 | struct data_format data[10000]; |
|---|
| 43 | int i,j,k,numseqs,mask = -1; |
|---|
| 44 | int pair[20000],stack[20000],spt = 0; |
|---|
| 45 | |
|---|
| 46 | numseqs = ReadFlat(stdin,data,10000); |
|---|
| 47 | if(numseqs == 0) |
|---|
| 48 | return 1; |
|---|
| 49 | for(j=0;j<numseqs;j++) |
|---|
| 50 | if(data[j].type == '"') |
|---|
| 51 | mask = j; |
|---|
| 52 | if(mask == -1) |
|---|
| 53 | return 1; |
|---|
| 54 | |
|---|
| 55 | for(j=0;j<data[mask].length;j++) |
|---|
| 56 | { |
|---|
| 57 | if(data[mask].nuc[j] == '[') |
|---|
| 58 | stack[spt++] = j; |
|---|
| 59 | else if(data[mask].nuc[j] == ']') |
|---|
| 60 | { |
|---|
| 61 | i = stack[--spt]; |
|---|
| 62 | pair[j] = i; |
|---|
| 63 | pair[i] = j; |
|---|
| 64 | } |
|---|
| 65 | else |
|---|
| 66 | pair[j] = -1; |
|---|
| 67 | } |
|---|
| 68 | |
|---|
| 69 | for(j=0;j<numseqs;j++) |
|---|
| 70 | if(j!=mask) |
|---|
| 71 | { |
|---|
| 72 | printf("name:%s\nlength:%d\nstart:\n", |
|---|
| 73 | data[j].name,data[j].length); |
|---|
| 74 | i = MIN(data[mask].length,data[j].length); |
|---|
| 75 | for(k=0;k<i;k++) |
|---|
| 76 | if(pair[k] != -1) |
|---|
| 77 | printf("%d\n",match(data[j].nuc[k], |
|---|
| 78 | data[j].nuc[pair[k]])); |
|---|
| 79 | else |
|---|
| 80 | printf("8\n"); |
|---|
| 81 | for(k=0;k<data[j].length - data[mask].length;k++) |
|---|
| 82 | printf("8\n"); |
|---|
| 83 | } |
|---|
| 84 | return 0; |
|---|
| 85 | } |
|---|
| 86 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.