34 double* info,
double* nseq,
Complex<float>* per,
double* freq,
char* pattern)
37 int left(70), bottom(500), width(500), height(200);
39 int npages = 2 + (
length-1)/500;
44 *fps <<
"%%Page: Info 1" << endl;
45 *fps <<
"/Helvetica findfont 14 scalefont setfont" << endl;
46 *fps <<
"40 740 moveto (" << filename <<
": " << title <<
") show" << endl;
47 *fps <<
"/Left " << left <<
" def\n/Bottom " << bottom <<
" def" << endl;
48 *fps <<
"/Height " << height <<
" def\n/Width " << width <<
" def" << endl;
50 *fps <<
"/Data [\n%Pos Info nSeq" << endl;
52 *fps << i+1 <<
" " << info[i] <<
" " << nseq[i] << endl;
53 *fps <<
"] def" << endl;
55 *fps <<
"/Helvetica findfont 12 scalefont setfont" << endl;
56 *fps <<
"/x_Min 0 def\n/y_Min 0 def\n/x_Max " <<
length <<
" def\n/y_Max 4.3 def" << endl;
57 *fps <<
"/x_Scale Width x_Max x_Min sub div def" << endl;
58 *fps <<
"/y_Scale Height y_Max y_Min sub div def" << endl;
59 *fps <<
"/Frame { newpath 0 0 moveto 0 Height lineto Width Height lineto Width 0 lineto closepath } def" << endl;
61 *fps << left-45 <<
" " << bottom+40 <<
" moveto gsave 90 rotate (Information content) show grestore" << endl;
66 ps_scale(fps, left, bottom, left, bottom+height, 0, 4.3, 1.0,
69 *fps <<
"gsave" << endl;
70 *fps <<
" Left Bottom translate Frame stroke Frame clip" << endl;
71 *fps <<
" /x Data 0 get x_Min sub x_Scale mul def" << endl;
72 *fps <<
" /y Data 1 get y_Min sub y_Scale mul def" << endl;
73 *fps <<
" x y moveto" << endl;
74 *fps <<
" 3 3 Data length 3 sub {" << endl;
75 *fps <<
" /x_Index exch def" << endl;
76 *fps <<
" /y_Index x_Index 1 add def" << endl;
77 *fps <<
" /x Data x_Index get x_Min sub x_Scale mul def" << endl;
78 *fps <<
" /y Data y_Index get y_Min sub y_Scale mul def" << endl;
79 *fps <<
" x y lineto" << endl;
80 *fps <<
" } for stroke" << endl;
81 *fps <<
"grestore" << endl;
88 *fps <<
"showpage" << endl;
92 for ( page=2; page<=npages; page++ ) {
93 *fps <<
"%Page: Logo " << page << endl;
94 *fps <<
"/Helvetica findfont 16 scalefont setfont" << endl;
95 *fps <<
"40 740 moveto (Sequence Logo: " << filename <<
") show" << endl;
96 *fps <<
"/TopLine 640 def\n/LineHeight 60 def" << endl;
97 *fps <<
"/FontSize 14 def" << endl;
98 *fps <<
"/FontHeight FontSize 0.6 mul def" << endl;
99 *fps <<
"/CharWidth FontSize 0.6 mul def" << endl;
100 *fps <<
"/Courier-Bold findfont FontSize scalefont setfont" << endl;
101 *fps <<
"/Letters (ABCDEFGHIJKLMNOPQRSTUVWXYZ) def" << endl;
102 *fps <<
"/Red [0.5 0.0 1.0 1.0 1.0 0.5 0.8 0.0 0.5 0.9 0.0 0.5 1.0 0.0 0.9 " << endl;
103 *fps <<
" 0.8 0.0 0.0 0.8 0.8 0.9 0.5 0.5 0.1 0.5 0.0 ] def " << endl;
104 *fps <<
"/Green [0.5 1.0 1.0 0.0 0.0 0.5 0.5 0.0 0.5 0.9 0.0 0.5 1.0 1.0 0.9 " << endl;
105 *fps <<
" 0.5 1.0 0.0 0.5 0.5 0.9 0.5 0.5 0.1 0.5 1.0 ] def " << endl;
106 *fps <<
"/Blue [0.5 0.0 0.0 0.0 0.0 0.5 0.8 1.0 0.5 0.9 1.0 0.5 0.0 0.0 0.9 " << endl;
107 *fps <<
" 0.8 0.0 1.0 0.8 0.8 0.9 0.5 0.5 0.1 0.5 0.0 ] def " << endl;
108 *fps <<
"/SeqPattern [" << endl;
109 for ( i=pagestart; i<pagestart+500 && i<
length; i++ ) {
112 for ( j=nres-1; j>=0; j-- ) {
113 if ( pattern[nres*i+j] >=
'A' && freq[nres*i+j] > 0.1 ) {
115 *fps << pattern[nres*i+j];
119 if ( n < 1 ) *fps <<
"X";
122 *fps <<
"] def" << endl;
123 *fps <<
"/Height [" << endl;
124 for ( i=pagestart; i<pagestart+500 && i<
length; i++ ) {
126 for ( j=nres-1; j>=0; j-- ) {
127 if ( pattern[nres*i+j] >=
'A' && freq[nres*i+j] > 0.1 ) {
128 *fps << freq[nres*i+j] <<
" ";
132 if ( n < 1 ) *fps <<
"0.05 ";
135 *fps <<
"] def" << endl;
136 *fps <<
"/HeightIndex 0 def" << endl;
137 *fps <<
"/LineIndex 0 def" << endl;
138 *fps <<
"/theLine TopLine def" << endl;
139 *fps <<
"gsave" << endl;
140 *fps <<
" 40 theLine 15 sub moveto (" << pagestart <<
") show" << endl;
141 *fps <<
" 40 theLine moveto" << endl;
142 *fps <<
" 0 1 SeqPattern length 1 sub { %% Get a pattern at each position" << endl;
143 *fps <<
" /PatternIndex exch def" << endl;
144 *fps <<
" LineIndex PatternIndex 50 div truncate lt {" << endl;
145 *fps <<
" /theLine theLine LineHeight sub def" << endl;
146 *fps <<
" /LineIndex PatternIndex 50 div truncate def" << endl;
147 *fps <<
" 40 theLine 15 sub moveto" << endl;
148 *fps <<
" PatternIndex " << pagestart <<
" add (xxxx) cvs show" << endl;
149 *fps <<
" 40 theLine moveto" << endl;
150 *fps <<
" } if" << endl;
151 *fps <<
" /LineIndex PatternIndex 50 div def" << endl;
152 *fps <<
" /aPattern {SeqPattern PatternIndex get} def" << endl;
153 *fps <<
" gsave" << endl;
154 *fps <<
" 0 1 aPattern length 1 sub { %% Get the character and its colour and height" << endl;
155 *fps <<
" /CharIndex exch def" << endl;
156 *fps <<
" /aChar aPattern CharIndex 1 getinterval def" << endl;
157 *fps <<
" /CharHeight Height HeightIndex get def" << endl;
158 *fps <<
" 0 1 Letters length 1 sub {" << endl;
159 *fps <<
" /anIndex exch def" << endl;
160 *fps <<
" aChar Letters anIndex 1 getinterval eq { /LetterIndex anIndex def } if" << endl;
161 *fps <<
" } for" << endl;
162 *fps <<
" gsave" << endl;
163 *fps <<
" Red LetterIndex get Green LetterIndex get Blue LetterIndex get setrgbcolor" << endl;
164 *fps <<
" 1 CharHeight scale" << endl;
165 *fps <<
" aChar show" << endl;
166 *fps <<
" grestore" << endl;
167 *fps <<
" 0 CharHeight FontHeight mul rmoveto" << endl;
168 *fps <<
" /HeightIndex HeightIndex 1 add def" << endl;
169 *fps <<
" } for" << endl;
170 *fps <<
" grestore" << endl;
171 *fps <<
" CharWidth 0 rlineto" << endl;
172 *fps <<
" } for stroke" << endl;
173 *fps <<
"grestore" << endl;
174 *fps <<
"showpage" << endl;
198 int left(70), bottom(500), width(500), height(200);
204 *fps <<
"%%Page: Hphob 1" << endl;
205 *fps <<
"/Helvetica findfont 16 scalefont setfont" << endl;
206 *fps <<
"40 740 moveto (" << filename <<
": " << title <<
") show" << endl;
207 *fps <<
"/Left " << left <<
" def\n/Bottom " << bottom <<
" def" << endl;
208 *fps <<
"/Height " << height <<
" def\n/Width " << width <<
" def" << endl;
211 *fps <<
"/Data [" << endl <<
"%Pos Hphob HPseg" << endl;
212 for ( i=0; i<
length; i++ ) {
213 *fps << i+1 <<
" " << Hphob[i] <<
" " << HPseg[i] << endl;
214 if ( y_min > Hphob[i] ) y_min = Hphob[i];
215 if ( y_max < Hphob[i] ) y_max = Hphob[i];
217 *fps <<
"] def" << endl;
219 y_min = 0.01*floor(100*y_min);
220 y_max = 0.01*floor(100*y_max + 1);
222 *fps <<
"/Helvetica findfont 12 scalefont setfont" << endl;
223 *fps <<
"/x_Min 0 def\n/y_Min " << y_min <<
" def" << endl;
224 *fps <<
"/x_Max " <<
length <<
" def\n/y_Max " << y_max <<
" def" << endl;
225 *fps <<
"/x_Scale Width x_Max x_Min sub div def" << endl;
226 *fps <<
"/y_Scale Height y_Max y_Min sub div def" << endl;
228 *fps <<
"/Frame { newpath 0 0 moveto 0 Height lineto Width Height lineto Width 0 lineto closepath } def" << endl;
230 *fps << left-45 <<
" " << bottom+30 <<
" moveto gsave 90 rotate (Hydrophobicity (kcal/mol)) show grestore" << endl;
235 ps_scale(fps, left, bottom, left, bottom+height, y_min, y_max, (y_max - y_min)/5,
238 *fps <<
"gsave" << endl;
239 *fps <<
" Left Bottom translate Frame stroke Frame clip stroke" << endl;
240 *fps <<
" 20 setlinewidth 0.5 setgray" << endl;
241 *fps <<
" /x Data 0 get x_Min sub x_Scale mul def" << endl;
242 *fps <<
" /y 1 y_Min sub y_Scale mul def" << endl;
243 *fps <<
" x y moveto" << endl;
244 *fps <<
" 3 3 Data length 3 sub {" << endl;
245 *fps <<
" /x_Index exch def" << endl;
246 *fps <<
" /x Data x_Index get x_Min sub x_Scale mul def" << endl;
247 *fps <<
" Data x_Index 2 add get 0 gt {" << endl;
248 *fps <<
" x y lineto" << endl;
249 *fps <<
" }{" << endl;
250 *fps <<
" x y moveto" << endl;
251 *fps <<
" } ifelse" << endl;
252 *fps <<
" } for stroke" << endl;
253 *fps <<
"grestore" << endl;
255 *fps <<
"gsave" << endl;
256 *fps <<
" Left Bottom translate Frame stroke Frame clip" << endl;
257 *fps <<
" /x Data 0 get x_Min sub x_Scale mul def" << endl;
258 *fps <<
" /y Data 1 get y_Min sub y_Scale mul def" << endl;
259 *fps <<
" x y moveto" << endl;
260 *fps <<
" 3 3 Data length 3 sub {" << endl;
261 *fps <<
" /x_Index exch def" << endl;
262 *fps <<
" /y_Index x_Index 1 add def" << endl;
263 *fps <<
" /x Data x_Index get x_Min sub x_Scale mul def" << endl;
264 *fps <<
" /y Data y_Index get y_Min sub y_Scale mul def" << endl;
265 *fps <<
" x y lineto" << endl;
266 *fps <<
" } for stroke" << endl;
267 *fps <<
"grestore" << endl;
274 *fps <<
"showpage" << endl;
284 int i, bar_height(30);
285 double x_scale(500/(
length - 1.0));
286 double y_scale(bar_height);
288 *fps <<
"/Data [" << endl <<
"%Pos nSeq" << endl;
289 for ( i=0; i<
length; i++ ) {
290 *fps << i+1 <<
" " << nseq[i] << endl;
291 if ( nseq[i]*y_scale > bar_height ) y_scale = bar_height/nseq[i];
293 *fps <<
"] def" << endl;
294 *fps <<
"/Left 70 def\n/Bottom 70 def" << endl;
295 *fps <<
"/x_Min 1 def\n/x_Scale " << x_scale <<
" def\n/y_Scale " << y_scale <<
" def" << endl;
296 *fps <<
"gsave" << endl;
297 *fps <<
" Left Bottom translate" << endl;
298 *fps <<
" /x Data 0 get x_Min sub x_Scale mul def" << endl;
299 *fps <<
" /y " << bar_height <<
" Data 1 get y_Scale mul add def" << endl;
300 *fps <<
" x y moveto" << endl;
301 *fps <<
" 2 2 Data length 2 sub {" << endl;
302 *fps <<
" /x_Index exch def" << endl;
303 *fps <<
" /y_Index x_Index 1 add def" << endl;
304 *fps <<
" /x Data x_Index get x_Min sub x_Scale mul def" << endl;
305 *fps <<
" /y " << bar_height <<
" Data y_Index get y_Scale mul add def" << endl;
306 *fps <<
" x y lineto" << endl;
307 *fps <<
" } for stroke" << endl;
308 *fps <<
" /x Data 0 get x_Min sub x_Scale mul def" << endl;
309 *fps <<
" /y " << bar_height <<
" Data 1 get y_Scale mul sub def" << endl;
310 *fps <<
" x y moveto" << endl;
311 *fps <<
" 2 2 Data length 2 sub {" << endl;
312 *fps <<
" /x_Index exch def" << endl;
313 *fps <<
" /y_Index x_Index 1 add def" << endl;
314 *fps <<
" /x Data x_Index get x_Min sub x_Scale mul def" << endl;
315 *fps <<
" /y " << bar_height <<
" Data y_Index get y_Scale mul sub def" << endl;
316 *fps <<
" x y lineto" << endl;
317 *fps <<
" } for stroke" << endl;
318 *fps <<
"grestore" << endl;
327 int left(70), bottom(300), width(500), height(200);
330 *fps <<
"/Per [" << endl <<
"%Pos Amp Phi" << endl;
332 for ( i=0; i<
length; i++ ) {
333 *fps << i+1 <<
" " << per[i].
amp() <<
" " << per[i].
phi()*180/
M_PI << endl;
334 if ( y_max < per[i].amp() ) y_max = per[i].
amp();
336 *fps <<
"] def" << endl;
338 y_max = 0.1*floor(10*y_max + 1);
340 *fps <<
"/Helvetica findfont 12 scalefont setfont" << endl;
341 *fps <<
"/Left " << left <<
" def\n/Bottom " << bottom <<
" def" << endl;
342 *fps <<
"/Height " << height <<
" def\n/Width " << width <<
" def" << endl;
343 *fps <<
"/x_Min 1 def\n/y_Min 0 def" << endl;
344 *fps <<
"/x_Max " <<
length <<
" def\n/y_Max " << y_max <<
" def" << endl;
345 *fps <<
"/x_Scale Width x_Max x_Min sub div def" << endl;
346 *fps <<
"/y_Scale Height y_Max y_Min sub div def" << endl;
347 *fps << left-45 <<
" " << bottom+70 <<
" moveto gsave 90 rotate (Amplitude) show grestore" << endl;
349 ps_scale(fps, left, bottom, left, bottom+height, 0, y_max, y_max/4.5,
352 *fps <<
"/Frame { newpath 0 0 moveto 0 Height lineto Width Height lineto Width 0 lineto closepath } def" << endl;
353 *fps <<
"gsave" << endl;
354 *fps <<
" Left Bottom translate Frame stroke Frame clip" << endl;
355 *fps <<
" /x Per 0 get x_Min sub x_Scale mul def" << endl;
356 *fps <<
" /y Per 1 get y_Min sub y_Scale mul def" << endl;
357 *fps <<
" x y moveto" << endl;
358 *fps <<
" 3 3 Per length 3 sub {" << endl;
359 *fps <<
" /x_Index exch def" << endl;
360 *fps <<
" /y_Index x_Index 1 add def" << endl;
361 *fps <<
" /x Per x_Index get x_Min sub x_Scale mul def" << endl;
362 *fps <<
" /y Per y_Index get y_Min sub y_Scale mul def" << endl;
363 *fps <<
" x y lineto" << endl;
364 *fps <<
" } for stroke" << endl;
365 *fps <<
"grestore" << endl;
370 *fps <<
"/Left " << left <<
" def\n/Bottom " << bottom <<
" def" << endl;
371 *fps <<
"/Height " << height <<
" def\n/Width " << width <<
" def" << endl;
372 *fps << left-40 <<
" " << bottom <<
" moveto (-180) show" << endl;
373 *fps << left-40 <<
" " << bottom+height/2-8 <<
" moveto ( 0) show" << endl;
374 *fps << left-40 <<
" " << bottom+height-16 <<
" moveto ( 180) show" << endl;
375 *fps << left-45 <<
" " << bottom <<
" moveto gsave 90 rotate (Phase (degrees)) show grestore" << endl;
377 *fps << left+190 <<
" " << bottom-40 <<
" moveto (Alignment position) show" << endl;
378 *fps <<
"/y_Min -180 def\n/y_Max 180 def" << endl;
379 *fps <<
"/y_Scale Height y_Max y_Min sub div def" << endl;
380 *fps <<
"/Frame { newpath 0 0 moveto 0 Height lineto Width Height lineto Width 0 lineto closepath } def" << endl;
381 *fps <<
"gsave" << endl;
382 *fps <<
" Left Bottom translate Frame stroke Frame clip" << endl;
383 *fps <<
" /x Per 0 get x_Min sub x_Scale mul def" << endl;
384 *fps <<
" /y Per 2 get y_Min sub y_Scale mul def" << endl;
385 *fps <<
" x y moveto" << endl;
386 *fps <<
" /last_x x def" << endl;
387 *fps <<
" /last_y y def" << endl;
388 *fps <<
" 3 3 Per length 3 sub {" << endl;
389 *fps <<
" /x_Index exch def" << endl;
390 *fps <<
" /y_Index x_Index 2 add def" << endl;
391 *fps <<
" /x Per x_Index get x_Min sub x_Scale mul def" << endl;
392 *fps <<
" /y Per y_Index get y_Min sub y_Scale mul def" << endl;
393 *fps <<
" /y_diff y last_y sub def" << endl;
394 *fps <<
" y_diff 0 lt {" << endl;
395 *fps <<
" y_diff Height 2 div neg gt { x y lineto }" << endl;
396 *fps <<
" { x y Height add lineto last_x last_y Height sub moveto x y lineto" << endl;
397 *fps <<
" } ifelse" << endl;
398 *fps <<
" }{" << endl;
399 *fps <<
" y_diff Height 2 div lt { x y lineto }" << endl;
400 *fps <<
" { x y Height sub lineto last_x last_y Height add moveto x y lineto" << endl;
401 *fps <<
" } ifelse" << endl;
402 *fps <<
" } ifelse" << endl;
403 *fps <<
" x y lineto" << endl;
404 *fps <<
" /last_x x def" << endl;
405 *fps <<
" /last_y y def" << endl;
406 *fps <<
" } for stroke" << endl;
407 *fps <<
"grestore" << endl;