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 <& /breeders_toolbox/breeder_search_page_dataset_overlay.mas &>
20 <div id="wizard" class="row">
21 <span class="wizard-main">
22 <span class="wizard-columns"></span>
23 <div class="templates" style="display: none !important;">
25 <div class="wizard-unselected">
26 <div class="btn-group wizard-list-item">
27 <button type="button" class="btn btn-xs btn-success wizard-list-add">+</button>
28 <a target="_blank" class="btn btn-xs btn-default wizard-list-name"></a>
32 <div class="wizard-selected">
33 <div class="btn-group wizard-list-item">
34 <button type="button" class="btn btn-xs btn-danger wizard-list-rem">✕</button>
35 <a target="_blank" class="btn btn-xs btn-default wizard-list-name"></a>
39 <div class="wizard-column">
40 <div class="wizard-panel panel panel-default">
42 <span class="wizard-loader glyphicon glyphicon-refresh" aria-hidden="true"></span>
44 <div class="panel-heading">
45 <select class="wizard-type-select form-control input-sm form-inline">
46 <option value="" disabled selected>Select Column Type</option>
47 <optgroup class="wizard-types-group" label="--------------------"></optgroup>
48 <optgroup class="wizard-lists-group" label="Load Selection from List:"></optgroup>
52 <div class="panel-heading">
53 <input type="text" class="wizard-search form-control input-sm" placeholder="Search">
56 <div class="panel-body">
58 <div class="wizard-btn-center">
59 <div class="btn-group">
60 <button class="wizard-select-all btn btn-default btn-xs">Select All</button
61 ><button class="wizard-btn-tag btn btn-primary btn-xs">
62 <span class="wizard-count-selected">0</span>/<span class="wizard-count-all">0</span>
64 ><button class="wizard-select-clear btn btn-default btn-xs">Clear</button>
68 <ul class="wizard-list-unselected wizard-list well"></ul>
69 <ul class="wizard-list-selected wizard-list well"></ul>
71 <div class="wizard-btn-center wizard-union-toggle">
72 <div class="btn-group wizard-union-toggle-btn-group">
73 <button type="button" class="btn btn-xs btn-default disabled">Match</button>
74 <button type="button" class="btn btn-xs wizard-union-toggle-btn wizard-union-toggle-btn-any btn-primary active">ANY</button>
75 <button type="button" class="btn btn-xs wizard-union-toggle-btn wizard-union-toggle-btn-min btn-default">MIN</button>
76 <button type="button" class="btn btn-xs wizard-union-toggle-btn wizard-union-toggle-btn-all btn-default">ALL</button>
78 <div class="input-group input-group-sm wizard-union-toggle-min-group">
79 <span class="input-group-btn">
80 <button class="btn btn-default disabled" type="button">>=</button>
82 <input type="text" class="form-control wizard-union-toggle-min-value">
83 <span class="input-group-btn">
84 <button class="btn btn-xs wizard-union-toggle-min-type wizard-union-toggle-min-type-percent btn-primary active" type="button">%</button>
85 <button class="btn btn-xs wizard-union-toggle-min-type wizard-union-toggle-min-type-count btn-default" type="button">#</button>
92 <table class="wizard-save-to-list table panel-footer">
93 <&| /util/user.mas:logged_in &>
96 <select class="wizard-add-to-list-id form-control input-sm">
97 <option selected value="" disabled>Add to List...</option>
98 <optgroup class="wizard-lists-group" label="--------------------"></optgroup>
102 <button class="wizard-add-to-list btn btn-sm btn-primary btn-block">Add</button>
107 <input class="wizard-create-list-name form-control input-sm" type="text" placeholder="Create New List..."></input>
110 <button class="wizard-create-list btn btn-primary btn-sm btn-block">Create</button>
114 <&| /util/user.mas:logged_out &>
116 <td><button class="btn btn-xs btn-primary" name="site_login_button">Log In</button> to save lists.</td>
127 <div class="clearfix col-xs-12"></div>
129 <div class="wizard-datasets panel-group col-sm-12 col-md-6">
130 <div class="panel panel-default wizard-panel">
131 <div class="panel-heading">
132 <&| /util/user.mas:logged_out &><button class="btn btn-xs btn-primary" name="site_login_button">Log In</button> to</&>
133 Load/Create Datasets using <button class="btn btn-xs btn-default disabled wizard-btn-tag">Match</button> Columns
135 <&| /util/user.mas:logged_in &>
136 <div class="panel-body">
137 <div class="input-group">
138 <select class="form-control input-sm wizard-dataset-select">
139 <option selected value="" disabled>Load Dataset</option>
140 <optgroup class="wizard-dataset-group" label="--------------------"></optgroup>
142 <span class="input-group-btn">
143 <span><button style="width:5em;margin-left:4px;" class="btn btn-sm btn-primary wizard-dataset-load">Load</button></span>
144 <span><button style="width:9em;margin-left:4px;" class="btn btn-sm btn-primary wizard-dataset-public">Make Public</button></span>
145 <span><button style="width:5em;margin-left:4px;" class="btn btn-sm btn-danger wizard-dataset-delete">Delete</button></span>
149 <div class="panel-body" style="margin-top:-1px;">
150 <div class="input-group">
151 <input type="text" placeholder="Create New Dataset" class="form-control input-sm wizard-dataset-name" />
152 <span class="input-group-btn">
153 <span><button style="width:5em;margin-left:4px;" class="btn btn-sm btn-primary wizard-dataset-create">Create</button></span>
161 <div class="wizard-downloads panel-group col-sm-12 col-md-6" id="wiz-down-group" role="tablist" aria-multiselectable="true">
162 <&| /util/user.mas:logged_out &>
163 <div class="panel panel-default">
164 <div class="panel-heading">
165 <button class="btn btn-xs btn-primary" name="site_login_button">Log In</button> to download related data.
169 <&| /util/user.mas:logged_in &>
170 <div class="panel panel-default">
171 <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">
172 <span class="btnn btn-link">Related Genotype Data</span>
174 <div id="wiz-down-1-c" class="panel-collapse collapse" role="tabpanel">
175 <p style="margin: 15px; text-color: #999; font-size: 90%">Download matching genotype records from the database. Select a <strong>single genotyping protocol</strong> and <strong>one or more accessions</strong> to download the matching genotype data.</p>
176 <table class="table">
179 <span class="glyphicon glyphicon-info-sign" title="To download related genotype data, select 1 or more Accessions and optionally no more than 1 Genotyping Protocol in the wizard. If no genotyping protocol is selected, the database default protocol will be used. Click the checkbox here to compute genotypes for the selected accessions from genotypes of parents; this works for downloading genotypes, downloading the GRM, and performing GWAS."></span>
180 <span>Download Genotype Data</span>
181 <input class="wizard-download-genotypes-info form-control input-sm" type="text" disabled></input>
184 <span>Compute From Parents</span><br/>
185 <input type="checkbox" class="wizard-download-genotypes-parents-compute">
188 <span>Include Duplicate Genotypes</span><br/>
189 <input type="checkbox" class="wizard-download-genotypes-duplicates-include">
193 <div class="panel-footer" style="border-top: 1px solid #ddd;">
194 <table class="table">
197 <span class="glyphicon glyphicon-info-sign" title="You can use either chromosome or markers (markerset) to filter genotyping data. You cannot use both criteria at the same time."></span>
198 <span>Filter by Chromosome or Markerset</span>
203 <span>Chromosome</span>
204 <select class="wizard-download-genotypes-chromosome-number form-control input-sm"></select>
207 <span>Start Position</span>
208 <input placeholder="" type="number" class="wizard-download-genotypes-start-position form-control input-sm">
211 <span>End Position</span>
212 <input placeholder="" type="number" class="wizard-download-genotypes-end-position form-control input-sm">
217 <span>Marker / Markerset Filter</span>
218 <select class="wizard-download-genotypes-marker-set-list-id form-control input-sm" id="wizard-download-genotypes-marker-set-list-id"></select>
222 <button class="btn btn-sm btn-default" onClick="window.open('/breeders/markers', '_blank');">Manage Markersets</button>
227 <span>Genotypes Download Format</span>
228 <select class="wizard-download-genotypes-format form-control input-sm" >
229 <option value="VCF">VCF File Format</option>
230 <option value="DosageMatrix">Dosage Matrix File Format (.tsv)</option>
238 <span class="glyphicon glyphicon-info-sign" title="Select accessions, and optionally a genotyping protocol. If no genotyping protocol is selected, the default genotyping protocol is used in your system. If you want to filter genotypes, use the chromosome, start position, end position, or markerset. Can compute genotypes from parents if the parents of the accessions you selected have genotypes by checking the checkbox. Genotypes can be downloaded in VCF and Dosage Matrix Formats."></span>
239 <span>Download Genotypes</span><br/>
240 <button class="wizard-download-genotypes btn btn-sm btn-primary">
241 <span class="glyphicon glyphicon-download" aria-hidden="true"></span>
244 <input class="wizard-download-genotypes-info2 form-control btn-warning" type="text"></input> <!-- warn too many genotype protocols-->
245 <input class="wizard-download-genotypes-info3 form-control btn-warning" type="text"></input> <!-- show default protocol -->
246 <input class="wizard-download-genotypes-info4 form-control btn-warning" type="text"></input> <!-- show slow download warning -->
253 <div class="panel-footer" style="border-top: 1px solid #ddd;">
254 <table class="table">
257 <span>Minor Allele Frequency</span>
258 <input placeholder="0.05" value="0.05" type="number" class="wizard-download-genotypes-grm-maf form-control input-sm">
261 <span>Marker Filter</span>
262 <input placeholder="0.60" value="0.60" type="number" class="wizard-download-genotypes-grm-marker-filter form-control input-sm">
265 <span>Individuals Filter</span>
266 <input placeholder="0.80" value="0.80" type="number" class="wizard-download-genotypes-grm-individuals-filter form-control input-sm">
271 <span>Genomic Relationship Matrix (GRM) Download Format</span>
272 <select class="wizard-download-genotypes-grm-format form-control input-sm" >
273 <option value="matrix_uniquenames">Matrix Stock Names (.tsv)</option>
274 <option value="three_column_uniquenames">3-Column Stock Names (.tsv)</option>
275 <option value="three_column_reciprocal_uniquenames">3-Column Reciprocal Stock Names (.tsv)</option>
276 <option value="heatmap">Heatmap (.pdf)</option>
277 <option value="matrix">Matrix Stock IDs (.tsv)</option>
278 <option value="three_column">3-Column Stock IDs(.tsv)</option>
279 <option value="three_column_stock_id_integer">3-Column Stock IDs Integer (.tsv)</option>
280 <option value="three_column_reciprocal">3-Column Reciprocal Stock IDs (.tsv)</option>
281 <option value="three_column_reciprocal_stock_id_integer">3-Column Reciprocal Stock IDs Integer (.tsv)</option>
284 <span class="glyphicon glyphicon-info-sign" title="Select accessions, and optionally a genotyping protocol. If no genotyping protocol is selected, the default genotyping protocol is used in your system. Specify minor allele frequency (MAF), marker filter, and individuals filter. Can compute genotypes from parents if the parents of the accessions you selected have genotypes by checking the checkbox. GRM can be downloaded in a matrix format (.tsv) and a three column format."></span>
285 <span>Download GRM</span><br/>
286 <button class="wizard-download-genetic-relationship-matrix btn btn-sm btn-primary">
287 <span class="glyphicon glyphicon-download" aria-hidden="true"></span>
294 <span>Genome Wide Association Study (GWAS) Download Format</span>
295 <select class="wizard-download-genotypes-gwas-format form-control input-sm" >
296 <option value="manhattan_qq_plots">Manhattan + QQ Plots (.pdf)</option>
297 <option value="results_tsv">GWAS Results (.tsv)</option>
300 <span>Selected Traits Are All Repeated Measurements</span>
301 <select class="wizard-download-genotypes-gwas-repeated-measurements form-control input-sm" >
302 <option value="no">No</option>
303 <option value="yes">Yes</option>
306 <span class="glyphicon glyphicon-info-sign" title="Select accessions, traits, and optionally a genotyping protocol. If no genotyping protocol is selected, the default genotyping protocol is used in your system. When many traits are selected and these traits are not treated as repeated measurements, the traits are treated separately and distinct results are returned e.g. several Manhattan plots are returned. If the selected traits are in fact repeated measurements, then select 'yes'; a single GWAS will be run against all of the phenotypes e.g. a single Manhattan plot is returned. Specify minor allele frequency (MAF), marker filter, and individuals filter. Can compute genotypes from parents if the parents of the accessions you selected have genotypes by checking the checkbox. GWAS uses a fixed effect for different field trials and a fixed effect for replicate. GWAS uses Kinship matrix calculated from the genotype data. MAF and missing data used to filter prior to GWAS and Kinship matrix calculation. Can select whether to return results in Manhattan and QQ Plot (.pdf) form or as the tabular results (.tsv)."></span>
307 <span>Run GWAS</span><br/>
308 <button class="wizard-download-gwas btn btn-sm btn-primary">
309 <span class="glyphicon glyphicon-download" aria-hidden="true"></span>
320 <div class="panel panel-default">
321 <div class="panel-heading" role="button" data-toggle="collapse" data-parent="#wiz-down-group" href="#wiz-down-1-c-a" aria-controls="wiz-down-1-c-a">
322 <span class="btnn btn-link">Archived Genotype Data</span>
324 <div id="wiz-down-1-c-a" class="panel-collapse collapse" role="tabpanel">
325 <p style="margin: 15px; text-color: #999; font-size: 90%">Download the original archived VCF files of entire genotyping projects. Select <strong>one or more genotyping projects and/or genotyping protocols</strong> to download a VCF file of any matching project(s).</p>
326 <div id="wiz-down-1-c-a-body" style="min-height: 50px"></div>
330 <div class="panel panel-default">
331 <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">
332 <span class="btnn btn-link">Related Trial Metadata</span>
334 <div id="wiz-down-2-c" class="panel-collapse collapse" role="tabpanel">
335 <table class="table">
338 <input class="wizard-download-tmetadata-info form-control input-sm" type="text" disabled value="No Trials Selected"></input>
341 <select class="wizard-download-tmetadata-format form-control input-sm">
342 <option value="" disabled>Format</option>
343 <option selected value="csv">CSV</option>
344 <option value="xlsx">XLSX</option>
349 <div class="panel-footer" style="border-top: 1px solid #ddd;">
350 <button class="wizard-download-tmetadata btn btn-sm btn-primary">
351 <span class="glyphicon glyphicon-download" aria-hidden="true"></span>
358 <div class="panel panel-default">
359 <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">
360 <span class="btnn btn-link">Related Trial Phenotypes</span>
362 <div id="wiz-down-3-c" class="panel-collapse collapse" role="tabpanel">
363 <table class="table">
366 <input class="wizard-download-phenotypes-info form-control input-sm" type="text" disabled></input>
371 <select class="wizard-download-phenotypes-speed form-control input-sm">
372 <option value="" disabled>Download Type</option>
373 <option selected value="Native">Default</option>
374 <option value="MaterializedViewTable">Fast (Improves speed but may miss recent changes)</option>
378 <select class="wizard-download-phenotypes-format form-control input-sm">
379 <option value="" disabled>Download Format</option>
380 <option selected value="csv">CSV</option>
381 <option value="xlsx">XLSX</option>
385 <select class="wizard-download-phenotypes-level form-control input-sm">
386 <option value="" disabled>Data Level</option>
387 <option selected value="all">All</option>
388 <option value="plot">Plots</option>
389 <option value="plant">Plants</option>
395 <div class="checkbox">
397 <input class="wizard-download-phenotypes-timestamp" type="checkbox">
403 <div class="checkbox">
405 <input class="wizard-download-phenotypes-entry-numbers" type="checkbox">
406 Include accession entry numbers
412 <td colspan="3" style="border-top: none; padding-top: 0">
413 <div class="checkbox">
415 <input class="wizard-download-phenotypes-outliers" type="checkbox">
416 Supress user defined phenotype outliers
423 <span>Trait Name Contains</span>
424 <input placeholder="e.g. plant height" type="text" class="wizard-download-phenotypes-name form-control">
427 <span>Min Value</span>
428 <input placeholder="-∞" type="text" class="wizard-download-phenotypes-min form-control">
431 <span>Max Value</span>
432 <input placeholder="∞" type="text" class="wizard-download-phenotypes-max form-control">
436 <div class="panel-footer" style="border-top: 1px solid #ddd;">
437 <button class="wizard-download-phenotypes btn btn-sm btn-primary">
438 <span class="glyphicon glyphicon-download" aria-hidden="true"></span>
450 window.sWizard = jsMod['wizard'].WizardSetup("#wizard");
453 <div class="modal fade" id="update_wizard_dialog" name="update_wizard_dialog" tabindex="-1" role="dialog" aria-labelledby="updateWizardDialog">
454 <div class="modal-dialog" role="document">
455 <div class="modal-content">
456 <div class="modal-header">
457 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
458 <h3 class="modal-title" id="updateWizardDialog">Update Search Wizard</h3>
460 <div class="modal-body">
461 <div class="container-fluid">
462 <h4>How the wizard works</h4>
463 <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>
464 <div><h4>Current status:</h4><p id="wizard_status"></p></div>
467 <div class="modal-footer">
468 <div class="well well-sm" id="update_wizard_error" style="display:none;"></div>
469 <button type="button" class="btn btn-primary wiz-update" name="update_wizard" data-loading-text="Working..." id="update_wizard">Update search wizard</button>
470 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
478 jQuery(document).ready(function (){
480 document.getElementsByClassName("wizard-dataset-select")[0].value = <% $dataset_id %>;
481 document.getElementsByClassName("wizard-dataset-load")[0].click();
483 $(".wizard-download-genotypes-info2").hide();
484 $(".wizard-download-genotypes-info3").hide();
485 $(".wizard-download-genotypes-info4").hide();
488 d3.select('#update_wizard_show').on('click', function () {
489 $('#update_wizard_dialog').modal("show");
490 jsMod['wizard'].updateStatus("#wizard_status")
491 .then(function(isLoading){
493 d3.select("#update_wizard")
494 .attr("title","A search wizard update is already in progress...")
495 .attr("disabled",true);
498 d3.select("#update_wizard")
499 .attr("title","Refresh the search wizard to include newly uploaded data")
500 .attr("disabled",null)
505 d3.select("#update_wizard").on('click',function(){
506 jsMod['wizard'].refreshMatviews("fullview",this);
509 d3.select("#update_wizard_lists").on('click',function(){
510 window.sWizard.reload_lists();
514 // Wizard Callback: get archived vcf files available for selected genotyping protocol / project
515 window.sWizard.wizard.on_change(function(categories, selections, operations) {
516 var protocols = (selections.genotyping_protocols || []).map((i) => i.id);
517 var projects = (selections.genotyping_projects || []).map((i) => i.id);
518 if ( protocols.length === 0 && projects.length === 0 ) {
519 updateArchivedVCFFiles({ no_geno_selected: true });
522 updateArchivedVCFFiles({ loading: true });
524 url: '/ajax/genotyping_project/has_archived_vcf',
527 genotyping_protocol_id: !projects || projects.length === 0 ? (protocols.length > 0 ? protocols.join(',') : undefined) : undefined,
528 genotyping_project_id: projects.length > 0 ? projects.join(',') : undefined,
531 error: function(response) {
532 console.log(`ERROR: Could not query database for archived vcf files [protocols: ${protocols.join(',')}, projects: ${projects.join(',')}]`);
533 console.log(response);
534 updateArchivedVCFFiles({ error: true });
536 success: function(response) {
537 updateArchivedVCFFiles({ data: response });
542 updateArchivedVCFFiles({ no_geno_selected: true });
544 // Set the display of the Archived Genotype Data section
545 function updateArchivedVCFFiles({ no_geno_selected = false, loading = false, error = false, data = {} } = {}) {
547 if ( no_geno_selected ) {
548 html += "<p style='text-align: center; margin: 15px; font-size: 90%'>Select one or more <em>genotyping protocols</em> and/or <em>genotyping projects</em>...</p>";
550 else if ( loading ) {
551 html += "<p style='text-align: center; margin: 15px'>Loading...</p>";
554 html += "<p style='text-align: center; margin: 15px'>Error: Could not check for archived files</p>";
557 html += "<table class='table table-hover table-striped'>";
558 html += "<thead><tr><th>Protocol</th><th>Project</th><th>VCF File</th></tr></thead>";
560 Object.keys(data).forEach((proj_id) => {
561 const files = data[proj_id];
562 files.forEach((file) => {
564 html += `<td><a href="/breeders_toolbox/protocol/${file.genotyping_protocol_id}" target="_blank">${file.genotyping_protocol_name}</td>`;
565 html += `<td><a href="/breeders/trial/${file.genotyping_project_id}" target="_blank">${file.genotyping_project_name}</td>`;
566 if ( file.exists === 'true' ) {
567 html += `<td><a href="/ajax/genotyping_project/download_archived_vcf?genotyping_project_id=${file.genotyping_project_id}&basename=${file.basename}" target="_blank">Download</a></td>`;
570 html += "<td>File not found</td>";
579 jQuery('#wiz-down-1-c-a-body').html(html);
582 // Wizard Callback: get chromosome names for a single selected genotyping protocol
583 var SELECTED_GENOTYPING_PROTOCOL = undefined;
584 var SELECTED_GENOTYPING_PROJECT = undefined;
585 var SELECTED_ACCESSIONS = undefined;
587 var download_units = 0;
588 window.sWizard.wizard.on_change(function(categories, selections, operations) {
589 var selected_genotyping_protocols = selections.hasOwnProperty('genotyping_protocols') ? selections.genotyping_protocols : [];
590 var selected_genotyping_projects = selections.hasOwnProperty('genotyping_projects') ? selections.genotyping_projects : [];
591 var selected_accessions = selections.hasOwnProperty('accessions') ? selections.accessions : [];
592 selected_accessions = selected_accessions.length;
593 if ( selected_genotyping_protocols.length >= 1 ) {
594 $(".wizard-download-genotypes-info3").hide();
595 var selected_genotyping_protocol = selected_genotyping_protocols.length === 1 ? selected_genotyping_protocols[0].id : "";
596 if ( selected_genotyping_protocol != SELECTED_GENOTYPING_PROTOCOL ) {
597 SELECTED_GENOTYPING_PROTOCOL = selected_genotyping_protocol;
599 url: '/ajax/breeder/search/genotyping_protocol_chromosomes',
601 data: { 'genotyping_protocol': SELECTED_GENOTYPING_PROTOCOL },
602 error: function(response) {
603 console.log("ERROR: Could not get chromosome names for genotyping protocol #" + SELECTED_GENOTYPING_PROTOCOL);
604 console.log(response);
605 updateChromosomeNames();
607 success: function(response) {
608 if (response.error) {
609 console.log("ERROR: Server returned an error trying to get the chromosome names for genotyping protocol #" + SELECTED_GENOTYPING_PROTOCOL);
610 console.log(repsonse.error);
611 updateChromosomeNames();
613 updateChromosomeNames(response.chromosome_names);
618 url: '/ajax/genotyping_protocol/num_markers',
620 data: { 'protocol_ids': SELECTED_GENOTYPING_PROTOCOL },
621 error: function(response) {
622 console.log("ERROR: Could not get markers for genotyping protocol #" + SELECTED_GENOTYPING_PROTOCOL);
623 console.log(response);
625 success: function(response) {
626 if (response.error) {
627 console.log("ERROR: Server returned an error trying to get markers for genotyping protocol #" + SELECTED_GENOTYPING_PROTOCOL);
628 console.log(repsonse.error);
630 num_markers = response.data;
635 if ( selected_genotyping_protocols.length > 1 ) {
636 $(".wizard-download-genotypes-info2").show();
637 $(".wizard-download-genotypes-info2").val("too many genotype protocols");
639 $(".wizard-download-genotypes-info2").hide();
641 } else if ( selected_genotyping_projects.length >= 1 ) {
642 var selected_genotyping_project = selected_genotyping_projects[0].id;
643 if ( selected_genotyping_project !== SELECTED_GENOTYPING_PROJECT ) {
644 console.log("project new " + selected_genotyping_project);
645 SELECTED_GENOTYPING_PROJECT = selected_genotyping_project;
647 url: '/ajax/genotyping_project/protocols',
649 data: { 'genotyping_project_id': SELECTED_GENOTYPING_PROJECT },
650 error: function(response) {
651 console.log("ERROR: Could not get protocol for genotyping project #" + SELECTED_GENOTYPING_PROJECT);
652 console.log(response);
654 success: function(response) {
655 if (response.error) {
656 console.log("ERROR: Server returned an error trying to get protocol for genotyping project #" + SELECTED_GENOTYPING_PROJECT);
657 console.log(response.error);
660 genotyping_protocol = response.data;
661 SELECTED_GENOTYPING_PROTOCOL = genotyping_protocol[0]["protocol_id"];
662 // console.log(genotyping_protocol[0]["protocol_id"]);
663 // console.log(genotyping_protocol[0]["protocol_name"]);
664 console.log("genotype protocol from project = " + SELECTED_GENOTYPING_PROTOCOL);
665 if ( selected_genotyping_protocols.length < 1 ) {
666 $(".wizard-download-genotypes-info3").show();
667 $(".wizard-download-genotypes-info3").val("genotype protocol \"" + genotyping_protocol[0]["protocol_name"] + "\"");
671 url: '/ajax/breeder/search/genotyping_protocol_chromosomes',
673 data: { 'genotyping_protocol': SELECTED_GENOTYPING_PROTOCOL },
674 error: function(response) {
675 console.log("ERROR: Could not get chromosome names for genotyping protocol #" + SELECTED_GENOTYPING_PROTOCOL);
676 console.log(response);
677 updateChromosomeNames();
679 success: function(response) {
680 if (response.error) {
681 console.log("ERROR: Server returned an error trying to get the chromosome names for genotyping protocol #" + SELECTED_GENOTYPING_PROTOCOL);
682 console.log(repsonse.error);
683 updateChromosomeNames();
685 updateChromosomeNames(response.chromosome_names);
689 // console.log("calling ajax " + SELECTED_GENOTYPING_PROTOCOL);
691 url: '/ajax/genotyping_protocol/num_markers',
693 data: { 'protocol_ids': SELECTED_GENOTYPING_PROTOCOL },
694 error: function(response) {
695 console.log("ERROR: Could not get markers for genotyping protocol #" + SELECTED_GENOTYPING_PROTOCOL);
696 console.log(response);
698 success: function(response) {
699 if (response.error) {
700 console.log("ERROR: Server returned an error trying to get markers for genotyping protocol #" + SELECTED_GENOTYPING_PROTOCOL);
701 console.log(repsonse.error);
703 num_markers = response.data;
711 var protocol_name = '<% $c->config->{default_genotyping_protocol} %>';
712 $(".wizard-download-genotypes-info3").show();
713 $(".wizard-download-genotypes-info3").val("genotype protocol \"" + protocol_name + "\"");
715 url: '/get/genotyping/protocols/',
718 error: function(response) {
719 console.log("ERROR: Could not get genotyping protocol");
720 console.log(response);
722 success: function(response) {
723 if (response.error) {
724 console.log("ERROR: Server returned an error trying to get genotyping protocol #" + SELECTED_GENOTYPING_PROTOCOL);
725 console.log(repsonse.error);
727 SELECTED_GENOTYPING_PROTOCOL = response.default_protocol.protocol_id;
728 console.log(response.default_protocol.protocol_id);
730 url: '/ajax/genotyping_protocol/num_markers',
732 data: { 'protocol_ids': SELECTED_GENOTYPING_PROTOCOL },
733 error: function(response) {
734 console.log("ERROR: Could not get markers for genotyping protocol #" + SELECTED_GENOTYPING_PROTOCOL);
735 console.log(response);
737 success: function(response) {
738 if (response.error) {
739 console.log("ERROR: Server returned an error trying to get markers for genotyping protocol #" + SELECTED_GENOTYPING_PROTOCOL);
740 console.log(repsonse.error);
742 num_markers = response.data;
750 if ( selected_accessions !== SELECTED_ACCESSIONS ) {
751 SELECTED_ACCESSIONS = selected_accessions;
752 download_units = parseInt((num_markers * selected_accessions) / 1000000);
753 if (download_units > 1) {
754 $(".wizard-download-genotypes-info4").show();
755 $(".wizard-download-genotypes-info4").val(download_units + "M values, download will be slow");
756 // console.log("download units " + download_units);
758 $(".wizard-download-genotypes-info4").hide();
759 $(".wizard-download-genotypes-info4").val(download_units.toString());
763 // updateChromosomeNames();
765 // Set the chromosome names for the select dropdown menu
766 function updateChromosomeNames(names) {
769 html += "<option value=''>All</option>";
770 for ( var i = 0; i < names.length; i++ ) {
771 html += "<option value='" + names[i] + "'>" + names[i] + "</option>";
774 $(".wizard-download-genotypes-chromosome-number").html(html);