7387 |
31 Oct 23 |
nicklas |
var PoN = function() |
7387 |
31 Oct 23 |
nicklas |
2 |
{ |
7387 |
31 Oct 23 |
nicklas |
var pon = {}; |
7387 |
31 Oct 23 |
nicklas |
var debug = 0; |
7387 |
31 Oct 23 |
nicklas |
var selectionIsValid = false; |
7387 |
31 Oct 23 |
nicklas |
var subtypeAlignedSequences = null; |
7387 |
31 Oct 23 |
nicklas |
var annotationTypePipeline = null; |
7387 |
31 Oct 23 |
nicklas |
var clusterIsValid = false; |
7387 |
31 Oct 23 |
nicklas |
var manuallySelected = []; |
7387 |
31 Oct 23 |
nicklas |
10 |
|
7387 |
31 Oct 23 |
nicklas |
// Page initialization |
7387 |
31 Oct 23 |
nicklas |
pon.initPage = function() |
7387 |
31 Oct 23 |
nicklas |
13 |
{ |
7387 |
31 Oct 23 |
nicklas |
14 |
|
7387 |
31 Oct 23 |
nicklas |
// Step 1 |
7387 |
31 Oct 23 |
nicklas |
Buttons.addClickHandler('btnSelectAlignedSequences', pon.selectAlignedSequences); |
7387 |
31 Oct 23 |
nicklas |
Events.addEventHandler('alignedSequences', 'base-selected', pon.setAlignedSequenceCallback); |
7387 |
31 Oct 23 |
nicklas |
Events.addEventHandler('alignedSequences', 'change', pon.alignedSequencesOnChange); |
7387 |
31 Oct 23 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', pon.validateStep1); |
7387 |
31 Oct 23 |
nicklas |
20 |
|
7387 |
31 Oct 23 |
nicklas |
// Step 2 |
7387 |
31 Oct 23 |
nicklas |
Events.addEventHandler('step-2', 'wizard-initialize', pon.initializeStep2); |
7387 |
31 Oct 23 |
nicklas |
Events.addEventHandler('step-2', 'wizard-validate', pon.validateStep2); |
7396 |
06 Nov 23 |
nicklas |
Events.addEventHandler('vcallSoftware', 'change', pon.softwareOnChange); |
7387 |
31 Oct 23 |
nicklas |
Events.addEventHandler('clusters', 'change', pon.clusterOnChange); |
7387 |
31 Oct 23 |
nicklas |
Events.addEventHandler('debug', 'change', pon.debugOnChange); |
7387 |
31 Oct 23 |
nicklas |
Events.addEventHandler('override', 'change', pon.overrideOnChange); |
7387 |
31 Oct 23 |
nicklas |
28 |
|
7387 |
31 Oct 23 |
nicklas |
// Navigation |
7387 |
31 Oct 23 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
7387 |
31 Oct 23 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
7387 |
31 Oct 23 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
7387 |
31 Oct 23 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
7387 |
31 Oct 23 |
nicklas |
34 |
|
7387 |
31 Oct 23 |
nicklas |
// Final registration |
7387 |
31 Oct 23 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', pon.submit); |
7387 |
31 Oct 23 |
nicklas |
37 |
|
7387 |
31 Oct 23 |
nicklas |
pon.initializeStep1(); |
7387 |
31 Oct 23 |
nicklas |
39 |
} |
7387 |
31 Oct 23 |
nicklas |
40 |
|
7387 |
31 Oct 23 |
nicklas |
// --- Step 1 ----------------------------------- |
7387 |
31 Oct 23 |
nicklas |
pon.initializeStep1 = function() |
7387 |
31 Oct 23 |
nicklas |
43 |
{ |
7387 |
31 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7387 |
31 Oct 23 |
nicklas |
Doc.show('gonext'); |
7387 |
31 Oct 23 |
nicklas |
Doc.show('step-1'); |
7387 |
31 Oct 23 |
nicklas |
frm.alignedSequences.focus(); |
7387 |
31 Oct 23 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
7387 |
31 Oct 23 |
nicklas |
49 |
} |
7387 |
31 Oct 23 |
nicklas |
50 |
|
7387 |
31 Oct 23 |
nicklas |
pon.validateStep1 = function(event) |
7387 |
31 Oct 23 |
nicklas |
52 |
{ |
7387 |
31 Oct 23 |
nicklas |
if (!selectionIsValid) event.preventDefault(); |
7387 |
31 Oct 23 |
nicklas |
54 |
} |
7387 |
31 Oct 23 |
nicklas |
55 |
|
7387 |
31 Oct 23 |
nicklas |
pon.selectAlignedSequences = function() |
7387 |
31 Oct 23 |
nicklas |
57 |
{ |
7387 |
31 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7387 |
31 Oct 23 |
nicklas |
if (frm.alignedSequences.disabled) return; |
7387 |
31 Oct 23 |
nicklas |
60 |
|
7387 |
31 Oct 23 |
nicklas |
if (subtypeAlignedSequences == null) |
7387 |
31 Oct 23 |
nicklas |
62 |
{ |
7387 |
31 Oct 23 |
nicklas |
subtypeAlignedSequences = Reggie.getSubtypeInfo('ALIGNED_SEQUENCES'); |
7387 |
31 Oct 23 |
nicklas |
64 |
} |
7387 |
31 Oct 23 |
nicklas |
if (annotationTypePipeline == null) |
7387 |
31 Oct 23 |
nicklas |
66 |
{ |
7387 |
31 Oct 23 |
nicklas |
annotationTypePipeline = Reggie.getAnnotationTypeInfo('PIPELINE'); |
7387 |
31 Oct 23 |
nicklas |
68 |
} |
7387 |
31 Oct 23 |
nicklas |
69 |
|
7387 |
31 Oct 23 |
nicklas |
// Reset list |
7387 |
31 Oct 23 |
nicklas |
manuallySelected = []; |
7387 |
31 Oct 23 |
nicklas |
var url = '&resetTemporary=1'; |
7387 |
31 Oct 23 |
nicklas |
url += '&tmpfilter:INT:itemSubtype='+subtypeAlignedSequences.id; |
7387 |
31 Oct 23 |
nicklas |
url += '&tmpfilter:STRING:'+encodeURIComponent('#')+annotationTypePipeline.id+'='+encodeURIComponent('DNA/Normal/WGS'); |
7387 |
31 Oct 23 |
nicklas |
Dialogs.selectItem('DERIVEDBIOASSAY', 'alignedSequences', 1, url); |
7387 |
31 Oct 23 |
nicklas |
76 |
} |
7387 |
31 Oct 23 |
nicklas |
77 |
|
7387 |
31 Oct 23 |
nicklas |
pon.setAlignedSequenceCallback = function(event) |
7387 |
31 Oct 23 |
nicklas |
79 |
{ |
7387 |
31 Oct 23 |
nicklas |
var ms = event.detail; |
7387 |
31 Oct 23 |
nicklas |
81 |
|
7387 |
31 Oct 23 |
nicklas |
var opt = Reggie.getListOption('alignedSequences', ms.id); |
7387 |
31 Oct 23 |
nicklas |
if (opt) |
7387 |
31 Oct 23 |
nicklas |
84 |
{ |
7387 |
31 Oct 23 |
nicklas |
opt.selected = true; |
7387 |
31 Oct 23 |
nicklas |
86 |
} |
7387 |
31 Oct 23 |
nicklas |
else |
7387 |
31 Oct 23 |
nicklas |
88 |
{ |
7387 |
31 Oct 23 |
nicklas |
manuallySelected[manuallySelected.length] = ms.id; |
7387 |
31 Oct 23 |
nicklas |
90 |
} |
7387 |
31 Oct 23 |
nicklas |
if (ms.remaining > 0) return; |
7387 |
31 Oct 23 |
nicklas |
92 |
|
7387 |
31 Oct 23 |
nicklas |
if (manuallySelected.length > 0) |
7387 |
31 Oct 23 |
nicklas |
94 |
{ |
7387 |
31 Oct 23 |
nicklas |
var url = '../WgsVariantCalling.servlet?ID='+App.getSessionId(); |
7387 |
31 Oct 23 |
nicklas |
url += '&cmd=GetAlignedSequencesForPonVariantCalling'; |
7387 |
31 Oct 23 |
nicklas |
url += '&items='+manuallySelected.join(','); |
7387 |
31 Oct 23 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
7387 |
31 Oct 23 |
nicklas |
Wizard.asyncJsonRequest(url, pon.manuallySelected); |
7387 |
31 Oct 23 |
nicklas |
100 |
} |
7387 |
31 Oct 23 |
nicklas |
else |
7387 |
31 Oct 23 |
nicklas |
102 |
{ |
7387 |
31 Oct 23 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
7387 |
31 Oct 23 |
nicklas |
104 |
} |
7387 |
31 Oct 23 |
nicklas |
105 |
} |
7387 |
31 Oct 23 |
nicklas |
106 |
|
7387 |
31 Oct 23 |
nicklas |
pon.manuallySelected = function(response) |
7387 |
31 Oct 23 |
nicklas |
108 |
{ |
7387 |
31 Oct 23 |
nicklas |
var alignedSequences = response.alignedSequences; |
7387 |
31 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7387 |
31 Oct 23 |
nicklas |
111 |
|
7387 |
31 Oct 23 |
nicklas |
if (alignedSequences != null && alignedSequences.length > 0) |
7387 |
31 Oct 23 |
nicklas |
113 |
{ |
7387 |
31 Oct 23 |
nicklas |
var offset = frm.alignedSequences.length+1; |
7387 |
31 Oct 23 |
nicklas |
for (var asNo=0; asNo < alignedSequences.length; asNo++) |
7387 |
31 Oct 23 |
nicklas |
116 |
{ |
7387 |
31 Oct 23 |
nicklas |
var as = alignedSequences[asNo]; |
7387 |
31 Oct 23 |
nicklas |
var option = pon.createListOption(asNo+offset, as, as.DO_NOT_USE == null); |
7387 |
31 Oct 23 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
7387 |
31 Oct 23 |
nicklas |
120 |
} |
7387 |
31 Oct 23 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
7387 |
31 Oct 23 |
nicklas |
122 |
} |
7387 |
31 Oct 23 |
nicklas |
123 |
} |
7387 |
31 Oct 23 |
nicklas |
124 |
|
7387 |
31 Oct 23 |
nicklas |
pon.createListOption = function(index, alignedItem, selected) |
7387 |
31 Oct 23 |
nicklas |
126 |
{ |
7387 |
31 Oct 23 |
nicklas |
var tooltip = null; |
7387 |
31 Oct 23 |
nicklas |
var lib = alignedItem.lib; |
7387 |
31 Oct 23 |
nicklas |
var name = (index) + ': ' + alignedItem.name; |
7387 |
31 Oct 23 |
nicklas |
var opt = []; |
7387 |
31 Oct 23 |
nicklas |
if (lib && lib.ExternalOperator) |
7387 |
31 Oct 23 |
nicklas |
132 |
{ |
7387 |
31 Oct 23 |
nicklas |
opt[opt.length] = Strings.encodeTags(lib.ExternalOperator); |
7387 |
31 Oct 23 |
nicklas |
134 |
} |
7387 |
31 Oct 23 |
nicklas |
if (alignedItem.MeanCoverage) |
7387 |
31 Oct 23 |
nicklas |
136 |
{ |
7387 |
31 Oct 23 |
nicklas |
opt[opt.length] = Reggie.formatNumber(alignedItem.MeanCoverage, 'X', 0); |
7387 |
31 Oct 23 |
nicklas |
138 |
} |
7387 |
31 Oct 23 |
nicklas |
if (alignedItem.DO_NOT_USE) |
7387 |
31 Oct 23 |
nicklas |
140 |
{ |
7387 |
31 Oct 23 |
nicklas |
opt[opt.length] = 'DoNotUse'; |
7387 |
31 Oct 23 |
nicklas |
tooltip = 'DoNotUse-'+Strings.encodeTags(alignedItem.DO_NOT_USE+': '+alignedItem.DO_NOT_USE_COMMENT); |
7387 |
31 Oct 23 |
nicklas |
143 |
} |
7387 |
31 Oct 23 |
nicklas |
if (opt.length > 0) |
7387 |
31 Oct 23 |
nicklas |
145 |
{ |
7387 |
31 Oct 23 |
nicklas |
name += ' ['+opt.join('; ')+']'; |
7387 |
31 Oct 23 |
nicklas |
147 |
} |
7387 |
31 Oct 23 |
nicklas |
if (alignedItem.AutoProcess == 'ReProcess') |
7387 |
31 Oct 23 |
nicklas |
149 |
{ |
7387 |
31 Oct 23 |
nicklas |
name += ' [R]'; |
7387 |
31 Oct 23 |
nicklas |
151 |
} |
7387 |
31 Oct 23 |
nicklas |
152 |
|
7387 |
31 Oct 23 |
nicklas |
var option = new Option(name, alignedItem.id, false, selected); |
7387 |
31 Oct 23 |
nicklas |
if (tooltip) option.title = tooltip; |
7387 |
31 Oct 23 |
nicklas |
option.alignedSequences = alignedItem; |
7387 |
31 Oct 23 |
nicklas |
return option; |
7387 |
31 Oct 23 |
nicklas |
157 |
} |
7387 |
31 Oct 23 |
nicklas |
158 |
|
7387 |
31 Oct 23 |
nicklas |
pon.alignedSequencesOnChange = function() |
7387 |
31 Oct 23 |
nicklas |
160 |
{ |
7387 |
31 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7387 |
31 Oct 23 |
nicklas |
162 |
|
7387 |
31 Oct 23 |
nicklas |
selectionIsValid = false; |
7387 |
31 Oct 23 |
nicklas |
var numSelected = 0; |
7387 |
31 Oct 23 |
nicklas |
var numDoNotUse = 0; |
7387 |
31 Oct 23 |
nicklas |
var invalidPipeline = null; |
7387 |
31 Oct 23 |
nicklas |
Wizard.setInputStatus('alignedSequences'); |
7387 |
31 Oct 23 |
nicklas |
Wizard.hideGoNextConfirmation(); |
7387 |
31 Oct 23 |
nicklas |
169 |
|
7387 |
31 Oct 23 |
nicklas |
for (var asNo = 0; asNo < frm.alignedSequences.length; asNo++) |
7387 |
31 Oct 23 |
nicklas |
171 |
{ |
7387 |
31 Oct 23 |
nicklas |
if (frm.alignedSequences[asNo].selected) |
7387 |
31 Oct 23 |
nicklas |
173 |
{ |
7387 |
31 Oct 23 |
nicklas |
numSelected++; |
7387 |
31 Oct 23 |
nicklas |
var as = frm.alignedSequences[asNo].alignedSequences; |
7387 |
31 Oct 23 |
nicklas |
if (as.DO_NOT_USE) numDoNotUse++; |
7387 |
31 Oct 23 |
nicklas |
if (as.pipeline && as.pipeline != 'DNA/Normal/WGS') |
7387 |
31 Oct 23 |
nicklas |
178 |
{ |
7387 |
31 Oct 23 |
nicklas |
invalidPipeline = Strings.encodeTags(as.name+' ('+as.pipeline)+') is not intended for the DNA/Normal/WGS pipeline.'; |
7387 |
31 Oct 23 |
nicklas |
180 |
} |
7387 |
31 Oct 23 |
nicklas |
181 |
} |
7387 |
31 Oct 23 |
nicklas |
182 |
} |
7387 |
31 Oct 23 |
nicklas |
183 |
|
7387 |
31 Oct 23 |
nicklas |
if (numSelected == 0) |
7387 |
31 Oct 23 |
nicklas |
185 |
{ |
7387 |
31 Oct 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', 'Select at least one item'); |
7387 |
31 Oct 23 |
nicklas |
return; |
7387 |
31 Oct 23 |
nicklas |
188 |
} |
7387 |
31 Oct 23 |
nicklas |
if (invalidPipeline) |
7387 |
31 Oct 23 |
nicklas |
190 |
{ |
7387 |
31 Oct 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', invalidPipeline); |
7387 |
31 Oct 23 |
nicklas |
return; |
7387 |
31 Oct 23 |
nicklas |
193 |
} |
7387 |
31 Oct 23 |
nicklas |
selectionIsValid = true; |
7387 |
31 Oct 23 |
nicklas |
if (numDoNotUse > 0) |
7387 |
31 Oct 23 |
nicklas |
196 |
{ |
7387 |
31 Oct 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'warning', numDoNotUse + ' selected items marked as DoNotUse'); |
7387 |
31 Oct 23 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Confirm ' + numDoNotUse + ' items marked as DoNotUse'); |
7387 |
31 Oct 23 |
nicklas |
199 |
} |
7387 |
31 Oct 23 |
nicklas |
else |
7387 |
31 Oct 23 |
nicklas |
201 |
{ |
7387 |
31 Oct 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'valid'); |
7387 |
31 Oct 23 |
nicklas |
203 |
} |
7387 |
31 Oct 23 |
nicklas |
204 |
} |
7387 |
31 Oct 23 |
nicklas |
205 |
|
7387 |
31 Oct 23 |
nicklas |
// --- Step 2 ----------------------------------- |
7387 |
31 Oct 23 |
nicklas |
pon.initializeStep2 = function() |
7387 |
31 Oct 23 |
nicklas |
208 |
{ |
7387 |
31 Oct 23 |
nicklas |
Wizard.setCurrentStep(2); |
7387 |
31 Oct 23 |
nicklas |
210 |
|
7396 |
06 Nov 23 |
nicklas |
Reggie.loadSoftware('VARIANT_CALLING_SOFTWARE', 'vcallSoftware', 'PIPELINE,VARIANT_CALL_TYPE,PARAMETER_SET', 'DNA/Normal/WGS,PanelOfNormal'); |
7396 |
06 Nov 23 |
nicklas |
212 |
|
7387 |
31 Oct 23 |
nicklas |
// Check debug by default if debug is set or not on a secure server (=production server) |
7387 |
31 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7387 |
31 Oct 23 |
nicklas |
frm.debug.checked = debug || location.protocol != 'https:'; |
7387 |
31 Oct 23 |
nicklas |
216 |
|
7387 |
31 Oct 23 |
nicklas |
// Load clusters |
7387 |
31 Oct 23 |
nicklas |
var url = '../OpenGrid.servlet?ID='+App.getSessionId() + '&cmd=GetHostInfo&config=wgs-variant-call'; |
7387 |
31 Oct 23 |
nicklas |
Doc.addClass('clusters', 'list-loading'); |
7387 |
31 Oct 23 |
nicklas |
frm.clusters[0] = new Option('loading...'); |
7387 |
31 Oct 23 |
nicklas |
Wizard.asyncJsonRequest(url, pon.clustersLoaded); |
7387 |
31 Oct 23 |
nicklas |
222 |
|
7387 |
31 Oct 23 |
nicklas |
Doc.show('goregister'); |
7387 |
31 Oct 23 |
nicklas |
Doc.show('gocancel'); |
7387 |
31 Oct 23 |
nicklas |
225 |
} |
7387 |
31 Oct 23 |
nicklas |
226 |
|
7387 |
31 Oct 23 |
nicklas |
pon.validateStep2 = function(event) |
7387 |
31 Oct 23 |
nicklas |
228 |
{ |
7387 |
31 Oct 23 |
nicklas |
if (!clusterIsValid) event.preventDefault(); |
7387 |
31 Oct 23 |
nicklas |
230 |
} |
7387 |
31 Oct 23 |
nicklas |
231 |
|
7396 |
06 Nov 23 |
nicklas |
pon.softwareOnChange = function(event) |
7396 |
06 Nov 23 |
nicklas |
233 |
{ |
7396 |
06 Nov 23 |
nicklas |
var target = event.currentTarget; |
7396 |
06 Nov 23 |
nicklas |
var item = target[target.selectedIndex].item; |
7396 |
06 Nov 23 |
nicklas |
if (!item) item = {}; |
7396 |
06 Nov 23 |
nicklas |
237 |
|
7396 |
06 Nov 23 |
nicklas |
Doc.element(target.id+'.parameterSet').innerHTML = Strings.encodeTags(item.ParameterSet || 'default'); |
7396 |
06 Nov 23 |
nicklas |
Doc.element(target.id+'.description').innerHTML = Strings.encodeTags(item.description); |
7396 |
06 Nov 23 |
nicklas |
Wizard.setInputStatus(target.id, 'valid'); |
7396 |
06 Nov 23 |
nicklas |
241 |
|
7396 |
06 Nov 23 |
nicklas |
if (item.ParameterSet) |
7396 |
06 Nov 23 |
nicklas |
243 |
{ |
7396 |
06 Nov 23 |
nicklas |
var url = '../Install.servlet?ID='+App.getSessionId(); |
7396 |
06 Nov 23 |
nicklas |
url += '&cmd=GetParameterSetInfo'; |
7396 |
06 Nov 23 |
nicklas |
url += '¶meterSet='+encodeURIComponent(item.ParameterSet); |
7396 |
06 Nov 23 |
nicklas |
url += '&targetId='+target.id; |
7396 |
06 Nov 23 |
nicklas |
Wizard.asyncJsonRequest(url, pon.parameterSetInfoLoaded); |
7396 |
06 Nov 23 |
nicklas |
249 |
} |
7396 |
06 Nov 23 |
nicklas |
pon.updateSubmitOptions(); |
7396 |
06 Nov 23 |
nicklas |
251 |
} |
7396 |
06 Nov 23 |
nicklas |
252 |
|
7396 |
06 Nov 23 |
nicklas |
pon.parameterSetInfoLoaded = function(response) |
7396 |
06 Nov 23 |
nicklas |
254 |
{ |
7396 |
06 Nov 23 |
nicklas |
if (!response.parameters || response.parameters.length == 0) |
7396 |
06 Nov 23 |
nicklas |
256 |
{ |
7396 |
06 Nov 23 |
nicklas |
Wizard.setInputStatus(response.targetId, 'warning', 'Can\'t find \'' + Strings.encodeTags(response.parameterSet) + '\' parameter set in reggie-config.xml'); |
7396 |
06 Nov 23 |
nicklas |
258 |
} |
7396 |
06 Nov 23 |
nicklas |
259 |
} |
7396 |
06 Nov 23 |
nicklas |
260 |
|
7396 |
06 Nov 23 |
nicklas |
261 |
|
7387 |
31 Oct 23 |
nicklas |
pon.clustersLoaded = function(response) |
7387 |
31 Oct 23 |
nicklas |
263 |
{ |
7387 |
31 Oct 23 |
nicklas |
Doc.removeClass('clusters', 'list-loading'); |
7387 |
31 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7387 |
31 Oct 23 |
nicklas |
var clusters = response.hosts; |
7387 |
31 Oct 23 |
nicklas |
frm.clusters.length = 0; |
7387 |
31 Oct 23 |
nicklas |
for (var i = 0; i < clusters.length; i++) |
7387 |
31 Oct 23 |
nicklas |
269 |
{ |
7387 |
31 Oct 23 |
nicklas |
var cl = clusters[i]; |
7387 |
31 Oct 23 |
nicklas |
var option = new Option(cl.connection.name, cl.id); |
7387 |
31 Oct 23 |
nicklas |
option.cluster = cl; |
7387 |
31 Oct 23 |
nicklas |
frm.clusters[frm.clusters.length] = option; |
7387 |
31 Oct 23 |
nicklas |
Wizard.setInputStatus('clusters', 'valid'); |
7387 |
31 Oct 23 |
nicklas |
clusterIsValid = true; |
7387 |
31 Oct 23 |
nicklas |
276 |
} |
7387 |
31 Oct 23 |
nicklas |
if (frm.clusters.length == 0) |
7387 |
31 Oct 23 |
nicklas |
278 |
{ |
7387 |
31 Oct 23 |
nicklas |
Wizard.setInputStatus('clusters', 'invalid', 'No available clusters'); |
7387 |
31 Oct 23 |
nicklas |
clusterIsValid = false; |
7387 |
31 Oct 23 |
nicklas |
281 |
} |
7387 |
31 Oct 23 |
nicklas |
else |
7387 |
31 Oct 23 |
nicklas |
283 |
{ |
7387 |
31 Oct 23 |
nicklas |
pon.clusterOnChange(); |
7387 |
31 Oct 23 |
nicklas |
285 |
} |
7387 |
31 Oct 23 |
nicklas |
286 |
} |
7387 |
31 Oct 23 |
nicklas |
287 |
|
7387 |
31 Oct 23 |
nicklas |
pon.clusterOnChange = function() |
7387 |
31 Oct 23 |
nicklas |
289 |
{ |
7387 |
31 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7387 |
31 Oct 23 |
nicklas |
var cluster = frm.clusters[frm.clusters.selectedIndex].cluster; |
7387 |
31 Oct 23 |
nicklas |
if (cluster.priorities && cluster.priorities.length > 0) |
7387 |
31 Oct 23 |
nicklas |
293 |
{ |
7387 |
31 Oct 23 |
nicklas |
frm.priority.length = 0; |
7387 |
31 Oct 23 |
nicklas |
for (var pNo = 0; pNo < cluster.priorities.length; pNo++) |
7387 |
31 Oct 23 |
nicklas |
296 |
{ |
7387 |
31 Oct 23 |
nicklas |
var p = cluster.priorities[pNo]; |
7387 |
31 Oct 23 |
nicklas |
frm.priority[frm.priority.length] = new Option(p.name + ' ('+p.value+')', p.value, p['default'], p['default']); |
7387 |
31 Oct 23 |
nicklas |
299 |
} |
7387 |
31 Oct 23 |
nicklas |
Doc.show('job-priority'); |
7387 |
31 Oct 23 |
nicklas |
301 |
} |
7387 |
31 Oct 23 |
nicklas |
else |
7387 |
31 Oct 23 |
nicklas |
303 |
{ |
7387 |
31 Oct 23 |
nicklas |
Doc.hide('job-priority'); |
7387 |
31 Oct 23 |
nicklas |
305 |
} |
7387 |
31 Oct 23 |
nicklas |
if (cluster.partitions && cluster.partitions.length > 0) |
7387 |
31 Oct 23 |
nicklas |
307 |
{ |
7387 |
31 Oct 23 |
nicklas |
frm.partition.length = 0; |
7387 |
31 Oct 23 |
nicklas |
for (var pNo = 0; pNo < cluster.partitions.length; pNo++) |
7387 |
31 Oct 23 |
nicklas |
310 |
{ |
7387 |
31 Oct 23 |
nicklas |
var p = cluster.partitions[pNo]; |
7387 |
31 Oct 23 |
nicklas |
var title = p.name; |
7387 |
31 Oct 23 |
nicklas |
if (p.description) title += ' ('+p.description+')'; |
7387 |
31 Oct 23 |
nicklas |
frm.partition[frm.partition.length] = new Option(title, p.value, p['default'], p['default']); |
7387 |
31 Oct 23 |
nicklas |
315 |
} |
7387 |
31 Oct 23 |
nicklas |
Doc.show('job-partition'); |
7387 |
31 Oct 23 |
nicklas |
317 |
} |
7387 |
31 Oct 23 |
nicklas |
else |
7387 |
31 Oct 23 |
nicklas |
319 |
{ |
7387 |
31 Oct 23 |
nicklas |
Doc.hide('job-partition'); |
7387 |
31 Oct 23 |
nicklas |
321 |
} |
7387 |
31 Oct 23 |
nicklas |
pon.updateSubmitOptions(); |
7387 |
31 Oct 23 |
nicklas |
323 |
} |
7387 |
31 Oct 23 |
nicklas |
324 |
|
7387 |
31 Oct 23 |
nicklas |
pon.debugOnChange = function() |
7387 |
31 Oct 23 |
nicklas |
326 |
{ |
7387 |
31 Oct 23 |
nicklas |
pon.updateSubmitOptions(); |
7387 |
31 Oct 23 |
nicklas |
328 |
} |
7387 |
31 Oct 23 |
nicklas |
329 |
|
7387 |
31 Oct 23 |
nicklas |
pon.updateSubmitOptions = function() |
7387 |
31 Oct 23 |
nicklas |
331 |
{ |
7387 |
31 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7387 |
31 Oct 23 |
nicklas |
var config = frm.clusters[frm.clusters.selectedIndex]?.cluster?.config?.['wgs-variant-call']; |
7387 |
31 Oct 23 |
nicklas |
if (config) |
7387 |
31 Oct 23 |
nicklas |
335 |
{ |
7396 |
06 Nov 23 |
nicklas |
var parameterSet = frm.vcallSoftware[frm.vcallSoftware.selectedIndex]?.item?.ParameterSet; |
7396 |
06 Nov 23 |
nicklas |
Doc.element('submitOptions').innerHTML = Reggie.getSubmitOptions(config, frm.debug.checked, parameterSet); |
7387 |
31 Oct 23 |
nicklas |
frm.override.disabled = false; |
7387 |
31 Oct 23 |
nicklas |
339 |
} |
7387 |
31 Oct 23 |
nicklas |
340 |
} |
7387 |
31 Oct 23 |
nicklas |
341 |
|
7387 |
31 Oct 23 |
nicklas |
pon.overrideOnChange = function() |
7387 |
31 Oct 23 |
nicklas |
343 |
{ |
7387 |
31 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7387 |
31 Oct 23 |
nicklas |
Doc.showHide('submitOptions', !frm.override.checked); |
7387 |
31 Oct 23 |
nicklas |
Doc.showHide('submitOptionsOverride', frm.override.checked); |
7387 |
31 Oct 23 |
nicklas |
if (frm.submitOptionsOverride.value=='') |
7387 |
31 Oct 23 |
nicklas |
348 |
{ |
7387 |
31 Oct 23 |
nicklas |
frm.submitOptionsOverride.value = Doc.element('submitOptions').innerHTML; |
7387 |
31 Oct 23 |
nicklas |
350 |
} |
7387 |
31 Oct 23 |
nicklas |
351 |
} |
7387 |
31 Oct 23 |
nicklas |
352 |
|
7387 |
31 Oct 23 |
nicklas |
353 |
|
7387 |
31 Oct 23 |
nicklas |
pon.submit = function() |
7387 |
31 Oct 23 |
nicklas |
355 |
{ |
7387 |
31 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7387 |
31 Oct 23 |
nicklas |
357 |
|
7387 |
31 Oct 23 |
nicklas |
var submitInfo = {}; |
7387 |
31 Oct 23 |
nicklas |
submitInfo.cluster = frm.clusters.value; |
7396 |
06 Nov 23 |
nicklas |
submitInfo.vcallSoftware = parseInt(frm.vcallSoftware.value); |
7387 |
31 Oct 23 |
nicklas |
if (frm.priority.selectedIndex >= 0) |
7387 |
31 Oct 23 |
nicklas |
362 |
{ |
7387 |
31 Oct 23 |
nicklas |
submitInfo.priority = parseInt(frm.priority.value); |
7387 |
31 Oct 23 |
nicklas |
364 |
} |
7387 |
31 Oct 23 |
nicklas |
if (frm.partition.selectedIndex >= 0) |
7387 |
31 Oct 23 |
nicklas |
366 |
{ |
7387 |
31 Oct 23 |
nicklas |
submitInfo.partition = frm.partition.value; |
7387 |
31 Oct 23 |
nicklas |
368 |
} |
7387 |
31 Oct 23 |
nicklas |
if (frm.override.checked) |
7387 |
31 Oct 23 |
nicklas |
370 |
{ |
7387 |
31 Oct 23 |
nicklas |
submitInfo.submitOptionsOverride = frm.submitOptionsOverride.value; |
7387 |
31 Oct 23 |
nicklas |
372 |
} |
7387 |
31 Oct 23 |
nicklas |
submitInfo.debug = frm.debug.checked; |
7387 |
31 Oct 23 |
nicklas |
submitInfo.autoConfirm = frm.autoConfirm.checked; |
7387 |
31 Oct 23 |
nicklas |
375 |
|
7387 |
31 Oct 23 |
nicklas |
var alignedSequences = []; |
7387 |
31 Oct 23 |
nicklas |
submitInfo.alignedSequences = alignedSequences; |
7387 |
31 Oct 23 |
nicklas |
378 |
|
7387 |
31 Oct 23 |
nicklas |
for (var asNo = 0; asNo < frm.alignedSequences.length; asNo++) |
7387 |
31 Oct 23 |
nicklas |
380 |
{ |
7387 |
31 Oct 23 |
nicklas |
if (frm.alignedSequences[asNo].selected) |
7387 |
31 Oct 23 |
nicklas |
382 |
{ |
7387 |
31 Oct 23 |
nicklas |
var as = {}; |
7387 |
31 Oct 23 |
nicklas |
as.id = frm.alignedSequences[asNo].alignedSequences.id; |
7387 |
31 Oct 23 |
nicklas |
alignedSequences[alignedSequences.length] = as; |
7387 |
31 Oct 23 |
nicklas |
386 |
} |
7387 |
31 Oct 23 |
nicklas |
387 |
} |
7387 |
31 Oct 23 |
nicklas |
388 |
|
7387 |
31 Oct 23 |
nicklas |
var url = '../WgsVariantCalling.servlet?ID='+App.getSessionId(); |
7387 |
31 Oct 23 |
nicklas |
url += '&cmd=StartPonVariantCalling'; |
7387 |
31 Oct 23 |
nicklas |
391 |
|
7387 |
31 Oct 23 |
nicklas |
Wizard.showLoadingAnimation('Performing registration...'); |
7387 |
31 Oct 23 |
nicklas |
Wizard.asyncJsonRequest(url, pon.submissionResults, 'POST', JSON.stringify(submitInfo)); |
7387 |
31 Oct 23 |
nicklas |
394 |
} |
7387 |
31 Oct 23 |
nicklas |
395 |
|
7387 |
31 Oct 23 |
nicklas |
pon.submissionResults = function(response) |
7387 |
31 Oct 23 |
nicklas |
397 |
{ |
7387 |
31 Oct 23 |
nicklas |
Wizard.showFinalMessage(response.messages); |
7387 |
31 Oct 23 |
nicklas |
Doc.show('gorestart'); |
7387 |
31 Oct 23 |
nicklas |
400 |
} |
7387 |
31 Oct 23 |
nicklas |
401 |
|
7387 |
31 Oct 23 |
nicklas |
return pon; |
7387 |
31 Oct 23 |
nicklas |
403 |
}(); |
7387 |
31 Oct 23 |
nicklas |
404 |
|
7387 |
31 Oct 23 |
nicklas |
Doc.onLoad(PoN.initPage); |
7387 |
31 Oct 23 |
nicklas |
406 |
|