-
Notifications
You must be signed in to change notification settings - Fork 15
/
Nussinov.html
185 lines (165 loc) · 7.92 KB
/
Nussinov.html
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
<script>
function showRecursion() {
console.log("val:", $("#formula").val());
setTimeout(function () { //introduces a little delay, so that the thing will close slowly and neatly
document.getElementById("recursion").innerHTML = availableAlgorithms[$("#formula").val()].getRecursionInLatex();
rerendermath();
$(".animate1").empty();
}, 450);
rerendermath();
};
</script>
<div class="row" id="introduction">
<div class="colW600">
The algorithm by
<a href="http://dx.doi.org/10.1137/0135006">Ruth Nussinov et al. (1978)</a>
computes for a given
RNA sequence the maximal number of base pairs of any nested structure.
To this end, dynamic programming is applied, which also enables the
identification of an according maximally base paired structure via traceback.
<br />
<br />
Here, we provide different recursions to fill the dynamic programming
table $D$, where an entry $D_{i,j}$ provides the maximal number of
base pairs of any nested structure for the subsequence from position $i$ to $j$.
The entry $D_{1,n}$ provides the overall maximal number of base pairs
for the whole sequence of length $n$. Watson-Crick as well as GU base
pairs are considered complementary.
<br />
Furthermore, beside the identification of an according optimal structure
via traceback, we provide an exhaustive enumeration of up to 15 suboptimal structures
using the algorithm by
<a href="http://dx.doi.org/10.1002/(SICI)1097-0282(199902)49:2%3C145::AID-BIP4%3E3.0.CO;2-G">Stefan Wuchty et al. (1999)</a>.
<br />
For each structure, the according traceback is visualized. Note, for
recursions implementing an
ambiguous decomposition different tracebacks might yield the same structure.
These will be listed several times, once for each traceback.
</div>
<div class="colW150">
<img alt="nested RNA structure" src="Nussinov-120x90.png" width=120 height=90 >
</div>
</div>
<div id="inputContainer">
<div class="row">
<div class="colW200" style="font-size: 120%; vertical-align: bottom; ">RNA sequence $S$:</div>
<div class="colW400">
<input id="rawSeq" data-bind="value: rawSeq" class="userInput"
placeholder="Example 'GCACGACG'" onkeydown="validate(event)"
style="text-transform:uppercase" />
</div>
</div>
<div class="row">
<div class="colW200" style="font-size: 120%">Minimal loop length $l$:</div>
<div class="colW400">
<select data-bind="value: loopLength" id="ll" style="width:40px;">
<option value=0>0</option>
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
</select>
<label for="ll" style="margin-left:10px;">i.e. minimal number of enclosed positions</label>
</div>
</div>
<div class="row">
<div class="colW200" style="font-size: 120%">Delta #bp to maximum:</div>
<div class="colW400">
<select id="delta" data-bind="value: input.delta" style="width:40px;">
<option value=0>0</option>
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
</select>
<label for="delta" style="margin-left:10px;">for suboptimal traceback</label>
</div>
</div>
<div class="row">
<script type="text/javascript">
showRecursion();
</script>
<div class="colW200" style="font-size: 120%">Recursion to be used:</div>
<div class="colW400">
<select onchange="showRecursion()" id= "formula" data-bind="value: input.recursion" style="width:150px;">
<option value="nussinovUnique" selected="selected">Nussinov et al. (1978)</option>
<option value="nussinovAmbiguous1">Ambiguous Variant 1</option>
<option value="nussinovAmbiguous2">Ambiguous Variant 2</option>
<option value="nussinovMostAmbiguous">Ambiguous Variant 3</option>
</select>
<label for="formula" style="margin-left:10px;">used for matrix calculating</label>
</div>
</div>
<div class="row" id="recursion" style="height: 110px;"></div>
<div id="rec_select" style="display: none;">nussinovUnique</div>
</div>
<div class="row" id="output" >
<div class="col_table">
<canvas id="CanvasLayer" style="z-index: 0; border: 0px solid; position: absolute; width: 0px; height: 0px"></canvas>
<table style="margin:0;">
<thead>
<tr>
<th class="cell_th">$D$</th>
<th class="cell_th"></th>
<!-- ko foreach: { data: seqList, as: 'base' } -->
<th class="cell_th" data-bind="writeSeq: [base, $index()+1]"></th>
<!-- /ko -->
</tr>
</thead>
<tbody id="matrix_body" data-bind="foreach: { data: cells()[0], as: 'cell' }">
<tr>
<th class="cell_th" data-bind="writeSeq: [$root.seqList()[$index()], $index()+1]"></th>
<!-- ko foreach: { data: cell, as: 'v' } -->
<td class="cell" data-bind="text: v.i < v.j+2 ? v.value : '', attr: {title: 'i=' + v.i + ' j=' + v.j}, event: { mousedown: $root.clickCell.bind(this) }"></td>
<!-- /ko -->
</tr>
</tbody>
</table>
<br />
<a href="javascript:generate_tables()">Download Table</a>
<table style="display:none;margin:0;">
<tr>
<td id="info"
style="display: none; border: 1px solid grey; padding: 6px 14px;letter-spacing: 2px; background: #fff;"></td>
</tr>
</table>
</div>
<div class="col_structures">
<table id="structures" style="margin:0;" onchange="fornaClear()">
<thead>
<tr>
<th id="structTableHeading">Optimal Structures</th>
</tr>
</thead>
<tbody data-bind="foreach: { data: tracebacks, as: 'tb' }">
<tr><td id="structTableCells" data-bind="text: tb.structure, event: {mousedown:$parent.clickStructure}"
onclick="fornaRendering( document.getElementById('rawSeq').value, this)"></td></tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col">
Select a structure from the list or (multiple times) a cell of $D$
to see according tracebacks. Note, the structure list is limited to
the first 15 structures identified via traceback and thus depends
on the recursion case order.
<br>
Below, we provide a graphical depiction of the selected structure.
Note, the rendering does not support a minimal loop length of 0.
</div>
</div>
<div id="structureVisualization">
<div id="fornaInputStructure" style="height: 300px; background:white;"></div>
<span style="padding-left:15px;font-size:80%;">
Visualization done with
<a href="http://rna.tbi.univie.ac.at/forna">forna</a>.
Base pairs are given by red edges, the sequence backbone is given by
gray edges.
</span>
</div>
<script src="js/visualize.js"></script>
<!-- ensure structure list changes clear the forna rendering -->
<script type="text/javascript">/* <![CDATA[ */$("#structures").bind("DOMSubtreeModified", fornaClear);/* ]]> */</script>