2 <!-- <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
3 <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> -->
6 <!-- <script src="/js/tools/vigs.js" type="text/javascript"></script> -->
7 <!-- <script src="/js/jquery/iframe-post-form.js" type="text/javascript"></script> -->
9 <script src="http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.7.2.min.js"></script>
11 <script type="text/javascript" src="/js/jqplot/jquery.jqplot.js"></script>
12 <script type="text/javascript" src="/js/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"></script>
13 <script type="text/javascript" src="/js/jqplot/plugins/jqplot.canvasTextRenderer.min.js"></script>
14 <script type="text/javascript" src="/js/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js"></script>
15 <script type="text/javascript" src="/js/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>
16 <script type="text/javascript" src="/js/jqplot/plugins/jqplot.barRenderer.js"></script>
17 <script type="text/javascript" src="/js/jqplot/plugins/jqplot.pointLabels.min.js"></script>
18 <script type="text/javascript" src="/js/jqplot/plugins/jqplot.highlighter.min.js"></script>
20 <& /util/import_css.mas, paths => ['/js/jqplot/jquery.jqplot.css','/js/jqplot/jquery.jqplot.min.css'] &>
23 <& /util/import_javascript.mas, classes => ['Text.Markup', 'sprintf', 'jquery', 'jqueryui', 'CXGN.List'] &>
25 <& /page/page_title.mas, title=>"Expression Tool" &>
29 <&| /page/info_section.mas, id=>"expr_input" , title=>"Run Expression Tool", collapsible => 1, collapsed => 0 &>
32 <div id="status_wheel" style="display:none"><img src="/static/documents/img/wheel.gif" /></div>
35 <span title="query gene">Select a gene:</span>
36 <input class="input" id="gene" type="input" value="Solyc04g014530.1" name="input_gene" size="15" />
38 <button class="input" id="run_tool" value="Run Expression Tool">Get Expression</button>
46 <&| /page/info_section.mas, id=>"expression_usage" , title=>"Usage", collapsible => 1, collapsed => 0, is_subsection=>"1" &>
49 1. Select a <b>Gene name</b> an push the 'Get Expression' button to see its expression in the different tissues of the plant<br />
57 <!-- ##################################################################################### -->
59 <!-- ##################################################################################### -->
62 <&| /page/info_section.mas, title=>"Results", collapsible => 1, collapsed => 0 &>
64 <div id="hide_results" style="display:none;">
66 <&| /page/info_section.mas, title=>"Experiment Info", collapsible => 1, collapsed => 0, is_subsection=>"1" &>
67 <p id="exp_title"></p>
68 <p id="exp_dbxref"></p>
73 <&| /page/info_section.mas, title=>"Experiment Map", collapsible => 1, collapsed => 0, is_subsection=>"1" &>
74 <div id="my_stage"></div>
77 <&| /page/info_section.mas, title=>"Interactive Control Panel", collapsible => 1, collapsed => 0, is_subsection=>"1" &>
78 Choose a experiment:
79 <select id="exp_list">
80 <option>BTI Slyc RNA-Seq</option>
81 <option>Other experiment</option>
87 <&| /page/info_section.mas, title=>"Bar Graph", collapsible => 1, collapsed => 0, is_subsection=>"1" &>
88 <!-- <div id="chart_margins" style="width: 700px; height: 400px;">
90 <div id="bar_graph" style="width: 700px; height: 400px;"></div>
96 <&| /page/info_section.mas, title=>"Experiment Expression Data", collapsible => 1, collapsed => 0, is_subsection=>"1" &>
97 <table id="exp_table" cellpadding="2" cellspacing="2" width="100%"></table>
100 <&| /page/info_section.mas, title=>"Experiment Sample Info", collapsible => 1, collapsed => 0, is_subsection=>"1" &>
101 <table id="exp_info_table" cellpadding="2" cellspacing="2" width="100%"></table>
115 /* border-style:dashed;
128 background-color:rgb(200,200,200);
134 <script defer="defer">
136 jQuery(document).ready(function () {
139 //var expression_table_info;
141 var perl_hash_obj = new Object();
143 jQuery('#run_tool').click(function () {
147 query_gene = jQuery('#gene').val();
150 url: '/tools/expression/result/',
153 data: { 'gene': query_gene },
154 success: function(response) {
157 if (response.error) {
158 alert("ERROR: "+response.error);
162 data_array_obj = response.all_exp_design;
164 // alert(dump(data_array_obj));
166 //perl_hash_obj = response.hash;
168 //alert("hash_name: "+perl_hash_obj["name"]);
169 //alert("hi: "+response.gene_name);
172 error: function(response) {
173 alert("An error occurred. The service may not be available right now.");
184 // var designs_array = Object.keys(data_array_obj);
185 // for (var n=0; n<designs_array.length; n=n+1) {
186 // jQuery('#exp_list').append('<option>'+designs_array[n]+'</option>')
189 // alert("design names: "+designs_array);
192 var data_array = data_array_obj[0]["data"];
193 var experiment_name = data_array_obj[0]["name"];
194 var experiment_desc = data_array_obj[0]["description"];
195 var experiment_pubs = data_array_obj[0]["pub"];
196 var experiment_dbxrefs = data_array_obj[0]["dbxref"];
199 jQuery('#exp_title').html("<b>Name:</b> "+experiment_name+"<br/><b>Description:</b> "+experiment_desc);
200 jQuery('#exp_dbxref').html("<b>External Links:</b> "+experiment_dbxrefs);
201 jQuery('#exp_pub').html("<b>Publications:</b> "+experiment_pubs);
203 // alert(dump(data_array));
208 print_bar_chart(data_array);
210 var expression_table_info = "";
211 var experiment_info = "";
212 //alert("data: "+data_array.length);
213 expression_table_info += "<tr style='text-align:center;'><th>Experiment</th><th>Replicates</th><th>FPKM</th><th>FPKM_lo</th><th>FPKM_hi</th></tr>";
214 experiment_info += "<tr style='text-align:center;'><th>Sample</th><th>Description</th><th>External Link</th></tr>";
216 for (var i=0; i<data_array.length; i=i+1) {
217 experiment_info += "<tr><td><a href='/gem/experiment.pl?id="+data_array[i]["id"]+"' target='_blank'>"+data_array[i]["name"]+"</a></td>";
218 experiment_info += "<td style='text-align:left;'>"+data_array[i]["exp_description"]+"</td>";
219 experiment_info += "<td style='text-align:center;'>"+data_array[i]["exp_links"]+"</td>";
221 expression_table_info += "<tr><td>"+data_array[i]["name"]+"</td>";
222 expression_table_info += "<td style='text-align:center;'>"+data_array[i]["replicates"]+"</td>";
223 expression_table_info += "<td style='text-align:center;'>"+data_array[i]["fpkm"]+"</td>";
224 // expression_table_info += "<td style='text-align:center;'>"+data_array[i]["median"]+"</td>";
225 expression_table_info += "<td style='text-align:center;'>"+data_array[i]["fpkm_lo"]+"</td>";
226 expression_table_info += "<td style='text-align:center;'>"+data_array[i]["fpkm_hi"]+"</td>";
227 expression_table_info += "</tr>";
229 jQuery('#exp_table').html(expression_table_info);
230 jQuery('#exp_info_table').html(experiment_info);
234 function disable_ui() {
235 $('#working').dialog("open");
238 function enable_ui() {
239 $('#working').dialog("close");
243 Effects.swapElements('expr_input_offswitch', 'expr_input_onswitch');
244 Effects.hideElement('expr_input_content');
247 function show_hiden_divs() {
248 jQuery("#hide_results").css("display","inline");
257 function print_bar_chart(data_a) {
258 jQuery("#bar_graph").empty();
262 var error_bar_obj = new Object(); //the error values must be the percentage of the expression 0.1=10%
263 var error_bar_data = [];
267 for (var i=0; i<data_a.length; i=i+1) {
269 var one_mean = parseFloat(data_a[i]["fpkm"]);
271 exp_cond.push(data_a[i]["name"]);
272 bar_data.push(one_mean);
274 var one_sd =(parseFloat(data_a[i]["fpkm_lo"]));
275 var one_cv =(parseFloat(data_a[i]["fpkm_hi"]));
276 // var min_ser = (one_mean - one_sd).toFixed(2);
277 // var max_ser = (one_mean + one_sd).toFixed(2);
278 // min_serie.push(parseFloat(min_ser));
279 // max_serie.push(parseFloat(max_ser));
281 var min_err = ((one_mean - one_sd)/one_mean).toFixed(2);
282 var max_err = ((one_cv - one_mean)/one_mean).toFixed(2);
284 // var min_err = (one_sd/one_mean).toFixed(2);
285 // var max_err = (one_sd/one_mean).toFixed(2);
287 error_bar_obj = new Object();
288 error_bar_obj.min=parseFloat(min_err);
289 error_bar_obj.max=parseFloat(max_err);
291 error_bar_data.push(error_bar_obj);
295 // alert(dump(error_bar_data));
301 var plot1 = $.jqplot('bar_graph', [bar_data], {
302 title: 'Expression Data',
305 renderer:$.jqplot.BarRenderer,
309 errorBarColor: "black",
310 errorData: [error_bar_data],
312 barDirection: 'vertical',
318 seriesColors: ['#C80000'],
319 // seriesColors: ['#20608E'],
321 tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
324 // Use a category axis on the x axis and use our custom ticks.
326 renderer: $.jqplot.CategoryAxisRenderer,
336 // Pad the y axis just a little so bars can get close to, but
337 // not touch, the grid boundaries. 1.2 is the default padding.
339 // label:'Expression (units)',
344 formatString: "%#.2f",
349 labelRenderer: $.jqplot.CanvasAxisLabelRenderer
354 borderColor: "black",
362 formatString:'<div id="bar_tooltip" class="jqplot-highlighter"><table>\
363 <tr><td>Expression val:</td><td>%s</td></tr> \
374 function dump(arr,level) {
375 var dumped_text = "";
376 if(!level) level = 0;
378 //The padding given at the beginning of the line.
379 var level_padding = "";
380 for(var j=0;j<level+1;j++) level_padding += " ";
382 if(typeof(arr) == 'object') { //Array/Hashes/Objects
383 for(var item in arr) {
384 var value = arr[item];
386 if(typeof(value) == 'object') { //If it is an array,
387 dumped_text += level_padding + "'" + item + "' ...\n";
388 dumped_text += dump(value,level+1);
390 dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
393 } else { //Stings/Chars/Numbers etc.
394 dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
404 function display_pictures() {
405 var stage = new Kinetic.Stage({
406 container: "my_stage",
410 var layer = new Kinetic.Layer();
411 var plantObj = new Image();
412 // var fruit_img = new Image();
413 plantObj.src = "/static/documents/img/expression_tool/tomato_template.png";
414 // fruit_img.src = "/static/documents/img/expression_tool/tomato_fruit_1.png";
417 var tomato_plant = new Kinetic.Image({
425 // // tomato fruit img
426 // var tomato_fruit = new Kinetic.Image({
434 layer.add(tomato_plant);
435 // layer.add(tomato_fruit);