-
Notifications
You must be signed in to change notification settings - Fork 0
/
rna.ps
386 lines (375 loc) · 7.62 KB
/
rna.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
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: ViennaRNA-2.6.4
%%CreationDate: Mon Oct 9 18:27:19 2023
%%Title: RNA Secondary Structure Plot
%%BoundingBox: 0 0 700 700
%%DocumentFonts: Helvetica
%%Pages: 1
%%EndComments
% Program options:
% To switch off outline pairs of sequence comment or
% delete the appropriate line near the end of the file
/RNAplot 100 dict def
RNAplot begin
%%BeginProlog
/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
} {
/i 0 def
coor {
/p coor i get def
/a arcs i get def
/l a length def
l 0 eq {
%% standard point... draw simple line
p 0 2 getinterval aload pop lineto
} {
%% point in loop... draw arc around loop center
/clockwise a 5 get def
clockwise 0.0000000 gt {
a 0 5 getinterval aload pop arcn
} {
a 0 5 getinterval aload pop arc
} ifelse
} ifelse
/i i 1 add def
} forall
}
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
% 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
/width {xmax xmin sub} bind def
/height {ymax ymin sub} bind def
10 10 translate
680 size 10 add div dup scale
size width sub width xmin sub xmax sub add 2 div 5 add
size height sub height ymin sub ymax sub add 2 div 5 add
translate
} bind def
%%EndProlog
% data start here
/sequence { (\
AUGCGUACGAUCGAUCGAUCGAUAUGCGUACGAUCGAUCGAUCGAUAUGCGUACGAUCGAUCGAUCGAUAUGCGUACGAUCGAUCGAUCGAU\
) } def
/len { sequence length } bind def
/coor [
[78.42173767 351.43972778]
[64.02448273 356.78900146]
[48.88415146 354.20715332]
[37.07341385 344.38870239]
[31.76929855 329.97476196]
[34.39858627 314.84259033]
[44.25401306 303.06268311]
[58.68451691 297.80377197]
[61.20603180 283.01724243]
[63.72754288 268.23068237]
[66.24906158 253.44415283]
[68.77056885 238.65759277]
[71.29208374 223.87104797]
[73.81359863 209.08450317]
[76.33511353 194.29795837]
[78.85662842 179.51141357]
[81.37813568 164.72486877]
[83.89965057 149.93832397]
[86.42116547 135.15176392]
[88.94268036 120.36522675]
[91.46419525 105.57867432]
[89.58316803 97.55493927]
[94.32868195 90.33885956]
[97.34815979 75.64591217]
[100.36763763 60.95296478]
[103.38711548 46.26001358]
[106.40659332 31.56706429]
[109.42607117 16.87411499]
[112.44554901 2.18116641]
[115.46502686 -12.51178265]
[118.23591614 -27.25363350]
[120.75743103 -42.04018021]
[123.27894592 -56.82672882]
[125.80045319 -71.61327362]
[128.32197571 -86.39981842]
[130.84349060 -101.18637085]
[133.36499023 -115.97291565]
[135.88650513 -130.75946045]
[138.40802002 -145.54600525]
[140.92953491 -160.33255005]
[143.45104980 -175.11911011]
[145.97256470 -189.90565491]
[148.49407959 -204.69219971]
[151.01559448 -219.47874451]
[139.55493164 -229.80622864]
[135.51911926 -244.69635010]
[140.19596863 -259.39773560]
[152.09312439 -269.21920776]
[167.41421509 -271.02679443]
[181.27037048 -264.24368286]
[189.24012756 -251.03434753]
[188.78036499 -235.61384583]
[180.03779602 -222.90278625]
[165.80213928 -216.95722961]
[163.28062439 -202.17068481]
[160.75910950 -187.38414001]
[158.23759460 -172.59759521]
[155.71607971 -157.81103516]
[153.19456482 -143.02449036]
[150.67304993 -128.23794556]
[148.15155029 -113.45140076]
[145.63003540 -98.66485596]
[143.10852051 -83.87831116]
[140.58700562 -69.09175873]
[138.06549072 -54.30521393]
[135.54397583 -39.51866531]
[133.02246094 -24.73212051]
[135.04315186 -17.46032906]
[130.15797424 -9.49230480]
[127.13849640 5.20064402]
[124.11901855 19.89359283]
[121.09954071 34.58654404]
[118.08006287 49.27949142]
[115.06058502 63.97243881]
[112.04110718 78.66539001]
[109.02162933 93.35833740]
[106.25074005 108.10018921]
[103.72922516 122.88673401]
[101.20771027 137.67327881]
[98.68619537 152.45982361]
[96.16468811 167.24638367]
[93.64317322 182.03292847]
[91.12165833 196.81947327]
[88.60014343 211.60601807]
[86.07862854 226.39256287]
[83.55712128 241.17910767]
[81.03560638 255.96565247]
[78.51409149 270.75219727]
[75.99257660 285.53875732]
[73.47106171 300.32528687]
[85.34312439 310.06951904]
[90.73749542 324.44992065]
] def
/arcs [
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
] def
/pairs [
[8 90]
[9 89]
[10 88]
[11 87]
[12 86]
[13 85]
[14 84]
[15 83]
[16 82]
[17 81]
[18 80]
[19 79]
[20 78]
[21 77]
[23 76]
[24 75]
[25 74]
[26 73]
[27 72]
[28 71]
[29 70]
[30 69]
[31 67]
[32 66]
[33 65]
[34 64]
[35 63]
[36 62]
[37 61]
[38 60]
[39 59]
[40 58]
[41 57]
[42 56]
[43 55]
[44 54]
] def
init
% switch off outline pairs or bases by removing these lines
drawoutline
drawpairs
drawbases
showpage
end
%%EOF