4 <& /util/import_javascript.mas, classes => [ 'jquery', 'jquery.iframe-post-form' ], entries => [ ] &>
6 <div class="modal fade" id="upload_new_analysis_dialog" name="upload_new_analysis_dialog" tabindex="-1" role="dialog" aria-labelledby="uploadNewAnalysisDialog">
7 <div class="modal-dialog modal-xl" role="document">
8 <div class="modal-content">
9 <div class="modal-header" style="text-align: center">
10 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
11 <h4 class="modal-title" id="uploadNewAnalysisDialog">Upload Analysis</h4>
13 <div class="modal-body">
14 <div class="container-fluid">
16 <form class="form-horizontal" method="post" enctype="multipart/form-data" encoding="multipart/form-data" id="upload_new_analysis_dialog_form" name="upload_new_analysis_dialog_form">
18 <&| /util/workflow.mas, id=> "upload_new_analysis_workflow" &>
19 <&| /util/workflow.mas:step, title=> "Intro" &>
20 <& /page/page_title.mas, title=>"This workflow will guide you through uploading an analysis to the database" &>
21 <p>You should have a spreadsheet (.csv) where the first column names the accession names or plots, and the subsequent columns have result values.</p>
22 <p>The header row should have 'stock_name' in the first column and subsequent column headers should be for a trait variable e.g. 'plant height|CO_323:0000123'</p>
26 <button class="btn btn-primary" onclick="Workflow.complete(this); return false;">Go to Next Step</button>
29 <&| /util/workflow.mas:step, title=> "Analysis" &>
30 <& /page/page_title.mas, title=>"Define the analysis" &>
32 <div class="form-group form-group-sm">
33 <label class="col-sm-3 control-label">Analysis Name (must be unique): </label>
34 <div class="col-sm-9">
35 <input class="form-control" id="upload_new_analysis_name" name="upload_new_analysis_name" type="text" />
38 <div class="form-group form-group-sm">
39 <label class="col-sm-3 control-label">Analysis Description: </label>
40 <div class="col-sm-9">
41 <input class="form-control" id="upload_new_analysis_description" name="upload_new_analysis_description" type="text" />
44 <div class="form-group form-group-sm">
45 <label class="col-sm-3 control-label">Analysis Protocol (describe the analysis as a formula arbitrarily) (e.g. lme4(t1 ~ rep + accession)): </label>
46 <div class="col-sm-9">
47 <input class="form-control" id="upload_new_analysis_protocol" name="upload_new_analysis_protocol" type="text" />
50 <div class="form-group form-group-sm">
51 <label class="col-sm-3 control-label">Analysis Of: </label>
52 <div class="col-sm-9">
53 <select class="form-control" id="upload_new_analysis_result_values_type" name="upload_new_analysis_result_values_type" >
54 <option value='analysis_result_values_match_accession_names'>Accession Names (for genetic blups, genetic results)</option>
55 <option value='analysis_result_values_match_precomputed_design'>Plot Names (for plot predictions, spatial, temporal results)</option>
59 <div class="form-group form-group-sm">
60 <label class="col-sm-3 control-label">Breeding Program: </label>
61 <div class="col-sm-9">
62 <div id="upload_new_analysis_breeding_program_div"></div>
65 <div class="form-group form-group-sm">
66 <label class="col-sm-3 control-label">Year: </label>
67 <div class="col-sm-9">
68 <div id="upload_new_analysis_year_div"></div>
71 <div class="form-group form-group-sm">
72 <label class="col-sm-3 control-label">Statistical Ontology Term (from SGNSTAT): </label>
73 <div class="col-sm-9">
74 <div id="upload_new_analysis_stat_term_div"></div>
77 <div class="form-group form-group-sm">
78 <label class="col-sm-3 control-label">Results File (.csv): </label>
79 <div class="col-sm-9" >
80 <input type="file" name="upload_new_analysis_file" id="upload_new_analysis_file" encoding="multipart/form-data" />
83 <div class="form-group form-group-sm">
84 <label class="col-sm-3 control-label">Dataset ID (optional): </label>
85 <div class="col-sm-9">
86 <input class="form-control" id="upload_new_analysis_dataset_id" name="upload_new_analysis_dataset_id" type="text" />
89 <div class="form-group form-group-sm">
90 <label class="col-sm-3 control-label">Result Summary (optional) (key:value comma separated. e.g. genetic_variance:0.6,phenotypic_variance:0.8): </label>
91 <div class="col-sm-9">
92 <input class="form-control" id="upload_new_analysis_result_summary_string" name="upload_new_analysis_result_summary_string" type="text" />
95 <div class="form-group form-group-sm">
96 <label class="col-sm-3 control-label">Compose Trait Info With Time Term (optional) (key||||value comma separated. e.g. harvest info|CO_323:0000101||||day 10|TIME:0002020) (all uploaded variables must be represented here): </label>
97 <div class="col-sm-9">
98 <input class="form-control" id="upload_new_analysis_result_trait_compose_info_string" name="upload_new_analysis_result_trait_compose_info_string" type="text"/>
104 <button class="btn btn-primary" id="upload_new_analysis_analysis_continue">Go to Next Step</button>
107 <&| /util/workflow.mas:step, title=> "Model" &>
108 <& /page/page_title.mas, title=>"Define the model used to generate the analysis results" &>
110 <div class="form-group form-group-sm">
111 <label class="col-sm-3 control-label">Select a Model: </label>
112 <div class="col-sm-9">
113 <div id="upload_new_analysis_model_select_div"></div>
118 <button type="button" class="btn btn-default" id="upload_new_analysis_model_button" >Create a New Model if Needed</button>
122 <div id="upload_new_analysis_model_div" style="display:none">
124 <div class="form-group form-group-sm">
125 <label class="col-sm-3 control-label">Model Name (must be unique): </label>
126 <div class="col-sm-9">
127 <input class="form-control" id="upload_new_analysis_model_name" name="upload_new_analysis_model_name" type="text" />
130 <div class="form-group form-group-sm">
131 <label class="col-sm-3 control-label">Model Description: </label>
132 <div class="col-sm-9">
133 <input class="form-control" id="upload_new_analysis_model_description" name="upload_new_analysis_model_description" type="text" />
136 <div class="form-group form-group-sm">
137 <label class="col-sm-3 control-label">Model Is Public: </label>
138 <div class="col-sm-9">
139 <select class="form-control" id="upload_new_analysis_model_is_public" name="upload_new_analysis_model_is_public" >
140 <option value="yes">Yes</option>
141 <option value="no">No</option>
145 <div class="form-group form-group-sm">
146 <label class="col-sm-3 control-label">Model Language (e.g. R, Python, F90): </label>
147 <div class="col-sm-9">
148 <input class="form-control" id="upload_new_analysis_model_language" name="upload_new_analysis_model_language" type="text"/>
151 <div class="form-group form-group-sm">
152 <label class="col-sm-3 control-label">Model Properties (required) (key:value comma separated e.g. conversion_criteria:0.01,protocol_id:2): </label>
153 <div class="col-sm-9">
154 <input class="form-control" id="upload_new_analysis_model_properties_string" name="upload_new_analysis_model_properties_string" type="text"/>
157 <div class="form-group form-group-sm">
158 <label class="col-sm-3 control-label">Application Name (e.g. MyAmazingPipeline): </label>
159 <div class="col-sm-9">
160 <input class="form-control" id="upload_new_analysis_model_application_name" name="upload_new_analysis_model_application_name" type="text"/>
163 <div class="form-group form-group-sm">
164 <label class="col-sm-3 control-label">Application Version (e.g. v1.01): </label>
165 <div class="col-sm-9">
166 <input class="form-control" id="upload_new_analysis_model_application_version" name="upload_new_analysis_model_application_version" type="text"/>
172 <div class="well well-sm">
173 <h4>Data files from this analysis model</h4>
175 <table class="table table-bordered">
185 <div class="form-group form-group-sm">
186 <label class="col-sm-3 control-label">Main Phenotype Data File To Archive (required) (this should be the primary data file input into the model e.g. MyPhenotypes.csv): </label>
187 <div class="col-sm-9">
188 <input id="upload_new_analysis_model_training_data_file" name="upload_new_analysis_model_training_data_file" type="file" encoding="multipart/form-data"/>
193 <div class="form-group form-group-sm">
194 <label class="col-sm-3 control-label">Archive Main Phenotype Data File Type (required) (e.g. MyAmazingPipeline_MainPhenotypeFile): </label>
195 <div class="col-sm-9">
196 <input class="form-control" id="upload_new_analysis_model_training_data_file_type" name="upload_new_analysis_model_training_data_file_type" type="text"/>
203 <div class="form-group form-group-sm">
204 <label class="col-sm-3 control-label">Model File To Archive (optional) (this should be a model weights file): </label>
205 <div class="col-sm-9">
206 <input id="upload_new_analysis_model_file" name="upload_new_analysis_model_file" type="file" encoding="multipart/form-data"/>
211 <div class="form-group form-group-sm">
212 <label class="col-sm-3 control-label">Archive Model File Type (optional) (e.g. MyAmazingPipeline_ModelWeights.Rds or MyAmazingPipeline_CNNWeights.hdf5): </label>
213 <div class="col-sm-9">
214 <input class="form-control" id="upload_new_analysis_model_file_type" name="upload_new_analysis_model_file_type" type="text"/>
221 <div class="form-group form-group-sm">
222 <label class="col-sm-3 control-label">(1) Auxiliary File To Archive (optional) (e.g. log file, param file, grm input file): </label>
223 <div class="col-sm-9">
224 <input id="upload_new_analysis_model_auxiliary_file_1" name="upload_new_analysis_model_auxiliary_file_1" type="file" encoding="multipart/form-data"/>
229 <div class="form-group form-group-sm">
230 <label class="col-sm-3 control-label">(1) Auxiliary File Type (optional): </label>
231 <div class="col-sm-9">
232 <input class="form-control" id="upload_new_analysis_model_auxiliary_file_type_1" name="upload_new_analysis_model_auxiliary_file_type_1" type="text"/>
239 <div class="form-group form-group-sm">
240 <label class="col-sm-3 control-label">(2) Auxiliary File To Archive (optional) (e.g. log file, param file, grm input file): </label>
241 <div class="col-sm-9">
242 <input id="upload_new_analysis_model_auxiliary_file_2" name="upload_new_analysis_model_auxiliary_file_2" type="file" encoding="multipart/form-data"/>
247 <div class="form-group form-group-sm">
248 <label class="col-sm-3 control-label">(2) Auxiliary File Type (optional): </label>
249 <div class="col-sm-9">
250 <input class="form-control" id="upload_new_analysis_model_auxiliary_file_type_2" name="upload_new_analysis_model_auxiliary_file_type_2" type="text"/>
257 <div class="form-group form-group-sm">
258 <label class="col-sm-3 control-label">(3) Auxiliary File To Archive (optional) (e.g. log file, param file, grm input file): </label>
259 <div class="col-sm-9">
260 <input id="upload_new_analysis_model_auxiliary_file_3" name="upload_new_analysis_model_auxiliary_file_3" type="file" encoding="multipart/form-data"/>
265 <div class="form-group form-group-sm">
266 <label class="col-sm-3 control-label">(3) Auxiliary File Type (optional): </label>
267 <div class="col-sm-9">
268 <input class="form-control" id="upload_new_analysis_model_auxiliary_file_type_3" name="upload_new_analysis_model_auxiliary_file_type_3" type="text"/>
278 <button type="button" class="btn btn-primary" id="upload_new_analysis_submit" >Submit</button>
286 <div class="modal-footer">
287 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
295 jQuery(document).ready(function () {
297 jQuery('button[name="upload_new_analysis_button"]').click(function(){
298 get_select_box('years', 'upload_new_analysis_year_div', {'auto_generate': 1, 'id':'upload_new_analysis_year', 'name':'upload_new_analysis_year'});
299 get_select_box('breeding_programs', 'upload_new_analysis_breeding_program_div', { 'name' : 'upload_new_analysis_breeding_program_id', 'id' : 'upload_new_analysis_breeding_program_id' });
300 get_select_box('ontology_children', 'upload_new_analysis_stat_term_div', { 'selectbox_name' : 'upload_new_analysis_statistical_ontology_term', 'selectbox_id' : 'upload_new_analysis_statistical_ontology_term', 'parent_node_cvterm':'SGNSTAT:0000000', 'rel_cvterm': 'is_a', 'rel_cv': 'relationship', 'value_format':'names' });
301 get_select_box('models', 'upload_new_analysis_model_select_div', { 'id':'upload_new_analysis_model_id', 'name':'upload_new_analysis_model_id', 'empty':1 });
303 jQuery('#upload_new_analysis_dialog').modal('show');
306 jQuery('#upload_new_analysis_model_button').click(function(){
307 jQuery('#upload_new_analysis_model_div').show();
310 jQuery('#upload_new_analysis_analysis_continue').click(function(){
311 var upload_new_analysis_name = jQuery('#upload_new_analysis_name').val();
312 var upload_new_analysis_description = jQuery('#upload_new_analysis_description').val();
313 var upload_new_analysis_protocol = jQuery('#upload_new_analysis_protocol').val();
314 var upload_new_analysis_result_values_type = jQuery('#upload_new_analysis_result_values_type').val();
315 var upload_new_analysis_breeding_program_id = jQuery('#upload_new_analysis_breeding_program_id').val();
316 var upload_new_analysis_statistical_ontology_term = jQuery('#upload_new_analysis_statistical_ontology_term').val();
317 var upload_new_analysis_file = jQuery('#upload_new_analysis_file').val();
319 if (upload_new_analysis_name == '' || upload_new_analysis_description == '') {
320 alert('Please give an analysis name and description');
323 else if (upload_new_analysis_protocol == '') {
324 alert('Please give an analysis protocol');
327 else if (upload_new_analysis_result_values_type == '') {
328 alert('Please select result values type');
331 else if (upload_new_analysis_breeding_program_id == '') {
332 alert('Please select a breeding program');
335 else if (upload_new_analysis_statistical_ontology_term == '') {
336 alert('Please select a statistical ontology term');
339 else if (upload_new_analysis_file === '') {
340 alert('Please select a results file');
344 Workflow.complete('#upload_new_analysis_analysis_continue');
345 Workflow.focus('#upload_new_analysis_workflow', 2);
350 jQuery('#upload_new_analysis_submit').click( function() {
351 var uploadFile = jQuery("#upload_new_analysis_file").val();
352 jQuery('#upload_new_analysis_dialog_form').attr("action", "/ajax/analysis/store/spreadsheet");
353 if (uploadFile === '') {
354 alert("Please select a file");
358 var upload_new_analysis_model_id = jQuery('#upload_new_analysis_model_id').val();
359 var upload_new_analysis_model_name = jQuery('#upload_new_analysis_model_name').val();
360 var upload_new_analysis_model_description = jQuery('#upload_new_analysis_model_description').val();
361 var upload_new_analysis_model_is_public = jQuery('#upload_new_analysis_model_is_public').val();
362 var upload_new_analysis_model_language = jQuery('#upload_new_analysis_model_language').val();
363 var upload_new_analysis_model_properties_string = jQuery('#upload_new_analysis_model_properties_string').val();
364 var upload_new_analysis_model_application_name = jQuery('#upload_new_analysis_model_application_name').val();
365 var upload_new_analysis_model_application_version = jQuery('#upload_new_analysis_model_application_version').val();
366 var upload_new_analysis_model_training_data_file = jQuery('#upload_new_analysis_model_training_data_file').val();
367 var upload_new_analysis_model_training_data_file_type = jQuery('#upload_new_analysis_model_training_data_file_type').val();
368 var upload_new_analysis_model_file = jQuery('#upload_new_analysis_model_file').val();
369 var upload_new_analysis_model_file_type = jQuery('#upload_new_analysis_model_file_type').val();
370 var upload_new_analysis_model_auxiliary_file_1 = jQuery('#upload_new_analysis_model_auxiliary_file_1').val();
371 var upload_new_analysis_model_auxiliary_file_type_1 = jQuery('#upload_new_analysis_model_auxiliary_file_type_1').val();
372 var upload_new_analysis_model_auxiliary_file_2 = jQuery('#upload_new_analysis_model_auxiliary_file_2').val();
373 var upload_new_analysis_model_auxiliary_file_type_2 = jQuery('#upload_new_analysis_model_auxiliary_file_type_2').val();
374 var upload_new_analysis_model_auxiliary_file_3 = jQuery('#upload_new_analysis_model_auxiliary_file_3').val();
375 var upload_new_analysis_model_auxiliary_file_type_3 = jQuery('#upload_new_analysis_model_auxiliary_file_type_3').val();
377 if (upload_new_analysis_model_id != '' && upload_new_analysis_model_name != '') {
378 alert('Please select a model or create a new model, not both!');
381 if (upload_new_analysis_model_id == '' && upload_new_analysis_model_name == '') {
382 alert('Please select a saved model or give a new model name');
385 if (upload_new_analysis_model_id == '' && upload_new_analysis_model_description == '') {
386 alert('Please give a new model description');
389 if (upload_new_analysis_model_id == '' && upload_new_analysis_model_is_public == '') {
390 alert('Please give a new model is public');
393 if (upload_new_analysis_model_id == '' && upload_new_analysis_model_language == '') {
394 alert('Please give a new model language');
397 if (upload_new_analysis_model_id == '' && upload_new_analysis_model_properties_string == '') {
398 alert('Please give a new model properties. At least one key:value!');
401 if (upload_new_analysis_model_id == '' && upload_new_analysis_model_application_name == '') {
402 alert('Please give a new model application name');
405 if (upload_new_analysis_model_id == '' && upload_new_analysis_model_application_version == '') {
406 alert('Please give a new model application version');
409 if (upload_new_analysis_model_training_data_file === '') {
410 alert('Please give a new model training data file (or the main phenotype file you used to do the analysis)');
413 if (upload_new_analysis_model_training_data_file_type == '') {
414 alert('Please give a new model training data file type (or the main phenotype file you used to do the analysis)');
417 if ( (upload_new_analysis_model_file == '' && upload_new_analysis_model_file_type != '') || (upload_new_analysis_model_file != '' && upload_new_analysis_model_file_type == '') ) {
418 alert('If you give a new model file, please give a new model file type also');
421 if ( (upload_new_analysis_model_auxiliary_file_1 == '' && upload_new_analysis_model_auxiliary_file_type_1 != '') || (upload_new_analysis_model_auxiliary_file_1 != '' && upload_new_analysis_model_auxiliary_file_type_1 == '') ) {
422 alert('If you give a new model aux file 1, please give a new model aux file 1 type also');
425 if ( (upload_new_analysis_model_auxiliary_file_2 == '' && upload_new_analysis_model_auxiliary_file_type_2 != '') || (upload_new_analysis_model_auxiliary_file_2 != '' && upload_new_analysis_model_auxiliary_file_type_2 == '') ) {
426 alert('If you give a new model aux file 2, please give a new model aux file 2 type also');
429 if ( (upload_new_analysis_model_auxiliary_file_3 == '' && upload_new_analysis_model_auxiliary_file_type_3 != '') || (upload_new_analysis_model_auxiliary_file_3 != '' && upload_new_analysis_model_auxiliary_file_type_3 == '') ) {
430 alert('If you give a new model aux file 3, please give a new model aux file 3 type also');
434 jQuery("#upload_new_analysis_dialog_form").submit();
437 jQuery('#upload_new_analysis_dialog_form').iframePostForm({
440 jQuery('#working_modal').modal("show");
442 complete: function (response) {
443 jQuery('#working_modal').modal("hide");
444 console.log(response);
445 if (response.error) {
446 alert(response.error);
448 else if (response.error_messages) {
449 alert(response.error_messages);
452 alert('Successfully saved! Page will now refresh!')
456 error: function(response) {
457 jQuery('#working_modal').modal("hide");
458 alert("An error occurred uploading analysis");