7084 |
28 Mar 23 |
nicklas |
var BwaMem2 = function() |
7084 |
28 Mar 23 |
nicklas |
2 |
{ |
7084 |
28 Mar 23 |
nicklas |
var bwa = {}; |
7084 |
28 Mar 23 |
nicklas |
var debug = 0; |
7084 |
28 Mar 23 |
nicklas |
var selectionIsValid = false; |
7084 |
28 Mar 23 |
nicklas |
var subtypeMergedSequences = null; |
7084 |
28 Mar 23 |
nicklas |
var annotationTypePipeline = null; |
7084 |
28 Mar 23 |
nicklas |
var clusterIsValid = false; |
7084 |
28 Mar 23 |
nicklas |
var manuallySelected = []; |
7084 |
28 Mar 23 |
nicklas |
10 |
|
7084 |
28 Mar 23 |
nicklas |
// Page initialization |
7084 |
28 Mar 23 |
nicklas |
bwa.initPage = function() |
7084 |
28 Mar 23 |
nicklas |
13 |
{ |
7084 |
28 Mar 23 |
nicklas |
14 |
|
7084 |
28 Mar 23 |
nicklas |
// Step 1 |
7084 |
28 Mar 23 |
nicklas |
Buttons.addClickHandler('btnSelectMergedSequences', bwa.selectMergedSequences); |
7084 |
28 Mar 23 |
nicklas |
Events.addEventHandler('mergedSequences', 'base-selected', bwa.setMergedSequenceCallback); |
7084 |
28 Mar 23 |
nicklas |
Events.addEventHandler('mergedSequences', 'change', bwa.mergedSequencesOnChange); |
7084 |
28 Mar 23 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', bwa.validateStep1); |
7084 |
28 Mar 23 |
nicklas |
20 |
|
7084 |
28 Mar 23 |
nicklas |
// Step 2 |
7084 |
28 Mar 23 |
nicklas |
Events.addEventHandler('step-2', 'wizard-initialize', bwa.initializeStep2); |
7084 |
28 Mar 23 |
nicklas |
Events.addEventHandler('step-2', 'wizard-validate', bwa.validateStep2); |
7084 |
28 Mar 23 |
nicklas |
Events.addEventHandler('clusters', 'change', bwa.clusterOnChange); |
7372 |
06 Oct 23 |
nicklas |
Events.addEventHandler('debug', 'change', bwa.debugOnChange); |
7372 |
06 Oct 23 |
nicklas |
Events.addEventHandler('override', 'change', bwa.overrideOnChange); |
7084 |
28 Mar 23 |
nicklas |
Events.addEventHandler('alignSoftware', 'change', bwa.softwareOnChange); |
7084 |
28 Mar 23 |
nicklas |
28 |
|
7084 |
28 Mar 23 |
nicklas |
// Navigation |
7084 |
28 Mar 23 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
7084 |
28 Mar 23 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
7084 |
28 Mar 23 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
7084 |
28 Mar 23 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
7084 |
28 Mar 23 |
nicklas |
34 |
|
7084 |
28 Mar 23 |
nicklas |
// Final registration |
7084 |
28 Mar 23 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', bwa.submit); |
7084 |
28 Mar 23 |
nicklas |
37 |
|
7084 |
28 Mar 23 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
7084 |
28 Mar 23 |
nicklas |
var url = '../BwaMem2.servlet?ID='+App.getSessionId(); |
7084 |
28 Mar 23 |
nicklas |
url += '&cmd=GetMergedSequencesForBwaMem2'; |
7084 |
28 Mar 23 |
nicklas |
Wizard.asyncJsonRequest(url, bwa.initializeStep1); |
7084 |
28 Mar 23 |
nicklas |
42 |
} |
7084 |
28 Mar 23 |
nicklas |
43 |
|
7084 |
28 Mar 23 |
nicklas |
// --- Step 1 ----------------------------------- |
7084 |
28 Mar 23 |
nicklas |
bwa.initializeStep1 = function(response) |
7084 |
28 Mar 23 |
nicklas |
46 |
{ |
7084 |
28 Mar 23 |
nicklas |
var mergedSequences = response.mergedSequences; |
7084 |
28 Mar 23 |
nicklas |
var frm = document.forms['reggie']; |
7084 |
28 Mar 23 |
nicklas |
49 |
|
7084 |
28 Mar 23 |
nicklas |
if (mergedSequences != null && mergedSequences.length > 0) |
7084 |
28 Mar 23 |
nicklas |
51 |
{ |
7084 |
28 Mar 23 |
nicklas |
for (var msNo=0; msNo < mergedSequences.length; msNo++) |
7084 |
28 Mar 23 |
nicklas |
53 |
{ |
7084 |
28 Mar 23 |
nicklas |
var ms = mergedSequences[msNo]; |
7084 |
28 Mar 23 |
nicklas |
var option = bwa.createListOption(msNo+1, ms, ms.DO_NOT_USE == null) |
7084 |
28 Mar 23 |
nicklas |
frm.mergedSequences.options[frm.mergedSequences.length] = option; |
7084 |
28 Mar 23 |
nicklas |
57 |
} |
7084 |
28 Mar 23 |
nicklas |
Events.sendChangeEvent('mergedSequences'); |
7084 |
28 Mar 23 |
nicklas |
59 |
} |
7084 |
28 Mar 23 |
nicklas |
else |
7084 |
28 Mar 23 |
nicklas |
61 |
{ |
7084 |
28 Mar 23 |
nicklas |
Wizard.setInputStatus('mergedSequences', 'invalid', 'No new sequences available for processing'); |
7084 |
28 Mar 23 |
nicklas |
63 |
} |
7084 |
28 Mar 23 |
nicklas |
64 |
|
7084 |
28 Mar 23 |
nicklas |
Doc.show('step-1'); |
7084 |
28 Mar 23 |
nicklas |
Doc.show('gonext'); |
7084 |
28 Mar 23 |
nicklas |
67 |
|
7084 |
28 Mar 23 |
nicklas |
frm.mergedSequences.focus(); |
7084 |
28 Mar 23 |
nicklas |
69 |
} |
7084 |
28 Mar 23 |
nicklas |
70 |
|
7084 |
28 Mar 23 |
nicklas |
bwa.validateStep1 = function(event) |
7084 |
28 Mar 23 |
nicklas |
72 |
{ |
7084 |
28 Mar 23 |
nicklas |
if (!selectionIsValid) event.preventDefault(); |
7084 |
28 Mar 23 |
nicklas |
74 |
} |
7084 |
28 Mar 23 |
nicklas |
75 |
|
7084 |
28 Mar 23 |
nicklas |
bwa.selectMergedSequences = function() |
7084 |
28 Mar 23 |
nicklas |
77 |
{ |
7084 |
28 Mar 23 |
nicklas |
var frm = document.forms['reggie']; |
7084 |
28 Mar 23 |
nicklas |
if (frm.mergedSequences.disabled) return; |
7084 |
28 Mar 23 |
nicklas |
80 |
|
7084 |
28 Mar 23 |
nicklas |
if (subtypeMergedSequences == null) |
7084 |
28 Mar 23 |
nicklas |
82 |
{ |
7084 |
28 Mar 23 |
nicklas |
subtypeMergedSequences = Reggie.getSubtypeInfo('MERGED_SEQUENCES'); |
7084 |
28 Mar 23 |
nicklas |
84 |
} |
7084 |
28 Mar 23 |
nicklas |
if (annotationTypePipeline == null) |
7084 |
28 Mar 23 |
nicklas |
86 |
{ |
7084 |
28 Mar 23 |
nicklas |
annotationTypePipeline = Reggie.getAnnotationTypeInfo('PIPELINE'); |
7084 |
28 Mar 23 |
nicklas |
88 |
} |
7084 |
28 Mar 23 |
nicklas |
89 |
|
7084 |
28 Mar 23 |
nicklas |
// Reset list |
7084 |
28 Mar 23 |
nicklas |
manuallySelected = []; |
7084 |
28 Mar 23 |
nicklas |
var url = '&resetTemporary=1'; |
7084 |
28 Mar 23 |
nicklas |
url += '&tmpfilter:INT:itemSubtype='+subtypeMergedSequences.id; |
7084 |
28 Mar 23 |
nicklas |
url += '&tmpfilter:STRING:'+encodeURIComponent('#')+annotationTypePipeline.id+'='+encodeURIComponent('DNA/Normal/WGS|DNA/Tumor/WGS'); |
7084 |
28 Mar 23 |
nicklas |
Dialogs.selectItem('DERIVEDBIOASSAY', 'mergedSequences', 1, url); |
7084 |
28 Mar 23 |
nicklas |
96 |
} |
7084 |
28 Mar 23 |
nicklas |
97 |
|
7084 |
28 Mar 23 |
nicklas |
bwa.setMergedSequenceCallback = function(event) |
7084 |
28 Mar 23 |
nicklas |
99 |
{ |
7084 |
28 Mar 23 |
nicklas |
var ms = event.detail; |
7084 |
28 Mar 23 |
nicklas |
101 |
|
7084 |
28 Mar 23 |
nicklas |
var opt = Reggie.getListOption('mergedSequences', ms.id); |
7084 |
28 Mar 23 |
nicklas |
if (opt) |
7084 |
28 Mar 23 |
nicklas |
104 |
{ |
7084 |
28 Mar 23 |
nicklas |
opt.selected = true; |
7084 |
28 Mar 23 |
nicklas |
106 |
} |
7084 |
28 Mar 23 |
nicklas |
else |
7084 |
28 Mar 23 |
nicklas |
108 |
{ |
7084 |
28 Mar 23 |
nicklas |
manuallySelected[manuallySelected.length] = ms.id; |
7084 |
28 Mar 23 |
nicklas |
110 |
} |
7084 |
28 Mar 23 |
nicklas |
111 |
|
7084 |
28 Mar 23 |
nicklas |
if (ms.remaining == 0 && manuallySelected.length > 0) |
7084 |
28 Mar 23 |
nicklas |
113 |
{ |
7084 |
28 Mar 23 |
nicklas |
var url = '../BwaMem2.servlet?ID='+App.getSessionId(); |
7084 |
28 Mar 23 |
nicklas |
url += '&cmd=GetMergedSequencesForBwaMem2'; |
7084 |
28 Mar 23 |
nicklas |
url += '&items='+manuallySelected.join(','); |
7084 |
28 Mar 23 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
7084 |
28 Mar 23 |
nicklas |
Wizard.asyncJsonRequest(url, bwa.manuallySelected); |
7084 |
28 Mar 23 |
nicklas |
119 |
} |
7084 |
28 Mar 23 |
nicklas |
else |
7084 |
28 Mar 23 |
nicklas |
121 |
{ |
7084 |
28 Mar 23 |
nicklas |
Events.sendChangeEvent('mergedSequences'); |
7084 |
28 Mar 23 |
nicklas |
123 |
} |
7084 |
28 Mar 23 |
nicklas |
124 |
} |
7084 |
28 Mar 23 |
nicklas |
125 |
|
7084 |
28 Mar 23 |
nicklas |
bwa.manuallySelected = function(response) |
7084 |
28 Mar 23 |
nicklas |
127 |
{ |
7084 |
28 Mar 23 |
nicklas |
var mergedSequences = response.mergedSequences; |
7084 |
28 Mar 23 |
nicklas |
var frm = document.forms['reggie']; |
7084 |
28 Mar 23 |
nicklas |
130 |
|
7084 |
28 Mar 23 |
nicklas |
if (mergedSequences != null && mergedSequences.length > 0) |
7084 |
28 Mar 23 |
nicklas |
132 |
{ |
7084 |
28 Mar 23 |
nicklas |
var offset = frm.mergedSequences.length+1; |
7084 |
28 Mar 23 |
nicklas |
for (var msNo=0; msNo < mergedSequences.length; msNo++) |
7084 |
28 Mar 23 |
nicklas |
135 |
{ |
7084 |
28 Mar 23 |
nicklas |
var ms = mergedSequences[msNo]; |
7084 |
28 Mar 23 |
nicklas |
var option = bwa.createListOption(msNo+offset, ms, ms.DO_NOT_USE == null); |
7084 |
28 Mar 23 |
nicklas |
frm.mergedSequences.options[frm.mergedSequences.length] = option; |
7084 |
28 Mar 23 |
nicklas |
139 |
} |
7084 |
28 Mar 23 |
nicklas |
Events.sendChangeEvent('mergedSequences'); |
7084 |
28 Mar 23 |
nicklas |
141 |
} |
7084 |
28 Mar 23 |
nicklas |
142 |
} |
7084 |
28 Mar 23 |
nicklas |
143 |
|
7084 |
28 Mar 23 |
nicklas |
bwa.createListOption = function(index, mergedItem, selected) |
7084 |
28 Mar 23 |
nicklas |
145 |
{ |
7084 |
28 Mar 23 |
nicklas |
var tooltip = null; |
7084 |
28 Mar 23 |
nicklas |
var name = (index) + ': '+mergedItem.name; |
7084 |
28 Mar 23 |
nicklas |
if (mergedItem.pipeline) name += ' ('+mergedItem.pipeline+')'; |
7084 |
28 Mar 23 |
nicklas |
149 |
|
7084 |
28 Mar 23 |
nicklas |
if (mergedItem.DO_NOT_USE) |
7084 |
28 Mar 23 |
nicklas |
151 |
{ |
7084 |
28 Mar 23 |
nicklas |
name += ' [DoNotUse]'; |
7084 |
28 Mar 23 |
nicklas |
tooltip = 'DoNotUse-'+Strings.encodeTags(mergedItem.DO_NOT_USE+': '+mergedItem.DO_NOT_USE_COMMENT); |
7084 |
28 Mar 23 |
nicklas |
154 |
} |
7084 |
28 Mar 23 |
nicklas |
else if (mergedItem.AutoProcess == 'ReProcess') |
7084 |
28 Mar 23 |
nicklas |
156 |
{ |
7084 |
28 Mar 23 |
nicklas |
name += ' [R]'; |
7084 |
28 Mar 23 |
nicklas |
158 |
} |
7084 |
28 Mar 23 |
nicklas |
159 |
|
7084 |
28 Mar 23 |
nicklas |
var option = new Option(name, mergedItem.id, false, selected); |
7084 |
28 Mar 23 |
nicklas |
if (tooltip) option.title = tooltip; |
7084 |
28 Mar 23 |
nicklas |
option.mergedSequences = mergedItem; |
7084 |
28 Mar 23 |
nicklas |
return option; |
7084 |
28 Mar 23 |
nicklas |
164 |
} |
7084 |
28 Mar 23 |
nicklas |
165 |
|
7084 |
28 Mar 23 |
nicklas |
bwa.mergedSequencesOnChange = function() |
7084 |
28 Mar 23 |
nicklas |
167 |
{ |
7084 |
28 Mar 23 |
nicklas |
var frm = document.forms['reggie']; |
7084 |
28 Mar 23 |
nicklas |
selectionIsValid = false; |
7084 |
28 Mar 23 |
nicklas |
var numSelected = 0; |
7084 |
28 Mar 23 |
nicklas |
var numDoNotUse = 0; |
7084 |
28 Mar 23 |
nicklas |
var invalidPipeline = null; |
7084 |
28 Mar 23 |
nicklas |
173 |
|
7084 |
28 Mar 23 |
nicklas |
Wizard.setInputStatus('mergedSequences'); |
7084 |
28 Mar 23 |
nicklas |
Wizard.hideGoNextConfirmation(); |
7084 |
28 Mar 23 |
nicklas |
for (var msNo = 0; msNo < frm.mergedSequences.length; msNo++) |
7084 |
28 Mar 23 |
nicklas |
177 |
{ |
7084 |
28 Mar 23 |
nicklas |
if (frm.mergedSequences[msNo].selected) |
7084 |
28 Mar 23 |
nicklas |
179 |
{ |
7084 |
28 Mar 23 |
nicklas |
numSelected++; |
7084 |
28 Mar 23 |
nicklas |
var ms = frm.mergedSequences[msNo].mergedSequences; |
7084 |
28 Mar 23 |
nicklas |
if (ms.DO_NOT_USE) numDoNotUse++; |
7084 |
28 Mar 23 |
nicklas |
if (ms.pipeline && ms.pipeline != 'DNA/Tumor/WGS' && ms.pipeline != 'DNA/Normal/WGS') |
7084 |
28 Mar 23 |
nicklas |
184 |
{ |
7084 |
28 Mar 23 |
nicklas |
invalidPipeline = Strings.encodeTags(ms.name+' ('+ms.pipeline)+') is not intended for the DNA/*/WGS pipeline.'; |
7084 |
28 Mar 23 |
nicklas |
186 |
} |
7084 |
28 Mar 23 |
nicklas |
187 |
} |
7084 |
28 Mar 23 |
nicklas |
188 |
} |
7084 |
28 Mar 23 |
nicklas |
189 |
|
7084 |
28 Mar 23 |
nicklas |
if (numSelected == 0) |
7084 |
28 Mar 23 |
nicklas |
191 |
{ |
7084 |
28 Mar 23 |
nicklas |
Wizard.setInputStatus('mergedSequences', 'invalid', 'Select at least one item'); |
7084 |
28 Mar 23 |
nicklas |
return; |
7084 |
28 Mar 23 |
nicklas |
194 |
} |
7084 |
28 Mar 23 |
nicklas |
if (invalidPipeline) |
7084 |
28 Mar 23 |
nicklas |
196 |
{ |
7084 |
28 Mar 23 |
nicklas |
Wizard.setInputStatus('mergedSequences', 'invalid', invalidPipeline); |
7084 |
28 Mar 23 |
nicklas |
return; |
7084 |
28 Mar 23 |
nicklas |
199 |
} |
7084 |
28 Mar 23 |
nicklas |
selectionIsValid = true; |
7084 |
28 Mar 23 |
nicklas |
201 |
|
7084 |
28 Mar 23 |
nicklas |
if (numDoNotUse > 0) |
7084 |
28 Mar 23 |
nicklas |
203 |
{ |
7084 |
28 Mar 23 |
nicklas |
Wizard.setInputStatus('mergedSequences', 'warning', numDoNotUse + ' selected items marked as DoNotUse'); |
7084 |
28 Mar 23 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Confirm ' + numDoNotUse + ' items marked as DoNotUse'); |
7084 |
28 Mar 23 |
nicklas |
206 |
} |
7084 |
28 Mar 23 |
nicklas |
else |
7084 |
28 Mar 23 |
nicklas |
208 |
{ |
7084 |
28 Mar 23 |
nicklas |
Wizard.setInputStatus('mergedSequences', 'valid'); |
7084 |
28 Mar 23 |
nicklas |
210 |
} |
7084 |
28 Mar 23 |
nicklas |
211 |
} |
7084 |
28 Mar 23 |
nicklas |
212 |
|
7084 |
28 Mar 23 |
nicklas |
// --- Step 2 ----------------------------------- |
7084 |
28 Mar 23 |
nicklas |
bwa.initializeStep2 = function() |
7084 |
28 Mar 23 |
nicklas |
215 |
{ |
7084 |
28 Mar 23 |
nicklas |
Wizard.setCurrentStep(2); |
7084 |
28 Mar 23 |
nicklas |
217 |
|
7084 |
28 Mar 23 |
nicklas |
// Check debug by default if debug is set or not on a secure server (=production server) |
7084 |
28 Mar 23 |
nicklas |
var frm = document.forms['reggie']; |
7084 |
28 Mar 23 |
nicklas |
frm.debug.checked = debug || location.protocol != 'https:'; |
7084 |
28 Mar 23 |
nicklas |
221 |
|
7131 |
24 Apr 23 |
nicklas |
Reggie.loadProtocols('ALIGNMENT_PROTOCOL', 'alignProtocol', 'ALIGNMENT_TYPE,PIPELINE', 'Bwa-mem2'); |
7131 |
24 Apr 23 |
nicklas |
Reggie.loadSoftware('ALIGNMENT_SOFTWARE', 'alignSoftware', 'ALIGNMENT_TYPE,PIPELINE,PARAMETER_SET', 'Bwa-mem2'); |
7084 |
28 Mar 23 |
nicklas |
224 |
|
7084 |
28 Mar 23 |
nicklas |
// Load clusters |
7084 |
28 Mar 23 |
nicklas |
var url = '../OpenGrid.servlet?ID='+App.getSessionId() + '&cmd=GetHostInfo&config=align-bwa-mem2'; |
7084 |
28 Mar 23 |
nicklas |
Doc.addClass('clusters', 'list-loading'); |
7084 |
28 Mar 23 |
nicklas |
frm.clusters[0] = new Option('loading...'); |
7084 |
28 Mar 23 |
nicklas |
Wizard.asyncJsonRequest(url, bwa.clustersLoaded); |
7084 |
28 Mar 23 |
nicklas |
230 |
|
7084 |
28 Mar 23 |
nicklas |
Doc.show('goregister'); |
7084 |
28 Mar 23 |
nicklas |
Doc.show('gocancel'); |
7084 |
28 Mar 23 |
nicklas |
233 |
} |
7084 |
28 Mar 23 |
nicklas |
234 |
|
7084 |
28 Mar 23 |
nicklas |
bwa.validateStep2 = function(event) |
7084 |
28 Mar 23 |
nicklas |
236 |
{ |
7084 |
28 Mar 23 |
nicklas |
if (!clusterIsValid) event.preventDefault(); |
7084 |
28 Mar 23 |
nicklas |
238 |
} |
7084 |
28 Mar 23 |
nicklas |
239 |
|
7084 |
28 Mar 23 |
nicklas |
bwa.clustersLoaded = function(response) |
7084 |
28 Mar 23 |
nicklas |
241 |
{ |
7084 |
28 Mar 23 |
nicklas |
Doc.removeClass('clusters', 'list-loading'); |
7084 |
28 Mar 23 |
nicklas |
var frm = document.forms['reggie']; |
7084 |
28 Mar 23 |
nicklas |
var clusters = response.hosts; |
7084 |
28 Mar 23 |
nicklas |
frm.clusters.length = 0; |
7084 |
28 Mar 23 |
nicklas |
for (var i = 0; i < clusters.length; i++) |
7084 |
28 Mar 23 |
nicklas |
247 |
{ |
7084 |
28 Mar 23 |
nicklas |
var cl = clusters[i]; |
7084 |
28 Mar 23 |
nicklas |
var option = new Option(cl.connection.name, cl.id); |
7084 |
28 Mar 23 |
nicklas |
option.cluster = cl; |
7084 |
28 Mar 23 |
nicklas |
frm.clusters[frm.clusters.length] = option; |
7084 |
28 Mar 23 |
nicklas |
Wizard.setInputStatus('clusters', 'valid'); |
7084 |
28 Mar 23 |
nicklas |
clusterIsValid = true; |
7084 |
28 Mar 23 |
nicklas |
254 |
} |
7084 |
28 Mar 23 |
nicklas |
if (frm.clusters.length == 0) |
7084 |
28 Mar 23 |
nicklas |
256 |
{ |
7084 |
28 Mar 23 |
nicklas |
Wizard.setInputStatus('clusters', 'invalid', 'No available clusters'); |
7084 |
28 Mar 23 |
nicklas |
clusterIsValid = false; |
7084 |
28 Mar 23 |
nicklas |
259 |
} |
7084 |
28 Mar 23 |
nicklas |
else |
7084 |
28 Mar 23 |
nicklas |
261 |
{ |
7084 |
28 Mar 23 |
nicklas |
bwa.clusterOnChange(); |
7084 |
28 Mar 23 |
nicklas |
263 |
} |
7084 |
28 Mar 23 |
nicklas |
264 |
} |
7084 |
28 Mar 23 |
nicklas |
265 |
|
7084 |
28 Mar 23 |
nicklas |
bwa.softwareOnChange = function(event) |
7084 |
28 Mar 23 |
nicklas |
267 |
{ |
7084 |
28 Mar 23 |
nicklas |
var target = event.currentTarget; |
7084 |
28 Mar 23 |
nicklas |
var item = target[target.selectedIndex].item; |
7084 |
28 Mar 23 |
nicklas |
if (!item) item = {}; |
7084 |
28 Mar 23 |
nicklas |
271 |
|
7084 |
28 Mar 23 |
nicklas |
Doc.element(target.id+'.parameterSet').innerHTML = Strings.encodeTags(item.ParameterSet || 'default'); |
7084 |
28 Mar 23 |
nicklas |
Doc.element(target.id+'.description').innerHTML = Strings.encodeTags(item.description); |
7084 |
28 Mar 23 |
nicklas |
Wizard.setInputStatus(target.id, 'valid'); |
7084 |
28 Mar 23 |
nicklas |
275 |
|
7084 |
28 Mar 23 |
nicklas |
if (item.ParameterSet) |
7084 |
28 Mar 23 |
nicklas |
277 |
{ |
7084 |
28 Mar 23 |
nicklas |
var url = '../Install.servlet?ID='+App.getSessionId(); |
7084 |
28 Mar 23 |
nicklas |
url += '&cmd=GetParameterSetInfo'; |
7084 |
28 Mar 23 |
nicklas |
url += '¶meterSet='+encodeURIComponent(item.ParameterSet); |
7084 |
28 Mar 23 |
nicklas |
url += '&targetId='+target.id; |
7084 |
28 Mar 23 |
nicklas |
Wizard.asyncJsonRequest(url, bwa.parameterSetInfoLoaded); |
7084 |
28 Mar 23 |
nicklas |
283 |
} |
7372 |
06 Oct 23 |
nicklas |
bwa.updateSubmitOptions(); |
7084 |
28 Mar 23 |
nicklas |
285 |
} |
7084 |
28 Mar 23 |
nicklas |
286 |
|
7084 |
28 Mar 23 |
nicklas |
bwa.parameterSetInfoLoaded = function(response) |
7084 |
28 Mar 23 |
nicklas |
288 |
{ |
7084 |
28 Mar 23 |
nicklas |
if (!response.parameters || response.parameters.length == 0) |
7084 |
28 Mar 23 |
nicklas |
290 |
{ |
7084 |
28 Mar 23 |
nicklas |
Wizard.setInputStatus(response.targetId, 'warning', 'Can\'t find \'' + Strings.encodeTags(response.parameterSet) + '\' parameter set in reggie-config.xml'); |
7084 |
28 Mar 23 |
nicklas |
292 |
} |
7084 |
28 Mar 23 |
nicklas |
293 |
} |
7084 |
28 Mar 23 |
nicklas |
294 |
|
7084 |
28 Mar 23 |
nicklas |
bwa.clusterOnChange = function() |
7084 |
28 Mar 23 |
nicklas |
296 |
{ |
7084 |
28 Mar 23 |
nicklas |
var frm = document.forms['reggie']; |
7084 |
28 Mar 23 |
nicklas |
var cluster = frm.clusters[frm.clusters.selectedIndex].cluster; |
7084 |
28 Mar 23 |
nicklas |
if (cluster.priorities && cluster.priorities.length > 0) |
7084 |
28 Mar 23 |
nicklas |
300 |
{ |
7084 |
28 Mar 23 |
nicklas |
frm.priority.length = 0; |
7084 |
28 Mar 23 |
nicklas |
for (var pNo = 0; pNo < cluster.priorities.length; pNo++) |
7084 |
28 Mar 23 |
nicklas |
303 |
{ |
7084 |
28 Mar 23 |
nicklas |
var p = cluster.priorities[pNo]; |
7084 |
28 Mar 23 |
nicklas |
frm.priority[frm.priority.length] = new Option(p.name + ' ('+p.value+')', p.value, p['default'], p['default']); |
7084 |
28 Mar 23 |
nicklas |
306 |
} |
7084 |
28 Mar 23 |
nicklas |
Doc.show('job-priority'); |
7084 |
28 Mar 23 |
nicklas |
308 |
} |
7084 |
28 Mar 23 |
nicklas |
else |
7084 |
28 Mar 23 |
nicklas |
310 |
{ |
7084 |
28 Mar 23 |
nicklas |
Doc.hide('job-priority'); |
7084 |
28 Mar 23 |
nicklas |
312 |
} |
7084 |
28 Mar 23 |
nicklas |
if (cluster.partitions && cluster.partitions.length > 0) |
7084 |
28 Mar 23 |
nicklas |
314 |
{ |
7084 |
28 Mar 23 |
nicklas |
frm.partition.length = 0; |
7084 |
28 Mar 23 |
nicklas |
for (var pNo = 0; pNo < cluster.partitions.length; pNo++) |
7084 |
28 Mar 23 |
nicklas |
317 |
{ |
7084 |
28 Mar 23 |
nicklas |
var p = cluster.partitions[pNo]; |
7084 |
28 Mar 23 |
nicklas |
var title = p.name; |
7084 |
28 Mar 23 |
nicklas |
if (p.description) title += ' ('+p.description+')'; |
7084 |
28 Mar 23 |
nicklas |
frm.partition[frm.partition.length] = new Option(title, p.value, p['default'], p['default']); |
7084 |
28 Mar 23 |
nicklas |
322 |
} |
7084 |
28 Mar 23 |
nicklas |
Doc.show('job-partition'); |
7084 |
28 Mar 23 |
nicklas |
324 |
} |
7084 |
28 Mar 23 |
nicklas |
else |
7084 |
28 Mar 23 |
nicklas |
326 |
{ |
7084 |
28 Mar 23 |
nicklas |
Doc.hide('job-partition'); |
7084 |
28 Mar 23 |
nicklas |
328 |
} |
7372 |
06 Oct 23 |
nicklas |
bwa.updateSubmitOptions(); |
7084 |
28 Mar 23 |
nicklas |
330 |
} |
7084 |
28 Mar 23 |
nicklas |
331 |
|
7372 |
06 Oct 23 |
nicklas |
bwa.debugOnChange = function() |
7372 |
06 Oct 23 |
nicklas |
333 |
{ |
7372 |
06 Oct 23 |
nicklas |
bwa.updateSubmitOptions(); |
7372 |
06 Oct 23 |
nicklas |
335 |
} |
7372 |
06 Oct 23 |
nicklas |
336 |
|
7372 |
06 Oct 23 |
nicklas |
bwa.updateSubmitOptions = function() |
7372 |
06 Oct 23 |
nicklas |
338 |
{ |
7372 |
06 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7372 |
06 Oct 23 |
nicklas |
var config = frm.clusters[frm.clusters.selectedIndex]?.cluster?.config?.['align-bwa-mem2']; |
7372 |
06 Oct 23 |
nicklas |
if (config) |
7372 |
06 Oct 23 |
nicklas |
342 |
{ |
7372 |
06 Oct 23 |
nicklas |
var parameterSet = frm.alignSoftware[frm.alignSoftware.selectedIndex]?.item?.ParameterSet; |
7372 |
06 Oct 23 |
nicklas |
Doc.element('submitOptions').innerHTML = Reggie.getSubmitOptions(config, frm.debug.checked, parameterSet); |
7372 |
06 Oct 23 |
nicklas |
frm.override.disabled = false; |
7372 |
06 Oct 23 |
nicklas |
346 |
} |
7372 |
06 Oct 23 |
nicklas |
347 |
} |
7372 |
06 Oct 23 |
nicklas |
348 |
|
7372 |
06 Oct 23 |
nicklas |
bwa.overrideOnChange = function() |
7372 |
06 Oct 23 |
nicklas |
350 |
{ |
7372 |
06 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7372 |
06 Oct 23 |
nicklas |
Doc.showHide('submitOptions', !frm.override.checked); |
7372 |
06 Oct 23 |
nicklas |
Doc.showHide('submitOptionsOverride', frm.override.checked); |
7372 |
06 Oct 23 |
nicklas |
if (frm.submitOptionsOverride.value=='') |
7372 |
06 Oct 23 |
nicklas |
355 |
{ |
7372 |
06 Oct 23 |
nicklas |
frm.submitOptionsOverride.value = Doc.element('submitOptions').innerHTML; |
7372 |
06 Oct 23 |
nicklas |
357 |
} |
7372 |
06 Oct 23 |
nicklas |
358 |
} |
7372 |
06 Oct 23 |
nicklas |
359 |
|
7084 |
28 Mar 23 |
nicklas |
360 |
|
7084 |
28 Mar 23 |
nicklas |
bwa.submit = function() |
7084 |
28 Mar 23 |
nicklas |
362 |
{ |
7084 |
28 Mar 23 |
nicklas |
var frm = document.forms['reggie']; |
7084 |
28 Mar 23 |
nicklas |
364 |
|
7084 |
28 Mar 23 |
nicklas |
var submitInfo = {}; |
7084 |
28 Mar 23 |
nicklas |
submitInfo.alignSoftware = parseInt(frm.alignSoftware.value); |
7084 |
28 Mar 23 |
nicklas |
submitInfo.alignProtocol = parseInt(frm.alignProtocol.value); |
7084 |
28 Mar 23 |
nicklas |
submitInfo.cluster = frm.clusters.value; |
7084 |
28 Mar 23 |
nicklas |
if (frm.priority.selectedIndex >= 0) |
7084 |
28 Mar 23 |
nicklas |
370 |
{ |
7084 |
28 Mar 23 |
nicklas |
submitInfo.priority = parseInt(frm.priority.value); |
7084 |
28 Mar 23 |
nicklas |
372 |
} |
7084 |
28 Mar 23 |
nicklas |
if (frm.partition.selectedIndex >= 0) |
7084 |
28 Mar 23 |
nicklas |
374 |
{ |
7084 |
28 Mar 23 |
nicklas |
submitInfo.partition = frm.partition.value; |
7084 |
28 Mar 23 |
nicklas |
376 |
} |
7372 |
06 Oct 23 |
nicklas |
if (frm.override.checked) |
7372 |
06 Oct 23 |
nicklas |
378 |
{ |
7372 |
06 Oct 23 |
nicklas |
submitInfo.submitOptionsOverride = frm.submitOptionsOverride.value; |
7372 |
06 Oct 23 |
nicklas |
380 |
} |
7084 |
28 Mar 23 |
nicklas |
submitInfo.debug = frm.debug.checked; |
7084 |
28 Mar 23 |
nicklas |
submitInfo.autoConfirm = frm.autoConfirm.checked; |
7084 |
28 Mar 23 |
nicklas |
383 |
|
7084 |
28 Mar 23 |
nicklas |
var mergedSequences = []; |
7084 |
28 Mar 23 |
nicklas |
submitInfo.mergedSequences = mergedSequences; |
7084 |
28 Mar 23 |
nicklas |
386 |
|
7084 |
28 Mar 23 |
nicklas |
for (var msNo = 0; msNo < frm.mergedSequences.length; msNo++) |
7084 |
28 Mar 23 |
nicklas |
388 |
{ |
7084 |
28 Mar 23 |
nicklas |
if (frm.mergedSequences[msNo].selected) |
7084 |
28 Mar 23 |
nicklas |
390 |
{ |
7084 |
28 Mar 23 |
nicklas |
var ms = {}; |
7084 |
28 Mar 23 |
nicklas |
ms.id = frm.mergedSequences[msNo].mergedSequences.id; |
7084 |
28 Mar 23 |
nicklas |
mergedSequences[mergedSequences.length] = ms; |
7084 |
28 Mar 23 |
nicklas |
394 |
} |
7084 |
28 Mar 23 |
nicklas |
395 |
} |
7084 |
28 Mar 23 |
nicklas |
396 |
|
7084 |
28 Mar 23 |
nicklas |
var url = '../BwaMem2.servlet?ID='+App.getSessionId(); |
7084 |
28 Mar 23 |
nicklas |
url += '&cmd=StartBwaMem2Alignment'; |
7084 |
28 Mar 23 |
nicklas |
399 |
|
7084 |
28 Mar 23 |
nicklas |
Wizard.showLoadingAnimation('Performing registration...'); |
7084 |
28 Mar 23 |
nicklas |
Wizard.asyncJsonRequest(url, bwa.submissionResults, 'POST', JSON.stringify(submitInfo)); |
7084 |
28 Mar 23 |
nicklas |
402 |
} |
7084 |
28 Mar 23 |
nicklas |
403 |
|
7084 |
28 Mar 23 |
nicklas |
bwa.submissionResults = function(response) |
7084 |
28 Mar 23 |
nicklas |
405 |
{ |
7084 |
28 Mar 23 |
nicklas |
Wizard.showFinalMessage(response.messages); |
7084 |
28 Mar 23 |
nicklas |
Doc.show('gorestart'); |
7084 |
28 Mar 23 |
nicklas |
408 |
} |
7084 |
28 Mar 23 |
nicklas |
409 |
|
7084 |
28 Mar 23 |
nicklas |
return bwa; |
7084 |
28 Mar 23 |
nicklas |
411 |
}(); |
7084 |
28 Mar 23 |
nicklas |
412 |
|
7084 |
28 Mar 23 |
nicklas |
Doc.onLoad(BwaMem2.initPage); |
7084 |
28 Mar 23 |
nicklas |
414 |
|