-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprint_gene.html
More file actions
393 lines (360 loc) · 12 KB
/
print_gene.html
File metadata and controls
393 lines (360 loc) · 12 KB
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
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr align="left" valign="top">
<td>
<table align="left" border="0" cellspacing="0" cellpadding="0">
<tr><td><font color="Green">Green</font>: </td><td>0 Frame Start Codon</td></tr>
<tr><td><font color="Red">Red</font>: </td><td>0 Frame Stop Codon</td></tr>
<tr><td><font color="Blue">Blue</font>: </td><td>Slippery Site</td></tr>
<tr><td><font color="Orange">Orange</font>: </td><td>First -1 PTC</td></tr>
<tr><td><font color="#FF0080">Maroon</font>: </td><td>SNP</td></tr>
</table>
</td>
</tr>
<tr align="left" valign="top">
</tr>
</table>
% my $sp = $db->MySelect(statement => "SELECT species FROM gene_info WHERE accession = ?", vars => [$accession], type => 'single');
% my $in = $db->MySelect(statement => "SELECT orf_start, orf_stop, mrna_seq, direction, id FROM genome WHERE accession = ?", vars =>[$accession], type => 'row');
% my $mt = "mfe_$sp";
% $mt = "mfe_virus" if ($mt =~ /virus/);
% my $slips = $db->MySelect(statement =>"SELECT DISTINCT(start), bp_mstop FROM $mt WHERE accession = ? ORDER BY start", vars => [$accession],);
% my $snp_struct = {};
% if ($sp eq 'homo_sapiens') {
% my $snp_data = $db->MySelect(statement =>"SELECT id, cluster_id, location, alleles FROM snp WHERE gene_acc = ?", vars => [$accession], type => 'list_of_hashes');
% foreach my $snp_row (@{$snp_data}) {
%# my $snp_start = $snp_row->{location} + $in->[0];
% my $snp_start = $snp_row->{location};
% my $snp_end = '';
% if ($snp_start =~ /\.\./) {
% ($snp_start, $snp_end) = split(/\.\./, $snp_start);
% $snp_struct->{$snp_start} = $snp_end;
% $snp_struct->{$snp_end} = $snp_row; ## This is when a position evaluates to HASH
% } else {
% $snp_struct->{$snp_start} = $snp_row;
% }
% }
% }
% my (@slipsites, @minus);
% foreach my $s (@{$slips}) {
% push (@slipsites, $s->[0]);
% push (@minus, $s->[1]);
% }
% my $str = HTMLMisc::Create_Pretty_mRNA(show_frame => $show_frame, accession => $accession, mrna_seq => $in->[2], orf_start => $in->[0], orf_stop => $in->[1], slipsites => \@slipsites, minus_bp => \@minus, snps => $snp_struct,);
<table bgcolor="#E8E8E8" align="center">
<tr>
<td>
<strong>
<pre>
% if ($show_frame ne 'none' and $show_frame ne 'all') {
Showing minus <% $show_frame %> reading frame(s).
% }
><% $accession %> | <% $genename %>
<% $str %>
</pre>
</strong>
</font>
</td>
</tr>
<tr><td>
<form action="print_gene.html" enctype="multipart/form-data" method="POST">
<input type="hidden" name="accession" value="<% $accession %>">
<select name="show_frame" onchange="this.form.submit()">
<option value="none" <% (($show_frame eq 'none') ? 'SELECTED' : '') %>>none</option>
<option value="zero" <% (($show_frame eq 'zero') ? 'SELECTED' : '') %>>zero frame</option>
<option value="one" <% (($show_frame eq 'one') ? 'SELECTED' : '') %>>minus one frame</option>
<option value="two" <% (($show_frame eq 'two') ? 'SELECTED' : '') %>>minus two frame</option>
<option value="all" <% (($show_frame eq 'all') ? 'SELECTED' : '') %>>all</option>
</select>
</input>
Show translated reading frame(s).
</td></tr>
</form>
</table>
<p>The minimum free energy 'landscape' for <% $accession %>, black vertical lines delineate
the positions of slippery heptamers, the horizontal green line shows the mean Vienna RNAfold
value over the ORF, the horizontal red line shows the mean pknots value over the ORF,
the horzontal blue line shows the mean nupack value. green, red, and blue lines delineate
the MFE over a sliding 105bp window.</p>
<& print_landscape.html, accession => "$accession", species => "$sp" &>
% if ($sp eq 'homo_sapiens') {
% my $full_seqlength = length($in->[2]);
% $m->comp("/ingolia/zoom.html", accession=>$accession, start=>$in->[0], end=>$in->[1], full_seqlength=>$full_seqlength);
% }
% elsif ($sp eq 'saccharomyces_cerevisiae') {
% my ($systematic, $common) = split(/\s+/, $genename);
% my $ingolia_json;
% $ingolia_json = qq"/ingolia/json/${sp}/${systematic}.json";
<form method="post" action="print_gene.html?species=saccharomyces_cerevisiae&accession=<% $accession %>&show_frame=<% $show_frame %>&translate=<% $translate %>">
% my $zoom_new = $zoom + $zoom_change;
<select name="zoom_change" onchange="this.form.submit()">
<option value="0.0">Unchanged.</option>
<option value="0.5">Bigger</option>
<option value="-0.5">Smaller</option>
</select>
<div id="choices"></div>
<input type="hidden" name="zoom" value="<% $zoom_new %>">
</form>
% my $len = $in->[1] - $in->[0];
% my $picture_width = (($len + 100) / 2) * $zoom_new;
% my $picture_height = $picture_width / 4;
<table>
<tr>
<td><center>
<div id="ingolia" style="width:<% $picture_width %>;height:<% $picture_height %>;"></div>
</center></td>
</tr>
<tr>
</tr>
</table>
<div id="ingolia" style="width:<% $picture_width %>;height:<% $picture_height %>;"></div>
<script type="text/javascript" id="ingolia">
$(function() {
var choiceContainer = $("#choices");
var datasets;
$.ajax({
async: false,
url: "<% $ingolia_json %>",
dataType: "json",
success: function(json) {
datasets=json;
}
});
var options = {
colors: [ "black", "darkblue", "green", "red" ],
series: {
stack: true,
lines: { show:1, fill:0 },
bars: { show:false, fill:1, lineWidth:0.3, barWidth:1.0 } },
grid: { hoverable: true, clickable: true },
yaxis: {
axisLabel: 'Hits',
axisLabelUseCanvas: true },
xaxis: {
axisLabel: 'Position',
axisLabelUseCanvas: true }
};
// hard-code color indices to prevent them from shifting as series are turned on/off
var i = 0;
$.each(datasets, function(key, val) {
val.color = i;
++i;
});
function append_choices() {
$.each(datasets, function(key, val) {
choiceContainer.append('<input type="checkbox" name="' + key + '" checked="checked" id="id' + key + '"><label for="id' + key + '">' + val.label + '</label>\n');
});
choiceContainer.find("input").click(plotAccordingToChoices);
}
function plotAccordingToChoices() {
var data = [];
var final_plot;
var series;
choiceContainer.find("input:checked").each(function () {
var key = $(this).attr("name");
if (key && datasets[key]) {
data.push(datasets[key]);
}
if (data.length > 0) {
final_plot = $.plot($("#ingolia"), data, options);
series = final_plot.getData();
}
});
return(series);
} // end of plotAccordingToChoices
function showTooltip(x, y, contents) {
$('<div id="tooltip">' + contents + '</div>').css( {
position: 'absolute',
display: 'none',
top: y + 5,
left: x + 5,
border: '1px solid #fdd',
padding: '2px',
'background-color': '#fee',
opacity: 0.80
}).appendTo("body").fadeIn(200);
}
append_choices();
data = plotAccordingToChoices();
/* The original plotter
$.getJSON('<% $ingolia_json %>', function(series) {
var dat = series;
var ing_plot = $.plot($("#ingolia"), dat, options);
});
*/
var previousPoint = null;
$("#ingolia").bind("plothover", function (event, pos, item) {
$("#x").text(pos.x.toFixed(0));
$("#y").text(pos.y.toFixed(0));
if (item) {
if (previousPoint != item.datapoint) {
previousPoint = item.datapoint;
$("#tooltip").remove();
var x = item.datapoint[0].toFixed(0),
y = item.datapoint[1].toFixed(0);
showTooltip(item.pageX, item.pageY,
item.series.label + " at pos. " + x + " hit " + y + " times.");
}
}
else {
$("#tooltip").remove();
previousPoint = null;
}
});
});
</script>
% my $pars_json = qq"/pars/json/${systematic}.json";
% my $file = qq"$ENV{PRFDB_HOME}$pars_json";
% if (-f $file) {
<div id="pars_choices"></div>
<div id="pars" style="width:<% $picture_width %>;height:<% $picture_height %>;"></div>
<script type="text/javascript" id="pars">
$(function() {
var choiceContainer = $("#pars_choices");
var datasets;
$.ajax({
async: false,
url: "<% $pars_json %>",
dataType: "json",
success: function(json) {
datasets=json;
}
});
var options = {
colors: [ "darkblue", "green", "red"],
%# "darkblue", "green", "red" ],
series: {
lines: { show:1, fill:0 },
bars: { show:false, fill:1, lineWidth:0.3, barWidth:1.0 } },
grid: { hoverable: true, clickable: true },
yaxis: {
axisLabel: 'PARS score',
axisLabelUseCanvas: true },
xaxis: {
axisLabel: 'Position',
axisLabelUseCanvas: true }
};
// hard-code color indices to prevent them from shifting as series are turned on/off
var i = 0;
$.each(datasets, function(key, val) {
val.color = i;
++i;
});
function append_choices() {
$.each(datasets, function(key, val) {
choiceContainer.append('<input type="checkbox" name="' + key + '" checked="checked" id="id' + key + '"><label for="id' + key + '">' + val.label + '</label>\n');
});
choiceContainer.find("input").click(plotAccordingToChoices);
}
function plotAccordingToChoices() {
var data = [];
var final_plot;
var series;
choiceContainer.find("input:checked").each(function () {
var key = $(this).attr("name");
if (key && datasets[key]) {
data.push(datasets[key]);
}
if (data.length > 0) {
final_plot = $.plot($("#pars"), data, options);
series = final_plot.getData();
}
});
return(series);
} // end of plotAccordingToChoices
function showTooltip(x, y, contents) {
$('<div id="pars_tooltip">' + contents + '</div>').css( {
position: 'absolute',
display: 'none',
top: y + 5,
left: x + 5,
border: '1px solid #fdd',
padding: '2px',
'background-color': '#fee',
opacity: 0.80
}).appendTo("body").fadeIn(200);
}
append_choices();
data = plotAccordingToChoices();
/* The original plotter
$.getJSON('<% $pars_json %>', function(series) {
var dat = series;
var ing_plot = $.plot($("#pars"), dat, options);
});
*/
var previousPoint = null;
$("#pars").bind("plothover", function (event, pos, item) {
$("#pars_x").text(pos.x.toFixed(0));
$("#pars_y").text(pos.y.toFixed(0));
if (item) {
if (previousPoint != item.datapoint) {
previousPoint = item.datapoint;
$("#pars_tooltip").remove();
var x = item.datapoint[0].toFixed(0),
y = item.datapoint[1].toFixed(0);
showTooltip(item.pageX, item.pageY,
item.series.label + "Position: " + x + " has score: " + y);
}
}
else {
$("#pars_tooltip").remove();
previousPoint = null;
}
});
});
</script>
% } ## End if the pars filename exists
% } ## End if species is saccharomyces_cerevisiae
</form>
</tr>
% my $aux_info = $db->MySelect(statement => "SELECT publications, db_xrefs, gene_synonyms FROM gene_info WHERE accession = ?", vars => [$accession]);
% my $publications = $aux_info->[0]->[0];
% my @pubs = split(/\t/, $publications);
% my $xrefs = $aux_info->[0]->[1];
% my @xr = split(/\s+/, $xrefs);
% my $synon = $aux_info->[0]->[2];
% if (defined($synon)) {
<p>This gene is also known as: <% $synon %><br>
% }
% if (defined($xrefs)) {
This gene is referenced as:
<ul>
% foreach my $x (@xr) {
% my ($name, $info) = split(/:/, $x);
% if ($name =~ /GeneID/) {
<a href="http://www.ncbi.nlm.nih.gov/gene?term=<% $info %>"><% $x %></a>
% } elsif ($name =~ /HGNC/) {
<a href="http://genenames.org/data/hgnc_data.php?hgnc_id=<% $info %>"><% $x %></a>
% } elsif ($name =~ /HPRD/) {
<a href="http://www.hprd.org/"><% $x %></a>
% } elsif ($name =~ /MIM/) {
<a href="http://www.ncbi.nlm.nih.gov/omim/<% $info %>"><% $x %></a>
% } else {
<% $x %>
% }
% }
</p>
% }
% if (scalar(@pubs) > 0) {
<p>Below is a listing of publications associated with the refseq entry for this gene.</p>
<ul>
% foreach my $p (@pubs) {
% my $q = $p;
% $q =~ s/Reference: //g;
% $q =~ s/ /\+/g;
<li><a href="http://scholar.google.com/scholar?q=<% $q %>"><% $p %></a></li>
% }
</ul>
% }
<%init>
my $statement = "SELECT species, genename FROM gene_info WHERE accession = ?";
my $fun = $db->MySelect(statement => $statement, vars => [$accession,]);
my $species = $fun->[0][0];
my $genename = $fun->[0][1];
</%init>
<%args>
$accession => "SGDID:S0004310"
$translate => undef
$show_frame => "none"
$zoom => 1.0
$zoom_change => 0.0
</%args>