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 <link rel="stylesheet" type="text/css" href="/js/jqplot/jquery.jqplot.css">
21 <link rel="stylesheet" type="text/css" href="/js/jqplot/jquery.jqplot.min.css">
25 <& /util/import_javascript.mas, classes => ['Text.Markup', 'sprintf', 'jquery', 'jqueryui', 'CXGN.List'] &>
27 <& /page/page_title.mas, title=>"Expression Tool" &>
31 <&| /page/info_section.mas, id=>"expr_input" , title=>"Run Expression Tool", collapsible => 1, collapsed => 0 &>
34 <div id="status_wheel" style="display:none"><img src="/static/documents/img/wheel.gif" /></div>
37 <span title="query gene">Select a gene:</span>
38 <input class="input" id="gene" type="input" value="Solyc04g014530.1" name="input_gene" size="15" />
40 <button class="input" id="run_tool" value="Run Expression Tool">Get Expression</button>
48 <&| /page/info_section.mas, id=>"expression_usage" , title=>"Usage", collapsible => 1, collapsed => 0, is_subsection=>"1" &>
51 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 />
59 <!-- ##################################################################################### -->
61 <!-- ##################################################################################### -->
64 <&| /page/info_section.mas, title=>"Results", collapsible => 1, collapsed => 0 &>
66 <div id="hide_results" style="display:none;">
68 <&| /page/info_section.mas, title=>"Experiment Info", collapsible => 1, collapsed => 0, is_subsection=>"1" &>
69 <p id="exp_title"></p>
70 <p id="exp_dbxref"></p>
75 <&| /page/info_section.mas, title=>"Experiment Map", collapsible => 1, collapsed => 0, is_subsection=>"1" &>
76 <div id="my_stage"></div>
79 <&| /page/info_section.mas, title=>"Interactive Control Panel", collapsible => 1, collapsed => 0, is_subsection=>"1" &>
80 Choose a experiment:
81 <select id="exp_list">
82 <option>BTI Slyc RNA-Seq</option>
83 <option>Other experiment</option>
89 <&| /page/info_section.mas, title=>"Bar Graph", collapsible => 1, collapsed => 0, is_subsection=>"1" &>
90 <!-- <div id="chart_margins" style="width: 700px; height: 400px;">
92 <div id="bar_graph" style="width: 700px; height: 400px;"></div>
98 <&| /page/info_section.mas, title=>"Experiment Expression Data", collapsible => 1, collapsed => 0, is_subsection=>"1" &>
99 <table id="exp_table" cellpadding="2" cellspacing="2" width="100%"></table>
102 <&| /page/info_section.mas, title=>"Experiment Sample Info", collapsible => 1, collapsed => 0, is_subsection=>"1" &>
103 <table id="exp_info_table" cellpadding="2" cellspacing="2" width="100%"></table>
117 /* border-style:dashed;
130 background-color:rgb(200,200,200);
136 <script defer="defer">
138 jQuery(document).ready(function () {
141 //var expression_table_info;
143 var perl_hash_obj = new Object();
145 jQuery('#run_tool').click(function () {
149 query_gene = jQuery('#gene').val();
152 url: '/tools/expression/result/',
155 data: { 'gene': query_gene },
156 success: function(response) {
159 if (response.error) {
160 alert("ERROR: "+response.error);
164 data_array_obj = response.all_exp_design;
166 // alert(dump(data_array_obj));
168 //perl_hash_obj = response.hash;
170 //alert("hash_name: "+perl_hash_obj["name"]);
171 //alert("hi: "+response.gene_name);
174 error: function(response) {
175 alert("An error occurred. The service may not be available right now.");
186 // var designs_array = Object.keys(data_array_obj);
187 // for (var n=0; n<designs_array.length; n=n+1) {
188 // jQuery('#exp_list').append('<option>'+designs_array[n]+'</option>')
191 // alert("design names: "+designs_array);
194 var data_array = data_array_obj[0]["data"];
195 var experiment_name = data_array_obj[0]["name"];
196 var experiment_desc = data_array_obj[0]["description"];
197 var experiment_pubs = data_array_obj[0]["pub"];
198 var experiment_dbxrefs = data_array_obj[0]["dbxref"];
201 jQuery('#exp_title').html("<b>Name:</b> "+experiment_name+"<br/><b>Description:</b> "+experiment_desc);
202 jQuery('#exp_dbxref').html("<b>External Links:</b> "+experiment_dbxrefs);
203 jQuery('#exp_pub').html("<b>Publications:</b> "+experiment_pubs);
205 // alert(dump(data_array));
210 print_bar_chart(data_array);
212 var expression_table_info = "";
213 var experiment_info = "";
214 //alert("data: "+data_array.length);
215 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>";
216 experiment_info += "<tr style='text-align:center;'><th>Sample</th><th>Description</th><th>External Link</th></tr>";
218 for (var i=0; i<data_array.length; i=i+1) {
219 experiment_info += "<tr><td><a href='/gem/experiment.pl?id="+data_array[i]["id"]+"' target='_blank'>"+data_array[i]["name"]+"</a></td>";
220 experiment_info += "<td style='text-align:left;'>"+data_array[i]["exp_description"]+"</td>";
221 experiment_info += "<td style='text-align:center;'>"+data_array[i]["exp_links"]+"</td>";
223 expression_table_info += "<tr><td>"+data_array[i]["name"]+"</td>";
224 expression_table_info += "<td style='text-align:center;'>"+data_array[i]["replicates"]+"</td>";
225 expression_table_info += "<td style='text-align:center;'>"+data_array[i]["fpkm"]+"</td>";
226 // expression_table_info += "<td style='text-align:center;'>"+data_array[i]["median"]+"</td>";
227 expression_table_info += "<td style='text-align:center;'>"+data_array[i]["fpkm_lo"]+"</td>";
228 expression_table_info += "<td style='text-align:center;'>"+data_array[i]["fpkm_hi"]+"</td>";
229 expression_table_info += "</tr>";
231 jQuery('#exp_table').html(expression_table_info);
232 jQuery('#exp_info_table').html(experiment_info);
236 function disable_ui() {
237 $('#working').dialog("open");
240 function enable_ui() {
241 $('#working').dialog("close");
245 Effects.swapElements('expr_input_offswitch', 'expr_input_onswitch');
246 Effects.hideElement('expr_input_content');
249 function show_hiden_divs() {
250 jQuery("#hide_results").css("display","inline");
259 function print_bar_chart(data_a) {
260 jQuery("#bar_graph").empty();
264 var error_bar_obj = new Object(); //the error values must be the percentage of the expression 0.1=10%
265 var error_bar_data = [];
269 for (var i=0; i<data_a.length; i=i+1) {
271 var one_mean = parseFloat(data_a[i]["fpkm"]);
273 exp_cond.push(data_a[i]["name"]);
274 bar_data.push(one_mean);
276 var one_sd =(parseFloat(data_a[i]["fpkm_lo"]));
277 var one_cv =(parseFloat(data_a[i]["fpkm_hi"]));
278 // var min_ser = (one_mean - one_sd).toFixed(2);
279 // var max_ser = (one_mean + one_sd).toFixed(2);
280 // min_serie.push(parseFloat(min_ser));
281 // max_serie.push(parseFloat(max_ser));
283 var min_err = ((one_mean - one_sd)/one_mean).toFixed(2);
284 var max_err = ((one_cv - one_mean)/one_mean).toFixed(2);
286 // var min_err = (one_sd/one_mean).toFixed(2);
287 // var max_err = (one_sd/one_mean).toFixed(2);
289 error_bar_obj = new Object();
290 error_bar_obj.min=parseFloat(min_err);
291 error_bar_obj.max=parseFloat(max_err);
293 error_bar_data.push(error_bar_obj);
297 // alert(dump(error_bar_data));
303 var plot1 = $.jqplot('bar_graph', [bar_data], {
304 title: 'Expression Data',
307 renderer:$.jqplot.BarRenderer,
311 errorBarColor: "black",
312 errorData: [error_bar_data],
314 barDirection: 'vertical',
320 seriesColors: ['#C80000'],
321 // seriesColors: ['#20608E'],
323 tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
326 // Use a category axis on the x axis and use our custom ticks.
328 renderer: $.jqplot.CategoryAxisRenderer,
338 // Pad the y axis just a little so bars can get close to, but
339 // not touch, the grid boundaries. 1.2 is the default padding.
341 // label:'Expression (units)',
346 formatString: "%#.2f",
351 labelRenderer: $.jqplot.CanvasAxisLabelRenderer
356 borderColor: "black",
364 formatString:'<div id="bar_tooltip" class="jqplot-highlighter"><table>\
365 <tr><td>Expression val:</td><td>%s</td></tr> \
376 function dump(arr,level) {
377 var dumped_text = "";
378 if(!level) level = 0;
380 //The padding given at the beginning of the line.
381 var level_padding = "";
382 for(var j=0;j<level+1;j++) level_padding += " ";
384 if(typeof(arr) == 'object') { //Array/Hashes/Objects
385 for(var item in arr) {
386 var value = arr[item];
388 if(typeof(value) == 'object') { //If it is an array,
389 dumped_text += level_padding + "'" + item + "' ...\n";
390 dumped_text += dump(value,level+1);
392 dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
395 } else { //Stings/Chars/Numbers etc.
396 dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
406 function display_pictures() {
407 var stage = new Kinetic.Stage({
408 container: "my_stage",
412 var layer = new Kinetic.Layer();
413 var plantObj = new Image();
414 // var fruit_img = new Image();
415 plantObj.src = "/static/documents/img/expression_tool/tomato_template.png";
416 // fruit_img.src = "/static/documents/img/expression_tool/tomato_fruit_1.png";
419 var tomato_plant = new Kinetic.Image({
427 // // tomato fruit img
428 // var tomato_fruit = new Kinetic.Image({
436 layer.add(tomato_plant);
437 // layer.add(tomato_fruit);