6 <& /util/import_javascript.mas, entries => ["wizard"] &>
7 <& /util/import_css.mas, paths => ['wizard.css'] &>
9 <& /page/page_title.mas, title=>"Search Wizard" &>
12 <div class="col-md-12" style="margin-bottom:1em; text-align:right;">
13 Don't see your data? <button id="update_wizard_lists" class="btn btn-default">Refresh Lists</button>
14 <button id="update_wizard_show" class="btn btn-default">Update Wizard</button>
18 <div id="wizard" class="row">
19 <span class="wizard-main">
20 <span class="wizard-columns"></span>
21 <div class="templates" style="display: none !important;">
23 <div class="wizard-unselected">
24 <div class="btn-group wizard-list-item">
25 <button type="button" class="btn btn-xs btn-success wizard-list-add">+</button>
26 <a target="_blank" class="btn btn-xs btn-default wizard-list-name"></a>
30 <div class="wizard-selected">
31 <div class="btn-group wizard-list-item">
32 <button type="button" class="btn btn-xs btn-danger wizard-list-rem">✕</button>
33 <a target="_blank" class="btn btn-xs btn-default wizard-list-name"></a>
37 <div class="wizard-column">
38 <div class="wizard-panel panel panel-default">
40 <span class="wizard-loader glyphicon glyphicon-refresh" aria-hidden="true"></span>
42 <div class="panel-heading">
43 <select class="wizard-type-select form-control input-sm form-inline">
44 <option value="" disabled selected>Select Column Type</option>
45 <optgroup class="wizard-types-group" label="--------------------"></optgroup>
46 <optgroup class="wizard-lists-group" label="Load Selection from List:"></optgroup>
50 <div class="panel-heading">
51 <input type="text" class="wizard-search form-control input-sm" placeholder="Search">
54 <div class="panel-body">
56 <div class="wizard-btn-center">
57 <div class="btn-group">
58 <button class="wizard-select-all btn btn-default btn-xs">Select All</button
59 ><button class="wizard-btn-tag btn btn-primary btn-xs">
60 <span class="wizard-count-selected">0</span>/<span class="wizard-count-all">0</span>
62 ><button class="wizard-select-clear btn btn-default btn-xs">Clear</button>
66 <ul class="wizard-list-unselected wizard-list well"></ul>
67 <ul class="wizard-list-selected wizard-list well"></ul>
69 <div class="wizard-btn-center wizard-union-toggle">
70 <div class="btn-group">
71 <button class="wizard-btn-tag btn btn-xs btn-default disabled">Match</button
72 ><button class="btn btn-xs btn-primary active">ANY</button
73 ><button class="btn btn-default btn-xs">ALL</button>
79 <table class="wizard-save-to-list table panel-footer">
80 <&| /util/user.mas:logged_in &>
83 <select class="wizard-add-to-list-id form-control input-sm">
84 <option selected value="" disabled>Add to List...</option>
85 <optgroup class="wizard-lists-group" label="--------------------"></optgroup>
89 <button class="wizard-add-to-list btn btn-sm btn-primary btn-block">Add</button>
94 <input class="wizard-create-list-name form-control input-sm" type="text" placeholder="Create New List..."></input>
97 <button class="wizard-create-list btn btn-primary btn-sm btn-block">Create</button>
101 <&| /util/user.mas:logged_out &>
103 <td><button class="btn btn-xs btn-primary" name="site_login_button">Log In</button> to save lists.</td>
114 <div class="clearfix col-xs-12"></div>
116 <div class="wizard-datasets panel-group col-sm-12 col-md-6">
117 <div class="panel panel-default wizard-panel">
118 <div class="panel-heading">
119 <&| /util/user.mas:logged_out &><button class="btn btn-xs btn-primary" name="site_login_button">Log In</button> to</&>
120 Load/Create Datasets using <button class="btn btn-xs btn-default disabled wizard-btn-tag">Match</button> Columns
122 <&| /util/user.mas:logged_in &>
123 <div class="panel-body">
124 <div class="input-group">
125 <select class="form-control input-sm wizard-dataset-select">
126 <option selected value="" disabled>Load Dataset</option>
127 <optgroup class="wizard-dataset-group" label="--------------------"></optgroup>
129 <span class="input-group-btn">
130 <span><button style="width:5em;margin-left:4px;" class="btn btn-sm btn-primary wizard-dataset-load">Load</button></span>
134 <div class="panel-body" style="margin-top:-1px;">
135 <div class="input-group">
136 <input type="text" placeholder="Create New Dataset" class="form-control input-sm wizard-dataset-name" />
137 <span class="input-group-btn">
138 <span><button style="width:5em;margin-left:4px;" class="btn btn-sm btn-primary wizard-dataset-create">Create</button></span>
146 <div class="wizard-downloads panel-group col-sm-12 col-md-6" id="wiz-down-group" role="tablist" aria-multiselectable="true">
147 <&| /util/user.mas:logged_out &>
148 <div class="panel panel-default">
149 <div class="panel-heading">
150 <button class="btn btn-xs btn-primary" name="site_login_button">Log In</button> to download related data.
154 <&| /util/user.mas:logged_in &>
155 <div class="panel panel-default">
156 <div class="panel-heading" role="button" data-toggle="collapse" data-parent="#wiz-down-group" href="#wiz-down-1-c" aria-controls="wiz-down-1-c">
157 <span class="btnn btn-link">Related Genotype Data</span>
159 <div id="wiz-down-1-c" class="panel-collapse collapse" role="tabpanel">
160 <table class="table">
163 <p>To download related genotype data, select <strong>1 or more Accessions</strong> and <strong>no more than 1 Genotyping Protocol</strong>
164 in the wizard. Optionally, select a Chromosome and enter a position range below. If no genotyping protocol is selected, the
165 database default protocol will be used.</p>
166 <input class="wizard-download-genotypes-info form-control input-sm" type="text" disabled></input>
171 <span>Chromosome</span>
172 <select class="wizard-download-genotypes-chromosome-number form-control"></select>
175 <span>Start Position</span>
176 <input placeholder="" type="number" class="wizard-download-genotypes-start-position form-control">
179 <span>End Position</span>
180 <input placeholder="" type="number" class="wizard-download-genotypes-end-position form-control">
185 <select class="wizard-download-genotypes-format form-control" >
186 <option value="DosageMatrix">Dosage Matrix</option>
187 <option value="VCF">VCF</option>
192 <div class="panel-footer" style="border-top: 1px solid #ddd;">
193 <button class="wizard-download-genotypes btn btn-sm btn-primary">
194 <span class="glyphicon glyphicon-download" aria-hidden="true"></span>
198 <div class="panel-footer" style="border-top: 1px solid #ddd;">
199 <button class="wizard-download-genetic-relationship-matrix btn btn-sm btn-primary">
200 <span class="glyphicon glyphicon-download" aria-hidden="true"></span>
201 Download Genetic Relationship Matrix (GRM)
207 <div class="panel panel-default">
208 <div class="panel-heading" role="button" data-toggle="collapse" data-parent="#wiz-down-group" href="#wiz-down-2-c" aria-controls="wiz-down-2-c">
209 <span class="btnn btn-link">Related Trial Metadata</span>
211 <div id="wiz-down-2-c" class="panel-collapse collapse" role="tabpanel">
212 <table class="table">
215 <input class="wizard-download-tmetadata-info form-control input-sm" type="text" disabled value="No Trials Selected"></input>
218 <select class="wizard-download-tmetadata-format form-control input-sm">
219 <option value="" disabled>Format</option>
220 <option selected value="csv">CSV</option>
221 <option value="xls">XLS</option>
226 <div class="panel-footer" style="border-top: 1px solid #ddd;">
227 <button class="wizard-download-tmetadata btn btn-sm btn-primary">
228 <span class="glyphicon glyphicon-download" aria-hidden="true"></span>
235 <div class="panel panel-default">
236 <div class="panel-heading" role="button" data-toggle="collapse" data-parent="#wiz-down-group" href="#wiz-down-3-c" aria-controls="wiz-down-3-c">
237 <span class="btnn btn-link">Related Trial Phenotypes</span>
239 <div id="wiz-down-3-c" class="panel-collapse collapse" role="tabpanel">
240 <table class="table">
243 <input class="wizard-download-phenotypes-info form-control input-sm" type="text" disabled></input>
248 <select class="wizard-download-phenotypes-format form-control input-sm">
249 <option value="" disabled>Format</option>
250 <option selected value="csv">CSV</option>
251 <option value="xls">XLS</option>
255 <select class="wizard-download-phenotypes-level form-control input-sm">
256 <option value="" disabled>Data Level</option>
257 <option value="all">All</option>
258 <option selected value="plot">Plots</option>
259 <option value="plant">Plants</option>
265 <div class="checkbox">
267 <input class="wizard-download-phenotypes-timestamp" type="checkbox">
273 <div class="checkbox">
275 <input class="wizard-download-phenotypes-outliers" type="checkbox">
276 Supress user defined phenotype outliers
283 <span>Trait Name Contains</span>
284 <input placeholder="" type="text" class="wizard-download-phenotypes-name form-control">
287 <span>Min Value</span>
288 <input placeholder="-∞" type="text" class="wizard-download-phenotypes-min form-control">
291 <span>Max Value</span>
292 <input placeholder="∞" type="text" class="wizard-download-phenotypes-max form-control">
296 <div class="panel-footer" style="border-top: 1px solid #ddd;">
297 <button class="wizard-download-phenotypes btn btn-sm btn-primary">
298 <span class="glyphicon glyphicon-download" aria-hidden="true"></span>
309 <script type="text/javascript">
310 window.sWizard = jsMod['wizard'].WizardSetup("#wizard");
313 <div class="modal fade" id="update_wizard_dialog" name="update_wizard_dialog" tabindex="-1" role="dialog" aria-labelledby="updateWizardDialog">
314 <div class="modal-dialog" role="document">
315 <div class="modal-content">
316 <div class="modal-header">
317 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
318 <h3 class="modal-title" id="updateWizardDialog">Update Search Wizard</h3>
320 <div class="modal-body">
321 <div class="container-fluid">
322 <h4>How the wizard works</h4>
323 <p>For the search wizard to be fast and flexible, it avoids querying the database directly. Instead, it stores a copy of the data from the database in a temporary format that is optimized for the types of queries the wizard makes.</p><p>For this to be practical, the copy must be updated regularly. Updates usually start every time new data is uploaded, however users with submitter status or higher can also initiate them manually.</p><p>If an update isn't already in progress, you can initiate one below. It will run independently on the server without any additional input required from the user. Depending on the size of the database, it will take from a few minutes to a few hours to complete.</p>
324 <div><h4>Current status:</h4><p id="wizard_status"></p></div>
327 <div class="modal-footer">
328 <div class="well well-sm" id="update_wizard_error" style="display:none;"></div>
329 <button type="button" class="btn btn-primary wiz-update" name="update_wizard" data-loading-text="Working..." id="update_wizard">Update search wizard</button>
330 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
336 <script type="text/javascript">
337 d3.select('#update_wizard_show').on('click', function () {
338 $('#update_wizard_dialog').modal("show");
339 jsMod['wizard'].updateStatus("#wizard_status")
340 .then(function(isLoading){
342 d3.select("#update_wizard")
343 .attr("title","A search wizard update is already in progress...")
344 .attr("disabled",true);
347 d3.select("#update_wizard")
348 .attr("title","Refresh the search wizard to include newly uploaded data")
349 .attr("disabled",null)
354 d3.select("#update_wizard").on('click',function(){
355 jsMod['wizard'].refreshMatviews("fullview",this);
358 d3.select("#update_wizard_lists").on('click',function(){
359 window.sWizard.reload_lists();
363 // Wizard Callback: get chromosome names for a single selected genotyping protocol
364 var SELECTED_GENOTYPING_PROTOCOL = undefined;
365 window.sWizard.wizard.on_change(function(categories, selections, operations) {
366 var selected_genotyping_protocols = selections.hasOwnProperty('genotyping_protocols') ? selections.genotyping_protocols : [];
367 if ( selected_genotyping_protocols.length <= 1 ) {
368 var selected_genotyping_protocol = selected_genotyping_protocols.length === 1 ? selected_genotyping_protocols[0].id : "";
369 if ( selected_genotyping_protocol !== SELECTED_GENOTYPING_PROTOCOL ) {
370 SELECTED_GENOTYPING_PROTOCOL = selected_genotyping_protocol;
372 url: '/ajax/breeder/search/genotyping_protocol_chromosomes',
374 data: { 'genotyping_protocol': SELECTED_GENOTYPING_PROTOCOL },
375 error: function(response) {
376 console.log("ERROR: Could not get chromosome names for genotyping protocol #" + SELECTED_GENOTYPING_PROTOCOL);
377 console.log(response);
378 updateChromosomeNames();
380 success: function(response) {
381 if (response.error) {
382 console.log("ERROR: Server returned an error trying to get the chromosome names for genotyping protocol #" + SELECTED_GENOTYPING_PROTOCOL);
383 console.log(repsonse.error);
384 updateChromosomeNames();
387 updateChromosomeNames(response.chromosome_names);
394 SELECTED_GENOTYPING_PROTOCOL = "";
395 updateChromosomeNames();
398 updateChromosomeNames();
400 // Set the chromosome names for the select dropdown menu
401 function updateChromosomeNames(names) {
404 html += "<option value=''>All</option>";
405 for ( var i = 0; i < names.length; i++ ) {
406 html += "<option value='" + names[i] + "'>" + names[i] + "</option>";
409 $(".wizard-download-genotypes-chromosome-number").html(html);