4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
27 * Great Red Oystrich Makes All Chemists Sane
29 static char *SRCID_wheel_c
= "$Id$";
52 bool *bPhobics(int nres
,char *resnm
[])
58 nb
=get_strings("phbres.dat",&cb
);
61 for(i
=0; (i
<nres
); i
++) {
62 if (search_str(nb
,cb
,resnm
[i
]) != -1)
68 void wheel(char *fn
,int nres
,char *resnm
[],int r0
,real rot0
,char *title
)
70 const real fontsize
= 16;
71 const real gray
= 0.9;
72 const real fontasp
= 0.6;
73 const real fontwidth
= fontsize
*fontasp
;
77 real ring
,inner
,outer
;
86 for(i
=0; (i
<nres
); i
++) {
90 if ((sign
== '+') || (sign
== '-'))
91 resnm
[i
][sl
-1] = '\0';
92 sprintf(rnms
[i
],"%s-%d",resnm
[i
],i
+r0
);
93 if ((sign
== '+') || (sign
== '-')) {
99 slen
=max(slen
,(int)strlen(rnms
[i
]));
101 ring
=(2+slen
)*fontwidth
;
103 box
=inner
*1.5+(1+(nres
/ 18))*ring
;
105 bPh
=bPhobics(nres
,resnm
);
107 out
=ps_open(fn
,0,0,2.0*box
,2.0*box
);
111 ps_font(out
,efontHELV
,1.5*fontsize
);
112 ps_translate(out
,xc
,yc
);
114 ps_ctext(out
,0,-fontsize
*1.5/2.0,title
,eXCenter
);
115 ps_font(out
,efontHELV
,fontsize
);
117 fprintf(out
,"%g rotate\n",rot0
);
118 for(i
=0; (i
<nres
); ) {
120 ps_color(out
,gray
,gray
,gray
);
121 ps_fillarcslice(out
,0,0,inner
,outer
,-10,10);
124 ps_arcslice(out
,0,0,inner
,outer
,-10,10);
126 ps_ctext(out
,inner
+fontwidth
,-fontsize
/2.0,rnms
[i
],eXLeft
);
127 fprintf(out
,"-100 rotate\n");
138 void wheel2(char *fn
,int nres
,char *resnm
[],int r0
,real rot0
,char *title
)
140 const real fontsize
= 14;
141 const real gray
= 0.9;
142 const real fontasp
= 0.45;
144 const real fontwidth
= fontsize
*fontasp
;
148 real ring
,inner
,outer
;
153 for(i
=0; (i
<nres
); i
++) {
154 slen
=max(slen
,(int)strlen(resnm
[i
]));
156 fprintf(stderr
,"slen = %d\n",slen
);
157 ring
=(slen
)*fontwidth
;
159 box
=(1+(nres
/ (2*angle
)))*outer
;
161 out
=ps_open(fn
,0,0,2.0*box
,2.0*box
);
165 ps_font(out
,efontHELV
,1.5*fontsize
);
166 ps_translate(out
,xc
,yc
);
169 ps_ctext(out
,0,-fontsize
*1.5/2.0,title
,eXCenter
);
170 ps_font(out
,efontHELV
,fontsize
);
172 fprintf(out
,"%g rotate\n",rot0
);
173 for(i
=0; (i
<nres
); ) {
175 ps_color(out
,gray
,gray
,1.0);
176 ps_fillarcslice(out
,0,0,inner
,outer
,-angle
,angle
);
179 ps_arcslice(out
,0,0,inner
,outer
,-angle
,angle
);
181 ps_ctext(out
,inner
+fontwidth
,-fontsize
/2.0,resnm
[i
],eXLeft
);
182 fprintf(out
,"%d rotate\n",-2*angle
);
185 if ((i
% (2*angle
)) == 0) {
193 int main(int argc
,char *argv
[])
195 static char *desc
[] = {
196 "wheel plots a helical wheel representation of your sequence."
197 "The input sequence is in the .dat file where the first line contains",
198 "the number of residues and each consecutive line contains a residue"
202 static bool bNum
=TRUE
;
203 static char *title
=NULL
;
206 { "-r0", FALSE
, etINT
, {&r0
},
207 "The first residue number in the sequence" },
208 { "-rot0",FALSE
, etREAL
,{&rot0
},
209 "Rotate around an angle initially (90 degrees makes sense)" },
210 { "-T", FALSE
, etSTR
, {&title
},
211 "Plot a title in the center of the wheel (must be shorter than 10 characters, or it will overwrite the wheel)" },
212 { "-nn", FALSE
, etBOOL
,{&bNum
},
216 { efDAT
, "-f", NULL
, ffREAD
},
217 { efEPS
, "-o", NULL
, ffWRITE
}
219 #define NFILE asize(fnm)
224 CopyRight(stderr
,argv
[0]);
225 parse_common_args(&argc
,argv
,0,TRUE
,NFILE
,fnm
,asize(pa
),pa
,
226 asize(desc
),desc
,0,NULL
);
228 for(i
=1; (i
<argc
); i
++) {
229 if (strcmp(argv
[i
],"-r0") == 0) {
231 fprintf(stderr
,"First residue is %d\n",r0
);
233 else if (strcmp(argv
[i
],"-rot0") == 0) {
234 rot0
=atof(argv
[++i
]);
235 fprintf(stderr
,"Initial rotation is %g\n",rot0
);
237 else if (strcmp(argv
[i
],"-T") == 0) {
238 title
=strdup(argv
[++i
]);
239 fprintf(stderr
,"Title will be '%s'\n",title
);
241 else if (strcmp(argv
[i
],"-nn") == 0) {
243 fprintf(stderr
,"No residue numbers\n");
246 fatal_error(0,"Incorrect usage of option %s",argv
[i
]);
249 nres
=get_lines(ftp2fn(efDAT
,NFILE
,fnm
),&resnm
);
251 wheel(ftp2fn(efEPS
,NFILE
,fnm
),nres
,resnm
,r0
,rot0
,title
);
253 wheel2(ftp2fn(efEPS
,NFILE
,fnm
),nres
,resnm
,r0
,rot0
,title
);