1 analysis_calculate_statistics_select<%args>
4 <!--button class='btn btn-primary' style='margin:3px;float:right' id='analysis_calculate_statistics_link'>Single/Multi Trial GEBV Analysis</button-->
6 <div class="modal fade" id="analysis_calculate_statistics_dialog" name="analysis_calculate_statistics_dialog" tabindex="-1" role="dialog" aria-labelledby="analysisCalculateStatisticsDialog" data-backdrop="static">
7 <div class="modal-dialog modal-xl" role="document">
8 <div class="modal-content">
9 <div class="modal-header">
10 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
11 <h4 class="modal-title" id="analysisCalculateStatisticsDialog">Calculate statistics</h4>
13 <div class="modal-body">
14 <div class="container-fluid">
16 <&| /util/workflow.mas, id=> "analysis_calculate_statistics_workflow" &>
17 <&| /util/workflow.mas:step, title=> "Field Trial" &>
18 <& /page/page_title.mas, title=>"Select the field trial(s) you are interested in." &>
20 <form class="form-horizontal">
21 <div class="form-group">
22 <label class="col-sm-3 control-label">Field Trial(s): </label>
23 <div class="col-sm-9" >
24 <div id="analysis_calculate_statistics_trial_select_div"></div>
29 <button class="btn btn-primary" id="analysis_calculate_statistics_field_trial_select_step">Go to Next Step</button>
32 <&| /util/workflow.mas:step, title=> "Trait Selection" &>
33 <& /page/page_title.mas, title=>"Select the observation variable you are interested in" &>
35 <form class="form-horizontal">
36 <div class="form-group">
37 <label class="col-sm-3 control-label">Observation Variables Phenotyped in the Selected Field Trial(s): </label>
38 <div class="col-sm-9" >
39 <div id="analysis_calculate_statistics_trait_select_div"></div>
44 <button class="btn btn-primary" id="analysis_calculate_statistics_trait_select_step">Go to Next Step</button>
47 <&| /util/workflow.mas:step, title=> "Statistics" &>
48 <& /page/page_title.mas, title=>"Select statistics to calculate" &>
50 <div id="analysis_calculate_statistics_model_select_div"></div>
54 <button class="btn btn-default" id="analysis_calculate_statistics_create_new_model_button">My Model is Not Shown, So Create New Model</button>
57 <div id="analysis_calculate_statistics_create_new_model_div" style="display:none">
60 <div class="well well-sm">
61 <select class="form-control" id="analysis_calculate_statistics_select_input">
62 <option value="">Select A Model</option>
63 <option value="lmer_germplasmname_replicate">LMER BLUPs y~replicate+location_year+1|Germplasm. Univariate genetic effects across location_years</option>
64 <option value="sommer_grm_genetic_blups">Sommer GBLUPs Y~replicate+location_year+GRM. Multivariate genetic effects using GRM across location_years</option>
65 <option value="sommer_grm_spatial_genetic_blups">Sommer Spatial GBLUPs Y~replicate+location_year+GRM+spatial. Multivariate genetic + 2Dspl spatial effects across location_years</option>
68 <div id="analysis_calculate_statistics_relationship_matrix_type_div" style="display:none">
70 <div class="form-horizontal">
71 <div class="form-group">
72 <label class="col-sm-3 control-label">Relationship Matrix Type: </label>
73 <div class="col-sm-9" >
74 <select class="form-control" id="analysis_calculate_statistics_relationship_matrix_type_select_div">
75 <option value="">Identity</option>
76 <option value="htp_phenotypes">High-throughput Phenotyping Data</option>
77 <option value="genotypes">Genotyping Data</option>
84 <div id="analysis_calculate_statistics_genotyping_protocol_div" style="display:none">
86 <div class="form-horizontal">
87 <div class="form-group">
88 <label class="col-sm-3 control-label">Genotyping Protocol To Calculate Genomic Relationship Matrix (optional. If none selected, an identity matrix is used): </label>
89 <div class="col-sm-9" >
90 <div id="analysis_calculate_statistics_genotyping_protocol_select_div"></div>
93 <div class="form-group">
94 <label class="col-sm-3 control-label">Compute Genotypes From Parents: </label>
95 <div class="col-sm-9" >
96 <select class="form-control" id="analysis_calculate_statistics_genotyping_protocol_compute_from_parents_select">
97 <option value="no">No</option>
98 <option value="yes">Yes</option>
105 <div id="analysis_calculate_statistics_htp_phenotypes_rel_matrix_div" class="well well-sm" style="display:none">
106 <div class="form-horizontal">
107 <div class="form-group">
108 <label class="col-sm-3 control-label">How to calculate the relationship matrix with high-throughput phenotypes: </label>
109 <div class="col-sm-9" >
110 <select class="form-control" id="analysis_calculate_statistics_htp_phenotypes_rel_matrix_select">
111 <option value="correlations">Correlations</option>
112 <option value="blues">BLUEs</option>
116 <div class="form-group">
117 <label class="col-sm-3 control-label">Time Points to Use: </label>
118 <div class="col-sm-9" >
119 <select class="form-control" id="analysis_calculate_statistics_htp_phenotypes_rel_matrix_times_select">
120 <option value="all">All Available</option>
121 <option value="latest_trait">Up to latest days after planting selecting in traits</option>
122 <option value="vegetative" disabled>Vegetative Growth Stage</option>
123 <option value="reproductive" disabled>Reproductive Growth Stage</option>
124 <option value="mature" disabled>Mature Growth Stage</option>
128 <div class="form-group" id="analysis_calculate_statistics_htp_phenotypes_rel_matrix_inversion_select_div" style="display:none">
129 <label class="col-sm-3 control-label">HTP BLUEs Inversion Tolerance: </label>
130 <div class="col-sm-9" >
131 <select class="form-control" id="analysis_calculate_statistics_htp_phenotypes_rel_matrix_inversion_select">
132 <option value="0.00001">0.00001</option>
133 <option value="0.0001">0.0001</option>
134 <option value="0.001">0.001</option>
135 <option value="0.01">0.01</option>
136 <option value="0.1">0.1</option>
137 <option value="0.5">0.5</option>
145 <div class="form-horizontal">
146 <div class="form-group">
147 <label class="col-sm-3 control-label">Inversion Tolerance: </label>
148 <div class="col-sm-9" >
149 <select class="form-control" id="analysis_calculate_statistics_tolparinv_select">
150 <option value="0.000001">0.000001</option>
151 <option value="0.00001">0.00001</option>
152 <option value="0.0001">0.0001</option>
153 <option value="0.001">0.001</option>
154 <option value="0.01">0.01</option>
155 <option value="0.05">0.05</option>
156 <option value="0.08">0.08</option>
157 <option value="0.1">0.1</option>
158 <option value="0.2">0.2</option>
159 <option value="0.5">0.5</option>
166 <div class="form-horizontal">
167 <div class="form-group">
168 <label class="col-sm-3 control-label">Fixed Effects: </label>
169 <div class="col-sm-9" >
170 <select class="form-control" id="analysis_calculate_statistics_fixed_effect_select_div">
171 <option value="replicate">Replicate</option>
172 <option value="fixed_effect_trait">Select a continuous trait (e.g. soil elevation curvature)</option>
176 <div class="form-group" id="analysis_calculate_statistics_fixed_effect_select_trait_div" style="display:none">
177 <label class="col-sm-3 control-label">Fixed Effect Trait: </label>
178 <div class="col-sm-9" >
179 <div id="analysis_calculate_statistics_fixed_effect_trait_select_div"></div>
182 <div class="form-group" id="analysis_calculate_statistics_fixed_effect_select_quantile_div" style="display:none">
183 <label class="col-sm-3 control-label">Fixed Effect Continuous Trait Quantile Binning: </label>
184 <div class="col-sm-9" >
185 <select class="form-control" id="analysis_calculate_statistics_fixed_effect_select_quantile">
186 <option value="10">10% Quantiles</option>
187 <option value="5">20% Quantiles</option>
188 <option value="4">25% Quantiles</option>
189 <option value="3">33% Quantiles</option>
190 <option value="20">5% Quantiles</option>
202 <button class="btn btn-primary" id="analysis_calculate_statistics_select_step">Submit</button>
205 <&| /util/workflow.mas:step, title=> "Results" &>
206 <& /page/page_title.mas, title=>"Statistics results" &>
209 <button class="btn btn-primary" id="analysis_calculate_statistics_analysis_save_blups_genetic_pe_residual" style="display:none">Go To Save Analysis Results For Genetic and Environment BLUPS and Residuals</button>
210 <button class="btn btn-primary" id="analysis_calculate_statistics_analysis_save_blups_genetic" style="display:none">Go To Save Analysis Results For Genetic BLUPS</button>
211 <button class="btn btn-primary" id="analysis_calculate_statistics_analysis_save_blups_spatial" style="display:none">Go To Save Analysis Results For Spatial BLUPS</button>
212 <button class="btn btn-primary" id="analysis_calculate_statistics_analysis_save_residuals" style="display:none">Go To Save Analysis Results For Residuals</button>
213 <button class="btn btn-primary" id="analysis_calculate_statistics_analysis_save_fitted" style="display:none">Go To Save Analysis Results For Fitted Values</button>
216 <div id ="analysis_calculate_statistics_result_div">
224 <div class="modal-footer">
225 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
233 jQuery(document).ready(function() {
236 // Calculate statistics
239 var analysis_calculate_statistics_field_trial_id_array = undefined;
240 var analysis_calculate_statistics_field_trial_id_string = "";
241 var analysis_calculate_statistics_trait_id = [];
242 var analysis_calculate_statistics_trait_names = [];
243 var analysis_calculate_statistics_accession_names = [];
244 var analysis_calculate_statistics_plot_names = [];
245 var analysis_calculate_statistics_select = '';
246 var analysis_calculate_statistics_phenotype_training_file;
247 var analysis_calculate_statistics_grm_training_file;
248 var analysis_calculate_statistics_response = {};
250 jQuery('#analysis_calculate_statistics_link').click(function(){
251 get_select_box('trials', 'analysis_calculate_statistics_trial_select_div', { 'name' : 'analysis_calculate_statistics_field_trial_id', 'id' : 'analysis_calculate_statistics_field_trial_id', 'empty':1, 'multiple':1, 'include_location_year':1 });
253 jQuery('#analysis_calculate_statistics_dialog').modal('show');
256 jQuery('#analysis_calculate_statistics_field_trial_select_step').click(function(){
257 analysis_calculate_statistics_field_trial_id_array = undefined;
258 analysis_calculate_statistics_field_trial_id_string = "";
259 analysis_calculate_statistics_field_trial_id_array = jQuery('#analysis_calculate_statistics_field_trial_id').val();
261 analysis_calculate_statistics_field_trial_id_string = analysis_calculate_statistics_field_trial_id_array.join(",");
262 if (analysis_calculate_statistics_field_trial_id_string == '') {
263 alert('Please select a field trial first!');
265 get_select_box('traits', 'analysis_calculate_statistics_trait_select_div', { 'name' : 'analysis_calculate_statistics_trait_id_select', 'id' : 'analysis_calculate_statistics_trait_id_select', 'empty':1, 'multiple':0, 'trial_ids':analysis_calculate_statistics_field_trial_id_string, 'stock_type':'plot' });
267 get_select_box('traits', 'analysis_calculate_statistics_permanent_env_structure_phenotype_correlation_select_div', { 'name' : 'analysis_calculate_statistics_permanent_env_structure_phenotype_correlation_select', 'id' : 'analysis_calculate_statistics_permanent_env_structure_phenotype_correlation_select', 'empty':1, 'multiple':1, 'size': 20, 'trial_ids':analysis_calculate_statistics_field_trial_id_string, 'stock_type':'plot' });
269 get_select_box('traits', 'analysis_calculate_statistics_permanent_env_structure_phenotype_select_div', { 'name' : 'analysis_calculate_statistics_permanent_env_structure_phenotype_select', 'id' : 'analysis_calculate_statistics_permanent_env_structure_phenotype_select', 'empty':1, 'multiple':1, 'size':20, 'trial_ids':analysis_calculate_statistics_field_trial_id_string, 'stock_type':'plot' });
271 get_select_box('traits', 'analysis_calculate_statistics_fixed_effect_trait_select_div', { 'name' : 'analysis_calculate_statistics_fixed_effect_trait_select', 'id' : 'analysis_calculate_statistics_fixed_effect_trait_select', 'empty':0, 'multiple':0, 'trial_ids':analysis_calculate_statistics_field_trial_id_string, 'stock_type':'plot' });
273 get_select_box('genotyping_protocol', 'analysis_calculate_statistics_genotyping_protocol_select_div', { 'name' : 'analysis_calculate_statistics_genotyping_protocol_select', 'id' : 'analysis_calculate_statistics_genotyping_protocol_select', 'empty':1 });
275 get_select_box('models', 'analysis_calculate_statistics_model_select_div', { 'name' : 'analysis_calculate_statistics_model_select', 'id' : 'analysis_calculate_statistics_model_select', 'empty':0, 'nd_protocol_type':'analysis_model_properties_multi_trial' });
277 Workflow.complete("#analysis_calculate_statistics_field_trial_select_step");
278 Workflow.focus('#analysis_calculate_statistics_workflow', 1);
283 jQuery('#analysis_calculate_statistics_trait_select_step').click(function(){
284 analysis_calculate_statistics_trait_id = undefined;
286 analysis_calculate_statistics_trait_id = jQuery('#analysis_calculate_statistics_trait_id_select').val();
287 if (analysis_calculate_statistics_trait_id == null || analysis_calculate_statistics_trait_id == undefined) {
288 alert('Please select one observation variable!');
292 Workflow.complete("#analysis_calculate_statistics_trait_select_step");
293 Workflow.focus('#analysis_calculate_statistics_workflow', 2);
297 jQuery('#analysis_calculate_statistics_create_new_model_button').click(function(){
298 jQuery('#analysis_calculate_statistics_create_new_model_div').show();
301 jQuery('#analysis_calculate_statistics_select_input').change(function(){
302 jQuery("#analysis_calculate_statistics_relationship_matrix_type_select_div").val('').change();
303 jQuery("#analysis_calculate_statistics_genotyping_protocol_compute_from_parents_select").val('no').change();
305 analysis_calculate_statistics_select = jQuery('#analysis_calculate_statistics_select_input').val();
306 if (analysis_calculate_statistics_select == 'lmer_germplasmname_replicate') {
307 jQuery('#analysis_calculate_statistics_relationship_matrix_type_div').hide();
308 jQuery('#analysis_calculate_statistics_genotyping_protocol_div').hide();
309 jQuery('#analysis_calculate_statistics_analysis_save_blups_genetic_pe_residual').hide();
310 jQuery('#analysis_calculate_statistics_analysis_save_blups_genetic').show();
311 jQuery('#analysis_calculate_statistics_analysis_save_blups_spatial').hide();
312 jQuery('#analysis_calculate_statistics_analysis_save_residuals').hide();
313 jQuery('#analysis_calculate_statistics_analysis_save_fitted').hide();
314 jQuery('#analysis_calculate_statistics_random_regression_pe_structure_div').hide();
316 else if (analysis_calculate_statistics_select == 'sommer_grm_spatial_genetic_blups') {
317 jQuery('#analysis_calculate_statistics_relationship_matrix_type_div').show();
318 jQuery('#analysis_calculate_statistics_genotyping_protocol_div').hide();
319 jQuery('#analysis_calculate_statistics_analysis_save_blups_genetic_pe_residual').show();
320 jQuery('#analysis_calculate_statistics_analysis_save_blups_genetic').hide();
321 jQuery('#analysis_calculate_statistics_analysis_save_blups_spatial').hide();
322 jQuery('#analysis_calculate_statistics_analysis_save_residuals').hide();
323 jQuery('#analysis_calculate_statistics_analysis_save_fitted').hide();
324 jQuery('#analysis_calculate_statistics_random_regression_pe_structure_div').hide();
326 else if (analysis_calculate_statistics_select == 'sommer_grm_genetic_blups') {
327 jQuery('#analysis_calculate_statistics_relationship_matrix_type_div').show();
328 jQuery('#analysis_calculate_statistics_genotyping_protocol_div').hide();
329 jQuery('#analysis_calculate_statistics_analysis_save_blups_genetic_pe_residual').hide();
330 jQuery('#analysis_calculate_statistics_analysis_save_blups_genetic').show();
331 jQuery('#analysis_calculate_statistics_analysis_save_blups_spatial').hide();
332 jQuery('#analysis_calculate_statistics_analysis_save_residuals').hide();
333 jQuery('#analysis_calculate_statistics_analysis_save_fitted').hide();
334 jQuery('#analysis_calculate_statistics_random_regression_pe_structure_div').hide();
337 jQuery('#analysis_calculate_statistics_relationship_matrix_type_div').hide();
338 jQuery('#analysis_calculate_statistics_genotyping_protocol_div').hide();
339 jQuery('#analysis_calculate_statistics_analysis_save_blups_genetic_pe_residual').hide();
340 jQuery('#analysis_calculate_statistics_analysis_save_blups_genetic').hide();
341 jQuery('#analysis_calculate_statistics_analysis_save_blups_spatial').hide();
342 jQuery('#analysis_calculate_statistics_analysis_save_residuals').hide();
343 jQuery('#analysis_calculate_statistics_analysis_save_fitted').hide();
344 jQuery('#analysis_calculate_statistics_random_regression_pe_structure_div').hide();
349 jQuery('#analysis_calculate_statistics_relationship_matrix_type_select_div').change(function(){
350 if (jQuery(this).val() == 'genotypes') {
351 jQuery('#analysis_calculate_statistics_genotyping_protocol_div').show();
352 jQuery('#analysis_calculate_statistics_htp_phenotypes_rel_matrix_div').hide();
354 else if (jQuery(this).val() == 'htp_phenotypes') {
355 jQuery('#analysis_calculate_statistics_genotyping_protocol_div').hide();
356 jQuery('#analysis_calculate_statistics_htp_phenotypes_rel_matrix_div').show();
359 jQuery('#analysis_calculate_statistics_genotyping_protocol_div').hide();
360 jQuery('#analysis_calculate_statistics_htp_phenotypes_rel_matrix_div').hide();
364 jQuery('#analysis_calculate_statistics_htp_phenotypes_rel_matrix_select').change(function(){
365 if (jQuery(this).val() == 'blues') {
366 jQuery('#analysis_calculate_statistics_htp_phenotypes_rel_matrix_inversion_select_div').show();
369 jQuery('#analysis_calculate_statistics_htp_phenotypes_rel_matrix_inversion_select_div').hide();
373 jQuery('#analysis_calculate_statistics_fixed_effect_select_div').change(function(){
374 if (jQuery(this).val() == 'replicate') {
375 jQuery('#analysis_calculate_statistics_fixed_effect_select_trait_div').hide();
376 jQuery('#analysis_calculate_statistics_fixed_effect_select_quantile_div').hide();
378 if (jQuery(this).val() == 'fixed_effect_trait') {
379 jQuery('#analysis_calculate_statistics_fixed_effect_select_trait_div').show();
380 jQuery('#analysis_calculate_statistics_fixed_effect_select_quantile_div').show();
384 jQuery('#analysis_calculate_statistics_select_step').click(function(){
386 analysis_calculate_statistics_select = jQuery('#analysis_calculate_statistics_select_input').val();
389 url : '/api/drone_imagery/calculate_statistics',
392 'observation_variable_id_list':analysis_calculate_statistics_trait_id,
393 'field_trial_id_list':JSON.stringify(analysis_calculate_statistics_field_trial_id_array),
394 'statistics_select':analysis_calculate_statistics_select,
395 'relationship_matrix_type':jQuery('#analysis_calculate_statistics_relationship_matrix_type_select_div').val(),
396 'protocol_id':jQuery('#analysis_calculate_statistics_genotyping_protocol_select').val(),
397 'compute_from_parents':jQuery('#analysis_calculate_statistics_genotyping_protocol_compute_from_parents_select').val(),
398 'htp_pheno_rel_matrix_type':jQuery('#analysis_calculate_statistics_htp_phenotypes_rel_matrix_select').val(),
399 'htp_pheno_rel_matrix_time_points':jQuery('#analysis_calculate_statistics_htp_phenotypes_rel_matrix_times_select').val(),
400 'htp_pheno_rel_matrix_blues_inversion':jQuery('#analysis_calculate_statistics_htp_phenotypes_rel_matrix_inversion_select').val(),
401 'tolparinv':jQuery('#analysis_calculate_statistics_tolparinv_select').val(),
402 'legendre_order_number':jQuery('#analysis_calculate_statistics_legendre_order_number_select').val(),
403 'fixed_effect_type':jQuery('#analysis_calculate_statistics_fixed_effect_select_div').val(),
404 'fixed_effect_trait_id':jQuery('#analysis_calculate_statistics_fixed_effect_trait_select').val(),
405 'fixed_effect_quantiles':jQuery('#analysis_calculate_statistics_fixed_effect_select_quantile').val()
407 beforeSend: function() {
408 jQuery("#working_modal").modal("show");
410 success: function(response){
411 console.log(response);
412 jQuery("#working_modal").modal("hide");
414 if (response.error) {
415 alert(response.error);
418 analysis_calculate_statistics_response = response;
421 if (response.sum_square_residual) {
422 html = html + '<h4>Sum square residual: '+response.sum_square_residual+'</h4><hr>';
424 if (response.genetic_effects_line_plot) {
425 html = html + '<img src="'+response.genetic_effects_line_plot+'"><hr>';
427 if (response.env_effects_heatmap_plot) {
428 html = html + '<img src="'+response.env_effects_heatmap_plot+'"><hr>';
430 if (response.unique_accessions.length > 0 && response.unique_traits.length > 0 && response.result_blup_genetic_data) {
431 analysis_calculate_statistics_accession_names = response.unique_accessions;
432 analysis_calculate_statistics_trait_names = response.unique_traits;
433 analysis_calculate_statistics_phenotype_training_file = response.stats_tempfile;
434 analysis_calculate_statistics_grm_training_file = response.grm_file;
436 html = html + '<table class="table table-bordered table-hover"><thead><tr><th>Accessions</th>';
437 for (var i=0; i<analysis_calculate_statistics_trait_names.length; i++) {
438 html = html + '<th>'+analysis_calculate_statistics_trait_names[i]+'</th>';
440 html = html + '</tr></thead><tbody>';
441 for (var k=0; k<response.unique_accessions.length; k++) {
442 var acc = response.unique_accessions[k];
443 html = html + '<tr><td>'+acc+'</td>';
444 for (var i=0; i<analysis_calculate_statistics_trait_names.length; i++) {
445 if (response.result_blup_genetic_data[acc] && response.result_blup_genetic_data[acc][analysis_calculate_statistics_trait_names[i]]) {
446 html = html + '<td>'+response.result_blup_genetic_data[acc][analysis_calculate_statistics_trait_names[i]][0]+'</td>';
449 html = html + '<td>NA</td>';
452 html = html + '</tr>';
454 html = html + '</tbody></table>';
457 if (response.unique_plots.length > 0 && response.unique_traits.length > 0 && response.result_blup_spatial_data) {
458 analysis_calculate_statistics_plot_names = response.unique_plots;
459 analysis_calculate_statistics_trait_names = response.unique_traits;
461 html = html + '<table class="table table-bordered table-hover"><thead><tr><th>Plots</th>';
462 for (var i=0; i<response.unique_traits.length; i++) {
463 html = html + '<th>'+response.unique_traits[i]+'</th>';
465 html = html + '</tr></thead><tbody>';
466 for (var k=0; k<response.unique_plots.length; k++) {
467 var plot = response.unique_plots[k];
468 html = html + '<tr><td>'+plot+'</td>';
469 for (var i=0; i<response.unique_traits.length; i++) {
470 html = html + '<td>'+response.result_blup_spatial_data[plot][response.unique_traits[i]][0]+'</td>';
472 html = html + '</tr>';
474 html = html + '</tbody></table>';
477 if (response.results.length > 0) {
478 html = '<table class="table table-bordered table-hover"><thead><tr><th>Observation Variable</th><th>Statistics</th><th>Plot</th></tr></thead><tbody>';
479 for (var i=0; i<response.results.length; i++) {
480 html = html + '<tr><td>'+response.results[i][0]+'</td><td>'+response.results[i][1]+'</td><td><img src="'+response.results[i][2]+'"></td></tr>';
482 html = html + '</tbody></table>';
485 html = html + '<hr><a href="'+response.stats_out_tempfile_string+'.log" target=_blank>Stats file or log</a>';
487 if (jQuery('#analysis_calculate_statistics_relationship_matrix_type_select_div').val() == 'htp_phenotypes') {
488 html = html + '<hr><a href="'+response.stats_out_htp_rel_tempfile_out_string+'" target=_blank>HTP Relationship Matrix</a>';
491 jQuery('#analysis_calculate_statistics_result_div').html(html);
493 Workflow.complete("#analysis_calculate_statistics_select_step");
494 Workflow.focus('#analysis_calculate_statistics_workflow', 3);
497 error: function(response){
498 jQuery("#working_modal").modal("hide");
499 alert('Error calculating statistics!')
504 jQuery('#analysis_calculate_statistics_analysis_save_blups_genetic_pe_residual').click(function(){
505 jQuery('#generic_save_analysis_template_dialog').modal('show');
508 jQuery('#generic_save_analysis_template_submit_button').click(function(){
509 var generic_save_analysis_template_analysis_name = jQuery('#generic_save_analysis_template_analysis_name').val();
510 var generic_save_analysis_template_analysis_description = jQuery('#generic_save_analysis_template_analysis_description').val();
511 var generic_save_analysis_template_analysis_year = jQuery('#generic_save_analysis_template_analysis_year').val();
512 var generic_save_analysis_template_breeding_program_id = jQuery('#generic_save_analysis_template_breeding_program_id').val();
514 if (generic_save_analysis_template_analysis_name == '') {
515 alert('Please give an analysis template name');
518 if (generic_save_analysis_template_analysis_description == '') {
519 alert('Please give an analysis template description');
522 if (generic_save_analysis_template_analysis_year == '') {
523 alert('Please give an analysis template year');
527 var analysis_stats_parameters = {};
528 var analysis_stats_protocol = '';
529 var analysis_stats_auxiliary_files = [];
530 var analysis_stats_result_summary = {};
531 var analysis_statistical_ontology_term = '';
532 var analysis_stats_compose_trait_info;
534 var analysis_stats_tolparinv_param = jQuery('#analysis_calculate_statistics_tolparinv_select').val();
535 var analysis_stats_numbers_traits = analysis_calculate_statistics_response.unique_traits.length;
536 var analysis_legendre_order = jQuery('#analysis_calculate_statistics_legendre_order_number_select').val();
537 var analysis_genotyping_protocol_id = jQuery('#analysis_calculate_statistics_genotyping_protocol_select').val();
538 var analysis_compute_genotypes_from_parents = jQuery('#analysis_calculate_statistics_genotyping_protocol_compute_from_parents_select').val();
540 var analysis_stats_mv_traits = [];
541 for (var i=1; i<analysis_stats_numbers_traits+1; i++) {
542 analysis_stats_mv_traits.push('t'+i);
544 var analysis_stats_mv_traits_string = analysis_stats_mv_traits.join();
546 if (analysis_calculate_statistics_select == 'sommer_grm_spatial_genetic_blups') {
548 analysis_stats_protocol = 'mmer('+analysis_stats_mv_traits_string+'~1+replicate, random=~vs(id, Gu=geno_mat, Gtc=unsm('+analysis_stats_numbers_traits+')) +vs(rowNumberFactor, Gtc=diag('+analysis_stats_numbers_traits+')) +vs(colNumberFactor, Gtc=diag('+analysis_stats_numbers_traits+')) +vs(spl2D(rowNumber, colNumber), Gtc=diag('+analysis_stats_numbers_traits+')), rcov=~vs(units, Gtc=unsm('+analysis_stats_numbers_traits+')), data=mat, tolparinv='+analysis_stats_tolparinv_param+');';
550 analysis_stats_parameters = {
551 'tolparinv':analysis_stats_tolparinv_param,
552 'genotyping_protocol_id':analysis_genotyping_protocol_id,
553 'compute_genotypes_from_parents':analysis_compute_genotypes_from_parents,
554 'protocol':analysis_stats_protocol
557 analysis_stats_auxiliary_files = [{'auxiliary_model_file':analysis_calculate_statistics_response.grm_file, auxiliary_model_file_archive_type:'nickssinglemultitrialgebvanalyses_v1.01_sommer_grm_spatial_genetic_blups_grm_file'}];
559 analysis_stats_compose_trait_info = JSON.stringify(analysis_calculate_statistics_response.trait_composing_info);
561 analysis_statistical_ontology_term = "Multivariate linear mixed model genetic BLUPs using genetic relationship matrix and row and column spatial effects computed using Sommer R|SGNSTAT:0000001";
563 if (analysis_calculate_statistics_select == 'sommer_grm_genetic_blups') {
565 analysis_stats_protocol = 'mmer('+analysis_stats_mv_traits_string+'~1+replicate, random=~vs(id, Gu=geno_mat, Gtc=unsm('+analysis_stats_numbers_traits+')), rcov=~vs(units, Gtc=unsm('+analysis_stats_numbers_traits+')), data=mat, tolparinv='+analysis_stats_tolparinv_param+');';
567 analysis_stats_parameters = {
568 'tolparinv':analysis_stats_tolparinv_param,
569 'genotyping_protocol_id':analysis_genotyping_protocol_id,
570 'compute_genotypes_from_parents':analysis_compute_genotypes_from_parents,
571 'protocol':analysis_stats_protocol
574 analysis_stats_auxiliary_files = [{'auxiliary_model_file':analysis_calculate_statistics_response.grm_file, auxiliary_model_file_archive_type:'nickssinglemultitrialgebvanalyses_v1.01_sommer_grm_genetic_blups_grm_file'}];
576 analysis_stats_compose_trait_info = JSON.stringify(analysis_calculate_statistics_response.trait_composing_info);
578 analysis_statistical_ontology_term = "Multivariate genetic BLUPs using genetic relationship matrix computed using Sommer R|SGNSTAT:0000024";
581 var training_data_file = analysis_calculate_statistics_response.stats_tempfile;
583 if (analysis_calculate_statistics_select == 'lmer_germplasmname_replicate') {
584 analysis_stats_protocol = 'lmer(t1~replicate + 1|germplasmName, data=mat, na.action = na.omit)';
585 analysis_stats_parameters = {
586 'protocol':analysis_stats_protocol
588 analysis_statistical_ontology_term = "Univariate linear mixed model genetic BLUPs using germplasmName computed using LMER R|SGNSTAT:0000002";
593 url : '/ajax/analysis/store/json',
595 'analysis_to_save_boolean':'yes',
596 'analysis_name':generic_save_analysis_template_analysis_name+'_GBLUPS',
597 'analysis_description':generic_save_analysis_template_analysis_description,
598 'analysis_year':generic_save_analysis_template_analysis_year,
599 'analysis_breeding_program_id':generic_save_analysis_template_breeding_program_id,
600 'analysis_protocol':analysis_stats_protocol,
601 'analysis_dataset_id':'',
602 'analysis_accession_names':JSON.stringify(analysis_calculate_statistics_response.unique_accessions),
603 'analysis_trait_names':JSON.stringify(analysis_calculate_statistics_response.unique_traits),
604 'analysis_analysis_statistical_ontology_term':analysis_statistical_ontology_term,
605 'analysis_precomputed_design_optional':'',
606 'analysis_result_values':JSON.stringify(analysis_calculate_statistics_response.result_blup_genetic_data),
607 'analysis_result_values_type':'analysis_result_values_match_accession_names',
608 'analysis_result_summary':JSON.stringify(analysis_stats_result_summary),
609 'analysis_result_trait_compose_info':analysis_stats_compose_trait_info,
610 'analysis_model_id':'',
611 'analysis_model_name':generic_save_analysis_template_analysis_name+'_GBLUPSandPEandResiduals_Model',
612 'analysis_model_description':generic_save_analysis_template_analysis_description,
613 'analysis_model_is_public':'yes',
614 'analysis_model_language':analysis_calculate_statistics_response.analysis_model_language,
615 'analysis_model_type':analysis_calculate_statistics_response.analysis_model_type,
616 'analysis_model_properties':JSON.stringify(analysis_stats_parameters),
617 'analysis_model_application_name':analysis_calculate_statistics_response.application_name,
618 'analysis_model_application_version':analysis_calculate_statistics_response.application_version,
619 'analysis_model_file':'',
620 'analysis_model_file_type':'',
621 'analysis_model_training_data_file':training_data_file,
622 'analysis_model_training_data_file_type':analysis_calculate_statistics_response.analysis_model_training_data_file_type,
623 'analysis_model_auxiliary_files':JSON.stringify(analysis_stats_auxiliary_files)
625 beforeSend: function() {
626 jQuery('#working_modal').modal('show');
628 success: function(response){
629 console.log(response);
630 if (response.error) {
631 alert(response.error);
633 if (response.success) {
634 var html = '<center>';
635 if (response.model_id) {
636 html = html + '<p>Go to saved <a href="/analyses_model/'+response.model_id+'" target=_blank >model</a></p>';
638 if (response.analysis_id) {
639 html = html + '<p>Go to saved <a href="/analyses/'+response.analysis_id+'" target=_blank >GBLUP analysis</a></p>';
641 html = html + '</center>';
642 jQuery('#generic_save_analysis_template_response_div').html(html);
644 var analysis_statistical_ontology_term;
645 var analysis_stats_auxiliary_files;
646 var analysis_stats_training_data_file;
647 var generic_save_analysis_template_name_type = '_Spatial';
648 var generic_save_analysis_template_env1_result_values = JSON.stringify(analysis_calculate_statistics_response.result_blup_spatial_data);
650 if (analysis_calculate_statistics_select == 'sommer_grm_spatial_genetic_blups') {
651 analysis_statistical_ontology_term = "Multivariate linear mixed model 2D spline spatial BLUPs using genetic relationship matrix and row and column spatial effects computed using Sommer R|SGNSTAT:0000003";
653 analysis_stats_auxiliary_files = [{'auxiliary_model_file':analysis_calculate_statistics_response.grm_file, auxiliary_model_file_archive_type:'nickssinglemultitrialgebvanalyses_v1.01_sommer_grm_spatial_genetic_blups_grm_file'}];
655 analysis_stats_training_data_file = analysis_calculate_statistics_response.stats_tempfile;
660 url : '/ajax/analysis/store/json',
662 'analysis_to_save_boolean':'yes',
663 'analysis_name':generic_save_analysis_template_analysis_name+generic_save_analysis_template_name_type,
664 'analysis_description':generic_save_analysis_template_analysis_description,
665 'analysis_year':generic_save_analysis_template_analysis_year,
666 'analysis_breeding_program_id':generic_save_analysis_template_breeding_program_id,
667 'analysis_protocol':analysis_stats_protocol,
668 'analysis_dataset_id':'',
669 'analysis_accession_names':JSON.stringify(analysis_calculate_statistics_response.unique_accessions),
670 'analysis_trait_names':JSON.stringify(analysis_calculate_statistics_response.unique_traits),
671 'analysis_analysis_statistical_ontology_term':analysis_statistical_ontology_term,
672 'analysis_precomputed_design_optional':JSON.stringify(analysis_calculate_statistics_response.field_trial_design),
673 'analysis_result_values':generic_save_analysis_template_env1_result_values,
674 'analysis_result_values_type':'analysis_result_values_match_precomputed_design',
675 'analysis_result_summary':JSON.stringify(analysis_stats_result_summary),
676 'analysis_result_trait_compose_info':'',
677 'analysis_model_id':response.model_id,
678 'analysis_model_name':'',
679 'analysis_model_description':'',
680 'analysis_model_is_public':'yes',
681 'analysis_model_language':analysis_calculate_statistics_response.analysis_model_language,
682 'analysis_model_type':analysis_calculate_statistics_response.analysis_model_type,
683 'analysis_model_properties':JSON.stringify(analysis_stats_parameters),
684 'analysis_model_application_name':analysis_calculate_statistics_response.application_name,
685 'analysis_model_application_version':analysis_calculate_statistics_response.application_version,
686 'analysis_model_file':'',
687 'analysis_model_file_type':'',
688 'analysis_model_training_data_file':analysis_stats_training_data_file,
689 'analysis_model_training_data_file_type':analysis_calculate_statistics_response.analysis_model_training_data_file_type,
690 'analysis_model_auxiliary_files':JSON.stringify(analysis_stats_auxiliary_files)
692 success: function(response){
693 console.log(response);
694 if (response.error) {
695 alert(response.error);
697 if (response.success) {
698 html = html + '<center>';
699 if (response.analysis_id) {
700 if (analysis_calculate_statistics_select == 'sommer_grm_spatial_genetic_blups') {
701 html = html + '<p>Go to saved <a href="/analyses/'+response.analysis_id+'" target=_blank >spatial BLUP analysis</a></p>';
704 html = html + '</center>';
705 jQuery('#generic_save_analysis_template_response_div').html(html);
707 var analysis_stats_auxiliary_files;
708 var analysis_stats_training_data_file;
710 if (analysis_calculate_statistics_select == 'sommer_grm_spatial_genetic_blups') {
711 jQuery('#working_modal').modal('hide');
712 alert('Analysis and/or model saved!');
718 url : '/ajax/analysis/store/json',
720 'analysis_to_save_boolean':'yes',
721 'analysis_name':generic_save_analysis_template_analysis_name+'_Residual',
722 'analysis_description':generic_save_analysis_template_analysis_description,
723 'analysis_year':generic_save_analysis_template_analysis_year,
724 'analysis_breeding_program_id':generic_save_analysis_template_breeding_program_id,
725 'analysis_protocol':analysis_stats_protocol,
726 'analysis_dataset_id':'',
727 'analysis_accession_names':JSON.stringify(analysis_calculate_statistics_response.unique_accessions),
728 'analysis_trait_names':JSON.stringify(analysis_calculate_statistics_response.unique_residual_traits),
729 'analysis_analysis_statistical_ontology_term':analysis_statistical_ontology_term,
730 'analysis_precomputed_design_optional':JSON.stringify(analysis_calculate_statistics_response.field_trial_design),
731 'analysis_result_values':JSON.stringify(analysis_calculate_statistics_response.result_residual_data),
732 'analysis_result_values_type':'analysis_result_values_match_precomputed_design',
733 'analysis_result_summary':JSON.stringify(analysis_stats_result_summary),
734 'analysis_result_trait_compose_info':JSON.stringify(analysis_calculate_statistics_response.trait_composing_info),
735 'analysis_model_id':response.model_id,
736 'analysis_model_name':'',
737 'analysis_model_description':'',
738 'analysis_model_is_public':'yes',
739 'analysis_model_language':analysis_calculate_statistics_response.analysis_model_language,
740 'analysis_model_type':analysis_calculate_statistics_response.analysis_model_type,
741 'analysis_model_properties':JSON.stringify(analysis_stats_parameters),
742 'analysis_model_application_name':analysis_calculate_statistics_response.application_name,
743 'analysis_model_application_version':analysis_calculate_statistics_response.application_version,
744 'analysis_model_file':'',
745 'analysis_model_file_type':'',
746 'analysis_model_training_data_file':analysis_stats_training_data_file,
747 'analysis_model_training_data_file_type':analysis_calculate_statistics_response.analysis_model_training_data_file_type,
748 'analysis_model_auxiliary_files':JSON.stringify(analysis_stats_auxiliary_files)
750 success: function(response){
751 jQuery('#working_modal').modal('hide');
752 console.log(response);
753 if (response.error) {
754 alert(response.error);
756 if (response.success) {
757 alert('Analysis and/or model saved!');
758 html = html + '<center>';
759 if (response.analysis_id) {
760 html = html + '<p>Go to saved <a href="/analyses/'+response.analysis_id+'" target=_blank >residuals analysis</a></p>';
762 html = html + '</center>';
763 jQuery('#generic_save_analysis_template_response_div').html(html);
766 error: function(response){
767 alert('Error saving analysis multiple!');
772 error: function(response){
773 alert('Error saving analysis multiple!');
778 error: function(response){
779 jQuery('#working_modal').modal('hide');
780 alert('Error saving analysis multiple!');
785 jQuery('#analysis_calculate_statistics_analysis_save_blups_genetic').click(function(){
786 jQuery('#generic_save_analysis_dialog').modal('show');
788 var analysis_stats_parameters = {};
789 var analysis_stats_protocol = '';
790 var analysis_stats_auxiliary_files = [];
791 var analysis_stats_result_summary = {};
792 var analysis_statistical_ontology_term = '';
794 var analysis_stats_tolparinv_param = jQuery('#analysis_calculate_statistics_tolparinv_select').val();
795 var analysis_stats_numbers_traits = analysis_calculate_statistics_response.unique_traits.length;
796 var analysis_legendre_order = jQuery('#analysis_calculate_statistics_legendre_order_number_select').val();
797 var analysis_genotyping_protocol_id = jQuery('#analysis_calculate_statistics_genotyping_protocol_select').val();
798 var analysis_compute_genotypes_from_parents = jQuery('#analysis_calculate_statistics_genotyping_protocol_compute_from_parents_select').val();
800 var analysis_stats_mv_traits = [];
801 for (var i=1; i<analysis_stats_numbers_traits+1; i++) {
802 analysis_stats_mv_traits.push('t'+i);
804 var analysis_stats_mv_traits_string = analysis_stats_mv_traits.join();
806 if (analysis_calculate_statistics_select == 'sommer_grm_spatial_genetic_blups') {
808 analysis_stats_protocol = 'mmer('+analysis_stats_mv_traits_string+'~1+replicate, random=~vs(id, Gu=geno_mat, Gtc=unsm('+analysis_stats_numbers_traits+')) +vs(rowNumberFactor, Gtc=diag('+analysis_stats_numbers_traits+')) +vs(colNumberFactor, Gtc=diag('+analysis_stats_numbers_traits+')) +vs(spl2D(rowNumber, colNumber), Gtc=diag('+analysis_stats_numbers_traits+')), rcov=~vs(units, Gtc=unsm('+analysis_stats_numbers_traits+')), data=mat, tolparinv='+analysis_stats_tolparinv_param+');';
810 analysis_stats_parameters = {
811 'tolparinv':analysis_stats_tolparinv_param,
812 'genotyping_protocol_id':analysis_genotyping_protocol_id,
813 'compute_genotypes_from_parents':analysis_compute_genotypes_from_parents,
814 'protocol':analysis_stats_protocol
817 analysis_stats_auxiliary_files = [{'auxiliary_model_file':analysis_calculate_statistics_response.grm_file, auxiliary_model_file_archive_type:'nickssinglemultitrialgebvanalyses_v1.01_sommer_grm_spatial_genetic_blups_grm_file'}];
819 jQuery('#generic_save_analysis_result_compose_trait_info').val(JSON.stringify(analysis_calculate_statistics_response.trait_composing_info));
821 analysis_statistical_ontology_term = "Multivariate linear mixed model genetic BLUPs using genetic relationship matrix and row and column spatial effects computed using Sommer R|SGNSTAT:0000001";
823 if (analysis_calculate_statistics_select == 'sommer_grm_genetic_blups') {
825 analysis_stats_protocol = 'mmer('+analysis_stats_mv_traits_string+'~1+replicate, random=~vs(id, Gu=geno_mat, Gtc=unsm('+analysis_stats_numbers_traits+')), rcov=~vs(units, Gtc=unsm('+analysis_stats_numbers_traits+')), data=mat, tolparinv='+analysis_stats_tolparinv_param+');';
827 analysis_stats_parameters = {
828 'tolparinv':analysis_stats_tolparinv_param,
829 'genotyping_protocol_id':analysis_genotyping_protocol_id,
830 'compute_genotypes_from_parents':analysis_compute_genotypes_from_parents,
831 'protocol':analysis_stats_protocol
834 analysis_stats_auxiliary_files = [{'auxiliary_model_file':analysis_calculate_statistics_response.grm_file, auxiliary_model_file_archive_type:'nickssinglemultitrialgebvanalyses_v1.01_sommer_grm_genetic_blups_grm_file'}];
836 jQuery('#generic_save_analysis_result_compose_trait_info').val(JSON.stringify(analysis_calculate_statistics_response.trait_composing_info));
838 analysis_statistical_ontology_term = "Multivariate genetic BLUPs using genetic relationship matrix computed using Sommer R|SGNSTAT:0000024";
841 var training_data_file = analysis_calculate_statistics_response.stats_tempfile;
843 if (analysis_calculate_statistics_select == 'lmer_germplasmname_replicate') {
844 analysis_stats_protocol = 'lmer(t1~replicate + 1|germplasmName, data=mat, na.action = na.omit)';
845 analysis_stats_parameters = {
846 'protocol':analysis_stats_protocol
848 analysis_statistical_ontology_term = "Univariate linear mixed model genetic BLUPs using germplasmName computed using LMER R|SGNSTAT:0000002";
851 jQuery('#generic_save_analysis_protocol').val(analysis_stats_protocol);
852 jQuery('#generic_save_analysis_model_properties').val(JSON.stringify(analysis_stats_parameters));
853 //jQuery('#generic_save_analysis_dataset_id').val();
854 jQuery('#generic_save_analysis_accession_names').val(JSON.stringify(analysis_calculate_statistics_response.unique_accessions));
855 jQuery('#generic_save_analysis_trait_names').val(JSON.stringify(analysis_calculate_statistics_response.unique_traits));
856 jQuery('#generic_save_analysis_analysis_statistical_ontology_term').val(analysis_statistical_ontology_term);
857 //jQuery('#generic_save_analysis_design').val();
858 jQuery('#generic_save_analysis_result_values').val(JSON.stringify(analysis_calculate_statistics_response.result_blup_genetic_data));
859 jQuery('#generic_save_analysis_result_values_type').val(analysis_calculate_statistics_response.analysis_result_values_type);
860 jQuery('#generic_save_analysis_result_summary_values').val(JSON.stringify(analysis_stats_result_summary));
861 jQuery('#generic_save_analysis_model_language').val(analysis_calculate_statistics_response.analysis_model_language);
862 jQuery('#generic_save_analysis_model_type').val(analysis_calculate_statistics_response.analysis_model_type);
863 jQuery('#generic_save_analysis_model_application_name').val(analysis_calculate_statistics_response.application_name);
864 jQuery('#generic_save_analysis_model_application_version').val(analysis_calculate_statistics_response.application_version);
865 //jQuery('#generic_save_analysis_model_file').val();
866 //jQuery('#generic_save_analysis_model_archived_model_file_type').val();
867 jQuery('#generic_save_analysis_model_training_data_file').val(training_data_file);
868 jQuery('#generic_save_analysis_model_archived_training_data_file_type').val(analysis_calculate_statistics_response.analysis_model_training_data_file_type);
869 jQuery('#generic_save_analysis_model_auxiliary_files').val(JSON.stringify(analysis_stats_auxiliary_files));
874 jQuery('#analysis_calculate_statistics_analysis_save_blups_spatial').click(function(){
875 if (analysis_calculate_statistics_field_trial_id_array.length>1) {
876 alert('Saving spatial BLUPs currently only implemented for a single trial, so only select one field trial in your analysis');
880 jQuery('#generic_save_analysis_dialog').modal('show');
882 var analysis_stats_result_summary = {};
884 var analysis_stats_tolparinv_param = jQuery('#analysis_calculate_statistics_tolparinv_select').val();
885 var analysis_stats_numbers_traits = analysis_calculate_statistics_response.unique_traits.length;
886 var analysis_genotyping_protocol_id = jQuery('#analysis_calculate_statistics_genotyping_protocol_select').val();
887 var analysis_compute_genotypes_from_parents = jQuery('#analysis_calculate_statistics_genotyping_protocol_compute_from_parents_select').val();
889 var analysis_stats_mv_traits = [];
890 for (var i=1; i<analysis_stats_numbers_traits+1; i++) {
891 analysis_stats_mv_traits.push('t'+i);
893 var analysis_stats_mv_traits_string = analysis_stats_mv_traits.join();
895 var analysis_stats_protocol = 'mmer('+analysis_stats_mv_traits_string+'~1, random=~vs(id, Gu=geno_mat, Gtc=unsm('+analysis_stats_numbers_traits+')) +vs(rowNumberFactor, Gtc=diag('+analysis_stats_numbers_traits+')) +vs(colNumberFactor, Gtc=diag('+analysis_stats_numbers_traits+')), rcov=~vs(units, Gtc=unsm('+analysis_stats_numbers_traits+')), data=mat, tolparinv='+analysis_stats_tolparinv_param+');';
897 var analysis_stats_parameters = {
898 'tolparinv':analysis_stats_tolparinv_param,
899 'genotyping_protocol_id':analysis_genotyping_protocol_id,
900 'compute_genotypes_from_parents':analysis_compute_genotypes_from_parents,
901 'protocol':analysis_stats_protocol
904 var analysis_statistical_ontology_term = "Multivariate linear mixed model 2D spline spatial BLUPs using genetic relationship matrix and row and column spatial effects computed using Sommer R|SGNSTAT:0000003";
906 jQuery('#generic_save_analysis_result_compose_trait_info').val(JSON.stringify(analysis_calculate_statistics_response.trait_composing_info));
908 var analysis_stats_auxiliary_files = [{'auxiliary_model_file':analysis_calculate_statistics_response.grm_file, auxiliary_model_file_archive_type:'nickssinglemultitrialgebvanalyses_v1.01_sommer_grm_spatial_genetic_blups_grm_file'}];
910 jQuery('#generic_save_analysis_protocol').val(analysis_stats_protocol);
911 jQuery('#generic_save_analysis_model_properties').val(JSON.stringify(analysis_stats_parameters));
912 //jQuery('#generic_save_analysis_dataset_id').val();
913 jQuery('#generic_save_analysis_accession_names').val(JSON.stringify(analysis_calculate_statistics_response.unique_accessions));
914 jQuery('#generic_save_analysis_trait_names').val(JSON.stringify(analysis_calculate_statistics_response.unique_traits));
915 jQuery('#generic_save_analysis_analysis_statistical_ontology_term').val(analysis_statistical_ontology_term);
916 jQuery('#generic_save_analysis_design').val(JSON.stringify(analysis_calculate_statistics_response.field_trial_design));
917 jQuery('#generic_save_analysis_result_values').val(JSON.stringify(analysis_calculate_statistics_response.result_blup_spatial_data));
918 jQuery('#generic_save_analysis_result_values_type').val('analysis_result_values_match_precomputed_design');
919 jQuery('#generic_save_analysis_result_summary_values').val(JSON.stringify(analysis_stats_result_summary));
920 jQuery('#generic_save_analysis_model_language').val(analysis_calculate_statistics_response.analysis_model_language);
921 jQuery('#generic_save_analysis_model_type').val(analysis_calculate_statistics_response.analysis_model_type);
922 jQuery('#generic_save_analysis_model_application_name').val(analysis_calculate_statistics_response.application_name);
923 jQuery('#generic_save_analysis_model_application_version').val(analysis_calculate_statistics_response.application_version);
924 //jQuery('#generic_save_analysis_model_file').val();
925 //jQuery('#generic_save_analysis_model_archived_model_file_type').val();
926 jQuery('#generic_save_analysis_model_training_data_file').val(analysis_calculate_statistics_response.stats_tempfile);
927 jQuery('#generic_save_analysis_model_archived_training_data_file_type').val(analysis_calculate_statistics_response.analysis_model_training_data_file_type);
928 jQuery('#generic_save_analysis_model_auxiliary_files').val(JSON.stringify(analysis_stats_auxiliary_files));
933 jQuery('#analysis_calculate_statistics_analysis_save_residuals').click(function(){
934 jQuery('#generic_save_analysis_dialog').modal('show');
936 var analysis_stats_result_summary = {};
938 jQuery('#generic_save_analysis_result_compose_trait_info').val(JSON.stringify(analysis_calculate_statistics_response.trait_composing_info));
940 var analysis_stats_tolparinv_param = jQuery('#analysis_calculate_statistics_tolparinv_select').val();
941 var analysis_legendre_order = jQuery('#analysis_calculate_statistics_legendre_order_number_select').val();
942 var analysis_permanent_env_structure = jQuery('#analysis_calculate_statistics_permanent_env_structure_select').val();
943 var analysis_genotyping_protocol_id = jQuery('#analysis_calculate_statistics_genotyping_protocol_select').val();
944 var analysis_compute_genotypes_from_parents = jQuery('#analysis_calculate_statistics_genotyping_protocol_compute_from_parents_select').val();
946 var analysis_stats_protocol = '';
947 var analysis_statistical_ontology_term;
948 var analysis_stats_auxiliary_files;
949 var analysis_stats_training_data_file;
951 var analysis_stats_parameters = {
952 'tolparinv':analysis_stats_tolparinv_param,
953 'genotyping_protocol_id':analysis_genotyping_protocol_id,
954 'compute_genotypes_from_parents':analysis_compute_genotypes_from_parents,
955 'legendre_polynomial_order':analysis_legendre_order,
956 'protocol':analysis_stats_protocol,
957 'permanent_environment_structure':analysis_permanent_env_structure
960 jQuery('#generic_save_analysis_protocol').val(analysis_stats_protocol);
961 jQuery('#generic_save_analysis_model_properties').val(JSON.stringify(analysis_stats_parameters));
962 //jQuery('#generic_save_analysis_dataset_id').val();
963 jQuery('#generic_save_analysis_accession_names').val(JSON.stringify(analysis_calculate_statistics_response.unique_accessions));
964 jQuery('#generic_save_analysis_trait_names').val(JSON.stringify(analysis_calculate_statistics_response.unique_residual_traits));
965 jQuery('#generic_save_analysis_analysis_statistical_ontology_term').val(analysis_statistical_ontology_term);
966 jQuery('#generic_save_analysis_design').val(JSON.stringify(analysis_calculate_statistics_response.field_trial_design));
967 jQuery('#generic_save_analysis_result_values').val(JSON.stringify(analysis_calculate_statistics_response.result_residual_data));
968 jQuery('#generic_save_analysis_result_values_type').val('analysis_result_values_match_precomputed_design');
969 jQuery('#generic_save_analysis_result_summary_values').val(JSON.stringify(analysis_stats_result_summary));
970 jQuery('#generic_save_analysis_model_language').val(analysis_calculate_statistics_response.analysis_model_language);
971 jQuery('#generic_save_analysis_model_type').val(analysis_calculate_statistics_response.analysis_model_type);
972 jQuery('#generic_save_analysis_model_application_name').val(analysis_calculate_statistics_response.application_name);
973 jQuery('#generic_save_analysis_model_application_version').val(analysis_calculate_statistics_response.application_version);
974 //jQuery('#generic_save_analysis_model_file').val();
975 //jQuery('#generic_save_analysis_model_archived_model_file_type').val();
976 jQuery('#generic_save_analysis_model_training_data_file').val(analysis_calculate_statistics_response.stats_tempfile);
977 jQuery('#generic_save_analysis_model_archived_training_data_file_type').val(analysis_calculate_statistics_response.analysis_model_training_data_file_type);
978 jQuery('#generic_save_analysis_model_auxiliary_files').val(JSON.stringify(analysis_stats_auxiliary_files));