-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalirna.ps
399 lines (392 loc) · 10.5 KB
/
alirna.ps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: PS_dot.c,v 1.38 2007/02/02 15:18:13 ivo Exp $, ViennaRNA-2.1.2
%%CreationDate: Mon Aug 26 11:09:05 2013
%%Title: RNA Secondary Structure Plot
%%BoundingBox: 66 210 518 662
%%DocumentFonts: Helvetica
%%Pages: 1
%%EndComments
%Options: -d2
% to switch off outline pairs of sequence comment or
% delete the appropriate line near the end of the file
%%BeginProlog
/RNAplot 100 dict def
RNAplot begin
/fsize 14 def
/outlinecolor {0.2 setgray} bind def
/paircolor {0.2 setgray} bind def
/seqcolor {0 setgray} bind def
/cshow { dup stringwidth pop -2 div fsize -3 div rmoveto show} bind def
/min { 2 copy gt { exch } if pop } bind def
/max { 2 copy lt { exch } if pop } bind def
/arccoords { % i j arccoords
% puts optimal x1 y1 x2 y2 coordinates used in bezier curves from i to j
% onto the stack
dup 3 -1 roll dup 4 -1 roll lt dup dup 5 2 roll {exch} if
dup 3 -1 roll dup 3 -1 roll exch sub 1 sub dup
4 -2 roll 5 -1 roll {exch} if 4 2 roll
sequence length dup 2 div exch 3 1 roll lt
{exch 5 -1 roll pop 4 -2 roll exch 4 2 roll}
{ 4 2 roll 5 -1 roll dup 6 1 roll {exch} if
4 -2 roll exch pop dup 3 -1 roll dup 4 1 roll
exch add 4 -1 roll dup 5 1 roll sub 1 sub
5 -1 roll not {4 -2 roll exch 4 2 roll} if
}ifelse
% compute the scalingfactor and prepare (1-sf) and sf*r
2 mul exch cpr 3 1 roll div dup
3 -1 roll mul exch 1 exch sub exch
% compute the coordinates
3 -1 roll 1 sub coor exch get aload pop % get coord for i
4 -1 roll dup 5 1 roll mul 3 -1 roll dup 4 1 roll add exch % calculate y1
4 -1 roll dup 5 1 roll mul 3 -1 roll dup 4 1 roll add exch % calculate x1
5 -1 roll 1 sub coor exch get aload pop % get coord for j
% duplicate j coord
dup 3 -1 roll dup 4 1 roll exch 8 2 roll
6 -1 roll dup 7 1 roll mul 5 -1 roll dup 6 1 roll add exch % calculate y2
6 -1 roll mul 5 -1 roll add exch % calculate x2
6 -2 roll % reorder
} bind def
/drawoutline {
gsave outlinecolor newpath
coor 0 get aload pop 0.8 0 360 arc % draw 5' circle of 1st sequence
currentdict /cutpoint known % check if cutpoint is defined
{coor 0 cutpoint getinterval
{aload pop lineto} forall % draw outline of 1st sequence
coor cutpoint 1 add get aload pop
2 copy moveto 0.8 0 360 arc % draw 5' circle of 2nd sequence
coor cutpoint 1 add coor length cutpoint 1 add sub getinterval
{aload pop lineto} forall} % draw outline of 2nd sequence
{coor {aload pop lineto} forall} % draw outline as a whole
ifelse
stroke grestore
} bind def
/drawpairs {
paircolor
0.7 setlinewidth
[9 3.01] 9 setdash
newpath
pairs {aload pop
currentdict (cpr) known
{ exch dup
coor exch 1 sub get aload pop moveto
exch arccoords curveto
}
{ coor exch 1 sub get aload pop moveto
coor exch 1 sub get aload pop lineto
}ifelse
} forall
stroke
} bind def
% draw bases
/drawbases {
[] 0 setdash
seqcolor
0
coor {
aload pop moveto
dup sequence exch 1 getinterval cshow
1 add
} forall
pop
} bind def
/init {
/Helvetica findfont fsize scalefont setfont
1 setlinejoin
1 setlinecap
0.8 setlinewidth
72 216 translate
% find the coordinate range
/xmax -1000 def /xmin 10000 def
/ymax -1000 def /ymin 10000 def
coor {
aload pop
dup ymin lt {dup /ymin exch def} if
dup ymax gt {/ymax exch def} {pop} ifelse
dup xmin lt {dup /xmin exch def} if
dup xmax gt {/xmax exch def} {pop} ifelse
} forall
/size {xmax xmin sub ymax ymin sub max} bind def
72 6 mul size div dup scale
size xmin sub xmax sub 2 div size ymin sub ymax sub 2 div
translate
} bind def
end
RNAplot begin
% extra definitions for standard anotations
/min { 2 copy gt { exch } if pop } bind def
/BLACK { 0 0 0 } def
/RED { 1 0 0 } def
/GREEN { 0 1 0 } def
/BLUE { 0 0 1 } def
/WHITE { 1 1 1 } def
/LabelFont { % font size LabelFont
exch findfont exch fsize mul scalefont setfont
} bind def
/Label { % i dx dy (text) Label
% write text at base i plus offset dx, dy
4 3 roll 1 sub coor exch get aload pop moveto
3 1 roll fsize mul exch fsize mul exch rmoveto
show
} bind def
/cmark { % i cmark draw circle around base i
newpath 1 sub coor exch get aload pop
fsize 2 div 0 360 arc stroke
} bind def
/gmark { % i j c gmark
% draw basepair i,j with c counter examples in gray
gsave
3 min [0 0.33 0.66 0.9] exch get setgray
1 sub dup coor exch get aload pop moveto
sequence exch 1 getinterval cshow
1 sub dup coor exch get aload pop moveto
sequence exch 1 getinterval cshow
grestore
} bind def
/segmark { % f i j lw r g b segmark
% mark segment [i,j] with outline width lw and color rgb
% use omark and Fomark instead
gsave
setrgbcolor setlinewidth
newpath
1 sub exch 1 sub dup
coor exch get aload pop moveto
currentdict (cpr) known
{
3 -1 roll dup 4 1 roll dup
{
3 1 roll dup 3 -1 roll dup
4 1 roll exch 5 2 roll exch
}
{
3 1 roll exch
} ifelse
1 exch { coor exch get aload pop lineto } for
{
dup 3 1 roll 1 add exch 1 add arccoords pop pop
4 2 roll 5 -1 roll coor exch get aload pop curveto
} if
}
{
exch 1 exch {
coor exch get aload pop lineto
} for
} ifelse
{ closepath fill } if stroke
grestore
} bind def
/omark { % i j lw r g b omark
% stroke segment [i..j] with linewidth lw, color rgb
false 7 1 roll segmark
} bind def
/Fomark { % i j r g b Fomark
% fill segment [i..j] with color rgb
% should precede drawbases
1 4 1 roll true 7 1 roll segmark
} bind def
/BFmark{ % i j k l r g b BFmark
% fill block between pairs (i,j) and (k,l) with color rgb
% should precede drawbases
gsave
setrgbcolor
newpath
currentdict (cpr) known
{
dup 1 sub coor exch get aload pop moveto % move to l
dup 1 sub 4 -1 roll dup 5 1 roll 1 sub 1 exch
{ coor exch get aload pop lineto } for % lines from l to j
3 -1 roll 4 -1 roll dup 5 1 roll arccoords curveto % curve from j to i
exch dup 4 -1 roll 1 sub exch 1 sub 1 exch
{ coor exch get aload pop lineto } for % lines from i to k
exch arccoords curveto% curve from k to l
}
{ exch 4 3 roll exch 1 sub exch 1 sub dup
coor exch get aload pop moveto
exch 1 exch { coor exch get aload pop lineto } for
exch 1 sub exch 1 sub dup
coor exch get aload pop lineto
exch 1 exch { coor exch get aload pop lineto } for
} ifelse
closepath fill stroke
grestore
} bind def
/hsb {
dup 0.3 mul 1 exch sub sethsbcolor
} bind def
/colorpair { % i j hue sat colorpair
% draw basepair i,j in color
% 1 index 0.00 ne {
gsave
newpath
hsb
fsize setlinewidth
currentdict (cpr) known
{
exch dup
coor exch 1 sub get aload pop moveto
exch arccoords curveto
}
{ 1 sub coor exch get aload pop moveto
1 sub coor exch get aload pop lineto
} ifelse
stroke
grestore
% } if
} bind def
end
%%EndProlog
RNAplot begin
% data start here
/sequence (\
_GACUUCGGUCC_AAGCUAAUGCACUCUGAUGAUCGCGUGGAUAU_GGCACGCAUUGAAUUGUUGGACACCGU___AAAU_GUCCUAACACGGGCGCAUCGGGCUUCGGUCCGGUUC\
) def
/coor [
[156.57707214 267.27508545]
[146.28674316 270.40966797]
[135.82464600 272.91186523]
[125.22961426 274.77239990]
[114.54094696 275.98431396]
[103.79831696 276.54318237]
[93.04159546 276.44686890]
[82.31069183 275.69577026]
[71.64543915 274.29269409]
[61.08540726 272.24276733]
[50.66978836 269.55368042]
[40.43723297 266.23538208]
[30.42571831 262.30014038]
[20.67239380 257.76263428]
[11.21345329 252.63967896]
[2.08400059 246.95025635]
[-6.68208456 240.71549988]
[-15.05227184 233.95855713]
[-22.99549866 226.70448303]
[-30.48228836 218.98022461]
[-37.48485947 210.81440735]
[-43.97721863 202.23738098]
[-49.93527985 193.28092957]
[-55.33692932 183.97831726]
[-60.16212463 174.36407471]
[-64.39295197 164.47384644]
[-68.01371765 154.34436035]
[-71.01098633 144.01321411]
[-73.37362671 133.51872253]
[-75.09288025 122.89984894]
[-76.16236115 112.19599152]
[-76.57810211 101.44686890]
[-76.33856201 90.69238281]
[-75.44462585 79.97243500]
[-73.89961243 69.32681274]
[-71.70925903 58.79501724]
[-68.88169098 48.41613388]
[-65.42739868 38.22867966]
[-61.35920715 28.27045822]
[-56.69220734 18.57842636]
[-51.44372177 9.18855095]
[-45.63322830 0.13567668]
[-39.28228760 -8.54660034]
[-32.41447067 -16.82605934]
[-25.05526352 -24.67197609]
[-17.23197365 -32.05523300]
[-8.97363377 -38.94843292]
[-0.31089342 -45.32599640]
[8.72410202 -51.16424942]
[18.09782219 -56.44153595]
[27.77548409 -61.13826370]
[37.72116852 -65.23700714]
[47.89797211 -68.72254944]
[58.26812744 -71.58197021]
[68.79315186 -73.80464172]
[79.43398285 -75.38232422]
[90.15113068 -76.30915833]
[100.90483093 -76.58171082]
[111.65517426 -76.19896698]
[122.36226654 -75.16235352]
[132.98637390 -73.47570038]
[143.48806763 -71.14528656]
[153.82836914 -68.17974854]
[163.96891785 -64.59008789]
[173.87208557 -60.38964081]
[183.50109863 -55.59398270]
[192.82025146 -50.22091293]
[201.79493713 -44.29037094]
[210.39186096 -37.82437134]
[218.57913208 -30.84690094]
[226.32633972 -23.38385582]
[233.60475159 -15.46293354]
[240.38735962 -7.11352730]
[246.64900208 1.63337851]
[252.36640930 10.74532318]
[257.51840210 20.18849373]
[262.08581543 29.92784500]
[266.05175781 39.92723465]
[269.40145874 50.14955521]
[272.12252808 60.55686951]
[274.20483398 71.11055756]
[275.64065552 81.77145386]
[276.42468262 92.50000000]
[291.42468262 92.50000000]
[306.42468262 92.50000000]
[317.42138672 81.14886475]
[333.22479248 80.98176575]
[344.45901489 92.09785461]
[344.45901489 107.90214539]
[333.22479248 119.01823425]
[317.42138672 118.85113525]
[306.42468262 107.50000000]
[291.42468262 107.50000000]
[276.42468262 107.50000000]
[270.61013794 145.54232788]
[256.69219971 181.42156982]
[235.33197021 213.43357849]
[207.54396057 240.05790710]
[216.16577148 252.33244324]
[224.78758240 264.60699463]
[233.40939331 276.88153076]
[242.03120422 289.15606689]
[250.65301514 301.43060303]
[259.27484131 313.70516968]
[274.36758423 320.11926270]
[276.09033203 336.42767334]
[262.67086792 345.85369873]
[247.91398621 338.70065308]
[247.00028992 322.32696533]
[238.37847900 310.05242920]
[229.75666809 297.77789307]
[221.13485718 285.50335693]
[212.51304626 273.22879028]
[203.89123535 260.95425415]
[195.26942444 248.67971802]
[186.03956604 254.20477295]
[176.49043274 259.15759277]
] def
/pairs [
[83 94]
[84 93]
[85 92]
[98 115]
[99 114]
[100 113]
[101 112]
[102 111]
[103 110]
[104 109]
] def
init
% switch off outline pairs or bases by removing these lines
drawoutline
drawpairs
drawbases
% Start Annotations
83 94 2 gmark
83 cmark
84 93 1 gmark
84 cmark
85 92 1 gmark
85 cmark
98 115 2 gmark
99 114 2 gmark
99 cmark
% End Annotations
% show it
showpage
end
%%EOF