source: branches/stable/GDE/SUPPORT/sho_helix.c

Last change on this file was 2, checked in by oldcode, 23 years ago

Initial revision

  • 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
7main()
8{
9        struct data_format data[10000];
10        int i,j,k,numseqs,mask = -1;
11        int pair[20000],stack[20000],spt = 0;
12        char ch;
13
14        numseqs = ReadFlat(stdin,data,10000);
15        if(numseqs == 0)
16                exit(1);
17        for(j=0;j<numseqs;j++)
18                if(data[j].type == '"')
19                        mask = j;
20        if(mask == -1)
21                exit(1);
22
23        for(j=0;j<data[mask].length;j++)
24        {
25                if(data[mask].nuc[j] == '[')
26                        stack[spt++] = j;
27                else if(data[mask].nuc[j] == ']')
28                {
29                        i = stack[--spt];
30                        pair[j] = i;
31                        pair[i] = j;
32                }
33                else
34                        pair[j] = -1;
35        }
36
37        for(j=0;j<numseqs;j++)
38                if(j!=mask)
39                {
40                        printf("name:%s\nlength:%d\nstart:\n",
41                                data[j].name,data[j].length);
42                        i = MIN(data[mask].length,data[j].length);
43                        for(k=0;k<i;k++)
44                                if(pair[k] != -1)
45                                        printf("%d\n",match(data[j].nuc[k],
46                                                data[j].nuc[pair[k]]));
47                                else
48                                        printf("8\n");
49                        for(k=0;k<data[j].length - data[mask].length;k++)
50                                        printf("8\n");
51                }
52        exit(0);
53}
54                       
55
56
57int match(a,b)
58char a,b;
59{
60        char aa,bb;
61        aa=a|32;
62        bb=b|32;
63
64        fprintf(stderr,"%c %c\n",aa,bb);
65
66        if(a=='-' || a=='~')
67        {
68                if((b=='-') || (b=='~'))
69                        return(BLACK);
70                else
71                        return(RED);
72        }
73        else if(aa=='a' && (bb=='t' || bb=='u'))
74                return(BLUE);
75        else if(bb=='a' && (aa=='t' || aa=='u'))
76                return(BLUE);
77        else if(bb=='c' && aa=='g' )
78                return(BLUE);
79        else if(bb=='g' && aa=='c' )
80                return(BLUE);
81        else if(aa=='g' && (bb=='t' || bb=='u'))
82                return(AQUA);
83        else if(bb=='g' && (aa=='t' || aa=='u'))
84                return(AQUA);
85        else return(YELLOW);
86}
87
Note: See TracBrowser for help on using the repository browser.