2 $seedlot_maintenance_enabled => 0
5 <& /util/import_javascript.mas, classes => [ 'jqueryui', 'jquery.cookie', 'CXGN.BreederSearch', 'CXGN.List', 'CXGN.BreedersToolbox.HTMLSelect', 'spin_min', 'ladda_min' ] &>
7 <& /page/page_title.mas, title=>"Download Using Lists" &>
9 <div class="container-fluid">
12 Choose a list for each parameter and click "Download".
15 <div class="well well-sm">
16 <h4>Download Phenotypes Using Lists</h4><p>Select Parameters:</p>
17 <form id="download_form" action="/breeders/download_action" method="POST" >
18 <table class="table table-bordered" >
41 <div id="accession_list">
54 <select class="form-control" id="format" name="format">
55 <option value=".csv">CSV</option>
56 <option value=".xlsx">XLSX</option>
57 <option value="html">HTML</option>
60 <b>Data Level:</b><br/>
61 <select class="form-control" id="phenotype_datalevel" name="phenotype_datalevel">
62 <option value="all">All</option>
63 <option value="plot">Plot</option>
64 <option value="plant">Plant</option>
67 <b>Timestamp:</b><br/>
68 <select class="form-control" id="timestamp" name="timestamp">
69 <option value="0">No</option>
70 <option value="1">Yes</option>
73 <b>Exclude Phenotype Outliers:</b><br/>
74 <select class="form-control" id="exclude_phenotype_outlier" name="exclude_phenotype_outlier">
75 <option value="0">No</option>
76 <option value="1">Yes</option>
80 <button class="btn btn-primary" type="button" id="phenotype">Download</button>
81 <input type="hidden" id="phenotype_download_token" name="phenotype_download_token"/>
89 <div class="well well-sm">
90 <h4>Inspect Datasets</h4>
91 <table class="table table-bordered" >
102 <div id="phenotype_download_dataset_list">
110 <div class="well well-sm">
111 <h4>Download Metadata</h4><p>Select Parameters:</p>
112 <form id="download_metadata_form" action="/breeders/download_action" method="POST" >
113 <table class="table table-bordered" >
130 <div id="trial_metadata_list">
135 <select class="form-control" id="metadata_format" name="metadata_format">
136 <option value=".xlsx">XLSX</option>
137 <option value=".csv">CSV</option>
138 <option value="html">HTML</option>
141 <div id="datalevel" style="display:none">
142 <select class="form-control" id="metadata_datalevel" name="metadata_datalevel">
143 <option value="metadata">Metadata</option>
148 <button class="btn btn-primary" type="button" id="metadata">Download</button>
149 <input type="hidden" id="metadata_download_token" name="metadata_download_token"/>
158 $(document).ready(function() {
160 var lo = new CXGN.List();
162 $('#accession_list').html(lo.listSelect('accession_list', [ 'accessions' ], 'select', undefined, undefined));
163 $('#trial_list').html(lo.listSelect('trial_list', [ 'trials' ], 'select', undefined, undefined ));
164 $('#trait_list').html(lo.listSelect('trait_list', [ 'traits' ], 'select', undefined, undefined ));
165 $('#trial_metadata_list').html(lo.listSelect('trial_metadata_list', ['trials'], 'select', undefined, undefined));
167 get_select_box('datasets', 'phenotype_download_dataset_list');
169 $('#metadata').click(function() {
170 var trial_list_id = $('#trial_metadata_list_list_select').val();
171 var trial_validation = 1;
172 if (trial_list_id) { trial_validation = lo.validate(trial_list_id, 'trials', true).then(
174 if (r.missing.length != 0) {
175 alert("The following lists did not pass validation: "+r.missing.join(", ")+". Please correct the list(s) and try again");
180 // var ladda = Ladda.create(this);
182 // var token = new Date().getTime(); //use the current timestamp as the token name and value
183 // manage_dl_with_cookie(token, ladda);
184 // jQuery('#metadata_download_token').val(token);
185 jQuery('#download_metadata_form').submit();
190 $('#phenotype').click(function() {
192 var accession_list_id = $('#accession_list_list_select').val();
193 var trial_list_id = $('#trial_list_list_select').val();
194 var trait_list_id = $('#trait_list_list_select').val();
196 var lists = new Array();
197 var types = new Array();
199 if (accession_list_id) {
200 lists.push(accession_list_id);
201 types.push('accessions');
202 //alert("ACC LIST ID = "+accession_list_id);
205 lists.push(trial_list_id);
206 types.push('trials');
210 lists.push(trait_list_id);
211 types.push('traits');
214 jQuery('#working_modal').modal('show');
216 validateLists(lists, types).then(function(r) {
217 console.log('validation results: '+JSON.stringify(r));
219 for (var n=0; n < r.invalid_lists.length; n++) {
220 names_str += r.invalid_lists[n][1];
222 if(names_str.length > 0) {
223 alert('Some lists ('+names_str+') are not valid, please check.');
224 jQuery('#working_modal').modal('hide');
227 download_phenotypes(this);
228 jQuery('#working_modal').modal('hide');
232 function(e) { alert(e); jQuery('#working_modal').modal('hide');
241 //alert("The following lists did not pass validation: "+problem_lists.join(", ")+". Please correct the list(s) and try again");
249 function download_phenotypes() {
250 //alert("NOW DOWNLOADING!");
251 //var ladda = Ladda.create(data);
253 var token = new Date().getTime(); //use the current timestamp as the token name and value
254 // manage_dl_with_cookie(token, ladda);
255 jQuery('#phenotype_download_token').val(token);
256 jQuery('#download_form').submit();
265 <!-- DOWNLOAD ACCESSION PROPERTIES -->
267 <div class="well well-sm">
268 <form id="download_accession_properties" action="/breeders/download_accession_properties_action" method="POST">
269 <table class="table" cellpadding="10">
271 <tr><td colspan="2"><h4>Download Accession Properties</h4><p>Select parameters:</p></tr>
281 <div id="accession_list5"></div>
284 <select class="form-control" id="accession_properties_format" name="file_format">
285 <option value=".xlsx">XLSX</option>
286 <option value=".csv">CSV</option>
290 <button class="btn btn-primary" type="button" id="accession_properties_download">Download</button>
291 <input type="hidden" id="accession_properties_download_token" name="accession_properties_download_token"/>
301 $(document).ready(function() {
303 var lo = new CXGN.List();
305 $('#accession_list5').html(lo.listSelect('accession_properties_accession_list', [ 'accessions' ], 'select', undefined, undefined));
307 $('#accession_properties_download').click(function() {
309 var accession_list_id = $('#accession_properties_accession_list_list_select').val();
310 if (!accession_list_id) {
311 alert("You need to select an accession list!");
316 if (accession_list_id) {
317 jQuery('#working_modal').modal('show');
318 lo.validate(accession_list_id, 'accessions', true).then(
321 alert("The accession list did not pass validation. Please correct the list and try again");
322 jQuery('#working_modal').modal('hide');
325 //var ladda = Ladda.create(this);
327 //var token = new Date().getTime(); //use the current timestamp as the token name and value
328 //manage_dl_with_cookie(token, ladda);
329 //jQuery('#accession_properties_download_token').val(token);
330 jQuery('#download_accession_properties').submit();
331 jQuery('#working_modal').modal('hide');
340 <!-- END OF DOWNLOAD ACCESSION PROPERTIES -->
346 <!-- start of code for pedigree download -->
348 <div class="well well-sm">
349 <form id="download_pedigree" action="/breeders/download_pedigree_action" method="POST">
350 <table class="table" cellpadding="10">
352 <tr><td colspan="2"><h4>Download Pedigrees </h4><p>Select parameter:</p></tr>
371 <div id="accession_list4">
375 <div style="width: 175px">
376 <p><strong>Depth:</strong></p>
378 <label><input type="radio" id="ped_format_parents" name="ped_format" value="parents_only" checked>Only One Generation</label>
381 <label><input type="radio" id="ped_format_full" name="ped_format" value="full">All Generations</label>
383 <p><strong>Include:</strong></p>
385 <label><input type="radio" id="include_ancestors" name="ped_include" value="ancestors" checked>Only Ancestors</label>
388 <label><input type="radio" id="include_ancestors_descendants" name="ped_include" value="ancestors_descendants">Ancestors and Descendants</label>
393 <select class="form-control" id="pedigree_file_format" name="file_format">
394 <option value=".txt">Plain Text</option>
395 <option value=".helium">Helium Format</option>
399 <button class="btn btn-primary" type="button" id="pedigree">Download</button>
400 <input type="hidden" id="pedigree_download_token" name="pedigree_download_token"/>
410 $(document).ready(function() {
412 var lo = new CXGN.List();
414 $('#accession_list4').html(lo.listSelect('pedigree_accession_list', [ 'accessions' ], 'select', undefined, undefined));
416 $('#pedigree').click(function() {
418 var accession_list_id = $('#pedigree_accession_list_list_select').val();
419 if (!accession_list_id) {
420 alert("You need to select an accession list!");
424 if (accession_list_id) {
425 accession_validation = lo.validate(accession_list_id, 'accessions', true).then(
428 alert("The accession list did not pass validation. Please correct the list and try again");
431 //var ladda = Ladda.create(this);
433 //var token = new Date().getTime(); //use the current timestamp as the token name and value
434 //manage_dl_with_cookie(token, ladda);
435 //jQuery('#pedigree_download_token').val(token);
436 jQuery('#working_modal').modal('show');
437 var http = new XMLHttpRequest();
438 http.open('POST', '/breeders/download_pedigree_action', true);
439 http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
440 http.onreadystatechange = () => {
441 if( http.readyState == 4 ) {
442 jQuery('#working_modal').modal('hide');
443 if ( http.status == 200) {
444 var blob = new Blob([http.response], { type : 'plain/text' });
445 var fileName = http.getResponseHeader("FileName");
446 var link = document.createElement('a');
447 link.href = window.URL.createObjectURL(blob);
448 link.download = fileName;
453 http.send(jQuery("#download_pedigree").serialize());
461 <!-- end of code for pedigree download -->
465 <!-- start of code for download seedlot matinenance events -->
467 % if ( $seedlot_maintenance_enabled ) {
469 <div class="well well-sm">
470 <form id="download_seedlot_maintenance_events" action="/breeders/download_seedlot_maintenance_events_action" method="POST">
471 <table class="table" cellpadding="10">
473 <tr><td colspan="2"><h4>Download Seedlot Maintenance Events</h4><p>Select parameters:</p></tr>
483 <div id="seedlot_list1"></div>
486 <select class="form-control" id="seedlot_maintenance_events_format" name="file_format">
487 <option value=".xlsx">XLSX</option>
491 <button class="btn btn-primary" type="button" id="seedlot_maintenance_events_download">Download</button>
492 <input type="hidden" id="seedlot_maintenance_events_download_token" name="seedlot_maintenance_events_download_token"/>
501 $(document).ready(function() {
503 var lo = new CXGN.List();
505 $('#seedlot_list1').html(lo.listSelect('seedlot_maintenance_events_list', [ 'seedlots' ], 'select', undefined, undefined));
507 $('#seedlot_maintenance_events_download').click(function() {
509 var seedlot_list_id = $('#seedlot_maintenance_events_list_list_select').val();
510 if (!seedlot_list_id) {
511 alert("You need to select a seedlot list!");
515 var seedlot_validation = 1;
516 if (seedlot_list_id) {
517 seedlot_validation = lo.validate(seedlot_list_id, 'seedlots', true);
520 if (seedlot_validation != 1) {
521 alert("The seedlot list did not pass validation. Please correct the list and try again");
525 var ladda = Ladda.create(this);
527 var token = new Date().getTime(); //use the current timestamp as the token name and value
528 manage_dl_with_cookie(token, ladda);
529 jQuery('#seedlot_maintenance_events_download_token').val(token);
530 jQuery('#download_seedlot_maintenance_events').submit();
539 <!-- end of code for seedlot maintenance event download -->
542 <div class="well well-sm">
543 <form id="download_gbs" action="/breeders/download_gbs_action" method="POST">
544 <table class="table" cellpadding="10">
546 <tr><td colspan="2"><h4>Download Genotypes </h4><p>Select parameter:</p></tr>
562 <div id="accession_list2">
566 <div id="protocol_list">
570 <button class="btn btn-primary" type="button" id="genotype">Download</button>
571 <input type="hidden" id="gbs_download_token" name="gbs_download_token"/>
580 $(document).ready(function() {
582 var lo = new CXGN.List();
584 $('#accession_list2').html(lo.listSelect('genotype_accession_list', [ 'accessions' ], 'select', undefined, undefined));
585 get_select_box("genotyping_protocol", "protocol_list");
587 $('#genotype').click(function() {
589 var accession_list_id = $('#genotype_accession_list_list_select').val();
590 var protocol_list_id = $('#protocol_list').val();
592 var accession_validation = 1;
593 if (accession_list_id) {
594 accession_validation = lo.validate(accession_list_id, 'accessions', true).then(
596 if (!( accession_list_id || protocol_list_id) ) {
597 alert("You need to select a list of accessions and a protocol !");
599 else if(r.valid != 1) {
600 alert("The accession list could not be validated. Please correct the list(s) and try again");
605 //var ladda = Ladda.create(this);
607 //var token = new Date().getTime(); //use the current timestamp as the token name and value
608 //manage_dl_with_cookie(token, ladda);
609 //jQuery('#gbs_download_token').val(token);
610 jQuery('#download_gbs').submit();
612 }, function(e) { alert('An error occurred.'); });
619 <div class="well well-sm">
620 <form id="gbs_qc" action="/breeders/gbs_qc_action" method="POST">
621 <table class="table" cellpadding="10">
623 <tr><td colspan="3"><h4>Genotyping QC</h4><p>Select parameter:</p></tr>
642 <div id="trial_list3">
646 <div id="accession_list3">
650 <div id="protocol_list2">
654 <button class="btn btn-primary" type="button" id="genotype_qc">Download</button>
655 <input type="hidden" id="qc_download_token" name="qc_download_token"/>
666 $(document).ready(function() {
668 var lo = new CXGN.List();
670 $('#accession_list3').html(lo.listSelect('genotype_qc_accession_list', [ 'accessions' ], 'select', undefined, undefined));
671 $('#trial_list3').html(lo.listSelect('genotype_trial_list', [ 'trials' ], 'select', undefined, undefined ));
672 get_select_box("genotyping_protocol", "protocol_list2", {'id':'protocol_list2_select', 'name':'protocol_list2_select'});
674 $('#genotype_qc').click(function() {
676 $('#working').dialog( {
684 open: function() { $(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close').hide(); },
685 title: 'Downloading genotype...'
688 var lists = new Array();
690 var accession_list_id = $('#genotype_qc_accession_list_list_select').val();
691 var trial_list_id = $('#genotype_trial_list_list_select').val();
694 if (! (accession_list_id || trial_list_id) ) {
695 alert("You need to select an accession or a trial, or both!");
699 var lists = new Array();
700 var types = new Array();
702 if (accession_list_id) {
703 lists.push(accession_list_id);
704 types.push('accessions');
708 lists.push(trial_list_id);
709 types.push('trials');
713 validateLists(lists, types).then(function(r) {
714 console.log('validation results: '+JSON.stringify(r));
716 for (var n=0; n < r.invalid_lists.length; n++) {
717 names_str += r.invalid_lists[n][1];
719 if(names_str.length > 0) {
720 alert('Some lists ('+names_str+') are not valid, please check.');
721 jQuery('#working_modal').modal('hide');
724 // var ladda = Ladda.create(this);
726 // var token = new Date().getTime(); //use the current timestamp as the token name and value
727 // manage_dl_with_cookie(token, ladda);
728 // jQuery('#qc_download_token').val(token);
729 jQuery('#gbs_qc').submit();
731 jQuery('#working_modal').modal('hide');