-
Notifications
You must be signed in to change notification settings - Fork 2
/
JDIwj_ss.ps
197 lines (192 loc) · 5.16 KB
/
JDIwj_ss.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
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: ViennaRNA-2.3.1
%%CreationDate: Sat Jan 21 12:35:22 2017
%%Title: RNA Secondary Structure Plot
%%BoundingBox: 0 0 700 700
%%DocumentFonts: Helvetica
%%Pages: 1
%%EndComments
%Options:
% 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
% 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
end
%%EndProlog
RNAplot begin
% data start here
/sequence (\
GAUAACUGAAUCGCUAAGGAUGAAAGUCUAUGCGACAUUAUC\
) def
/coor [
[90.63385010 196.81382751]
[90.63385010 181.81382751]
[90.63385010 166.81382751]
[90.63385010 151.81382751]
[90.63385010 136.81382751]
[87.26926422 129.68705750]
[91.22169495 120.72889709]
[92.31662750 105.76891327]
[89.48287201 100.52357483]
[90.20418549 94.06735992]
[94.81948853 88.76224518]
[98.08094025 74.12110138]
[101.34239197 59.47996521]
[104.60384369 44.83882904]
[95.94080353 34.03864288]
[95.29994202 20.40689468]
[102.69338226 9.17328358]
[115.09552765 4.51021004]
[119.41701508 -9.85379887]
[123.73850250 -24.21780777]
[128.05998230 -38.58181763]
[123.77505493 -54.41126251]
[135.53153992 -65.84442902]
[151.23536682 -61.11984634]
[154.73179626 -45.09776688]
[142.42399597 -34.26033020]
[138.10250854 -19.89632225]
[133.78102112 -5.53231239]
[129.45953369 8.83169651]
[138.05503845 22.94257164]
[134.00088501 39.29953003]
[119.24498749 48.10028076]
[115.98352814 62.74141693]
[112.72207642 77.38256073]
[109.46062469 92.02369690]
[107.27661133 106.86384583]
[106.18167877 121.82382965]
[105.63385010 136.81382751]
[105.63385010 151.81382751]
[105.63385010 166.81382751]
[105.63385010 181.81382751]
[105.63385010 196.81382751]
] def
/pairs [
[1 42]
[2 41]
[3 40]
[4 39]
[5 38]
[7 37]
[8 36]
[11 35]
[12 34]
[13 33]
[14 32]
[18 29]
[19 28]
[20 27]
[21 26]
] def
init
% switch off outline pairs or bases by removing these lines
drawoutline
drawpairs
drawbases
% show it
showpage
end
%%EOF