source: tags/ms_r17q2/GDE/SUPPORT/Zuk_to_gen.c

Last change on this file was 13845, checked in by westram, 9 years ago
  • remove executable flag
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1#include <stdio.h>
2
3typedef struct Sequence
4{
5        int len;
6        char name[80];
7        char type[8];
8        char *nuc;
9} Sequence;
10
11
12main()
13{
14        char a[5000],b[5000],Inline[132];
15        int pos1,pos2,pos3,i,j,k,FLAG;
16        Sequence pair[2];
17
18
19        for(j=0;j<5000;j++)
20                b[j]='-';
21        FLAG = (int)gets(Inline);
22        for(j=0;FLAG;j++)
23        {
24                FLAG = (int)gets(Inline);
25                sscanf(Inline,"%d",&pos1);
26                if((sscanf(Inline,"%*6c %c  %d %d %d",&(a[j]),&k,&pos2,&pos3)
27                == 4) && (FLAG))
28                {
29                        if(pos3!=0)
30                        {
31                                if(pos1<pos3)
32                                {
33                                        b[pos1-1] = '[';
34                                        b[pos3-1] = ']';
35                                }
36                                else
37                                {
38                                        b[pos3-1] = '[';
39                                        b[pos1-1] = ']';
40                                }
41                        }
42                }
43                else
44                {
45                        pair[0].len = j;
46                        strcpy(pair[0].name,"HELIX");
47                        strcpy(pair[0].type,"TEXT");
48
49                        pair[1].len = j;
50/*
51                        sscanf(Inline,"%*24c %s",pair[1].name);
52*/
53                        strcpy(pair[1].name,"Sequence");
54                        strcpy(pair[1].type,"RNA");
55
56                        pair[0].nuc = b;
57                        pair[1].nuc = a;
58
59                        WriteGen(pair,stdout,2);
60                        for(j=0;j<5000;j++) b[j]='-';
61                        j = -1;
62                }
63        }
64        exit(0);
65}
66
67
68
69WriteGen(seq,file,numseq)
70Sequence *seq;
71FILE *file;
72int numseq;
73{
74        register i,j;
75        char temp[14];
76
77        for(j=0;j<numseq;j++)
78                fprintf(file,"%-.12s\n",seq[j].name);
79
80        fprintf(file,"ZZZZZZZZZZ\n");
81
82        for(j=0;j<numseq;j++)
83        {
84                strcpy(temp,seq[j].name);
85                for(i=strlen(temp);i<13;i++)
86                        temp[i] = ' ';
87                temp[i] = '\0';
88                fprintf(file,"LOCUS      %-.12s %s      %d BP\n",temp,
89                seq[j].type,seq[j].len);
90 
91                fprintf(file,"ORIGIN");
92                for(i=0;i<seq[j].len;i++)
93                {
94                        if(i%60 == 0)
95                                fprintf(file,"\n%9d",i+1);
96                        if(i%10 == 0)
97                                fprintf(file," ");
98                        fprintf(file,"%c",seq[j].nuc[i]);
99                }
100                fprintf(file,"\n//\n");
101        }
102        return 0;
103}
104
Note: See TracBrowser for help on using the repository browser.