7400 |
07 Nov 23 |
nicklas |
var VCall = function() |
7400 |
07 Nov 23 |
nicklas |
2 |
{ |
7400 |
07 Nov 23 |
nicklas |
var vcall = {}; |
7400 |
07 Nov 23 |
nicklas |
var debug = 0; |
7400 |
07 Nov 23 |
nicklas |
var selectionIsValid = false; |
7400 |
07 Nov 23 |
nicklas |
var subtypeAlignedSequences = null; |
7400 |
07 Nov 23 |
nicklas |
var annotationTypePipeline = null; |
7400 |
07 Nov 23 |
nicklas |
8 |
|
7400 |
07 Nov 23 |
nicklas |
var clusterIsValid = false; |
7400 |
07 Nov 23 |
nicklas |
var manuallySelected = []; |
7400 |
07 Nov 23 |
nicklas |
11 |
|
7400 |
07 Nov 23 |
nicklas |
// Page initialization |
7400 |
07 Nov 23 |
nicklas |
vcall.initPage = function() |
7400 |
07 Nov 23 |
nicklas |
14 |
{ |
7400 |
07 Nov 23 |
nicklas |
15 |
|
7400 |
07 Nov 23 |
nicklas |
// Step 1 |
7400 |
07 Nov 23 |
nicklas |
Buttons.addClickHandler('btnSelectAlignedSequences', vcall.selectAlignedSequences); |
7400 |
07 Nov 23 |
nicklas |
Events.addEventHandler('alignedSequences', 'base-selected', vcall.setAlignedSequenceCallback); |
7400 |
07 Nov 23 |
nicklas |
Events.addEventHandler('alignedSequences', 'change', vcall.alignedSequencesOnChange); |
7400 |
07 Nov 23 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', vcall.validateStep1); |
7400 |
07 Nov 23 |
nicklas |
21 |
|
7400 |
07 Nov 23 |
nicklas |
// Step 2 |
7400 |
07 Nov 23 |
nicklas |
Events.addEventHandler('step-2', 'wizard-initialize', vcall.initializeStep2); |
7400 |
07 Nov 23 |
nicklas |
Events.addEventHandler('step-2', 'wizard-validate', vcall.validateStep2); |
7400 |
07 Nov 23 |
nicklas |
Events.addEventHandler('clusters', 'change', vcall.clusterOnChange); |
7400 |
07 Nov 23 |
nicklas |
Events.addEventHandler('debug', 'change', vcall.debugOnChange); |
7400 |
07 Nov 23 |
nicklas |
Events.addEventHandler('override', 'change', vcall.overrideOnChange); |
7400 |
07 Nov 23 |
nicklas |
Events.addEventHandler('vcallSoftware', 'change', vcall.softwareOnChange); |
7400 |
07 Nov 23 |
nicklas |
29 |
|
7400 |
07 Nov 23 |
nicklas |
// Navigation |
7400 |
07 Nov 23 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
7400 |
07 Nov 23 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
7400 |
07 Nov 23 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
7400 |
07 Nov 23 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
7400 |
07 Nov 23 |
nicklas |
35 |
|
7400 |
07 Nov 23 |
nicklas |
// Final registration |
7400 |
07 Nov 23 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', vcall.submit); |
7400 |
07 Nov 23 |
nicklas |
38 |
|
7400 |
07 Nov 23 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
7400 |
07 Nov 23 |
nicklas |
var url = '../WgsVariantCalling.servlet?ID='+App.getSessionId(); |
7400 |
07 Nov 23 |
nicklas |
url += '&cmd=GetAlignedSequencesForVariantCalling'; |
7400 |
07 Nov 23 |
nicklas |
Wizard.asyncJsonRequest(url, vcall.initializeStep1); |
7400 |
07 Nov 23 |
nicklas |
43 |
} |
7400 |
07 Nov 23 |
nicklas |
44 |
|
7400 |
07 Nov 23 |
nicklas |
// --- Step 1 ----------------------------------- |
7400 |
07 Nov 23 |
nicklas |
vcall.initializeStep1 = function(response) |
7400 |
07 Nov 23 |
nicklas |
47 |
{ |
7400 |
07 Nov 23 |
nicklas |
var alignedSequences = response.alignedSequences; |
7400 |
07 Nov 23 |
nicklas |
var frm = document.forms['reggie']; |
7439 |
16 Nov 23 |
nicklas |
50 |
|
7439 |
16 Nov 23 |
nicklas |
var panelOfNormals = response.panelOfNormals; |
7439 |
16 Nov 23 |
nicklas |
if (panelOfNormals != null && panelOfNormals.length > 0) |
7439 |
16 Nov 23 |
nicklas |
53 |
{ |
7439 |
16 Nov 23 |
nicklas |
for (var pNo = 0; pNo < panelOfNormals.length; pNo++) |
7439 |
16 Nov 23 |
nicklas |
55 |
{ |
7439 |
16 Nov 23 |
nicklas |
var pon = panelOfNormals[pNo]; |
7439 |
16 Nov 23 |
nicklas |
frm.panelOfNormals[frm.panelOfNormals.length] = new Option(pon, pon); |
7439 |
16 Nov 23 |
nicklas |
58 |
} |
7439 |
16 Nov 23 |
nicklas |
59 |
} |
7400 |
07 Nov 23 |
nicklas |
60 |
|
7400 |
07 Nov 23 |
nicklas |
if (alignedSequences != null && alignedSequences.length > 0) |
7400 |
07 Nov 23 |
nicklas |
62 |
{ |
7400 |
07 Nov 23 |
nicklas |
for (var tumorNo=0; tumorNo < alignedSequences.length; tumorNo++) |
7400 |
07 Nov 23 |
nicklas |
64 |
{ |
7400 |
07 Nov 23 |
nicklas |
var tumor = alignedSequences[tumorNo]; |
7400 |
07 Nov 23 |
nicklas |
var numNormals = tumor.normals.length; |
7400 |
07 Nov 23 |
nicklas |
for (var normalNo=0; normalNo < numNormals; normalNo++) |
7400 |
07 Nov 23 |
nicklas |
68 |
{ |
7400 |
07 Nov 23 |
nicklas |
var normal = tumor.normals[normalNo]; |
7400 |
07 Nov 23 |
nicklas |
var option = vcall.createListOption(tumorNo+1, numNormals == 1 ? null : normalNo+1, tumor, normal, tumor.DO_NOT_USE == null && normal.DO_NOT_USE==null); |
7400 |
07 Nov 23 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
7400 |
07 Nov 23 |
nicklas |
72 |
} |
7400 |
07 Nov 23 |
nicklas |
if (numNormals == 0) |
7400 |
07 Nov 23 |
nicklas |
74 |
{ |
7400 |
07 Nov 23 |
nicklas |
var option = vcall.createListOption(tumorNo+1, null, tumor, null, false); |
7400 |
07 Nov 23 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
7400 |
07 Nov 23 |
nicklas |
77 |
} |
7400 |
07 Nov 23 |
nicklas |
78 |
} |
7400 |
07 Nov 23 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
7400 |
07 Nov 23 |
nicklas |
80 |
} |
7400 |
07 Nov 23 |
nicklas |
else |
7400 |
07 Nov 23 |
nicklas |
82 |
{ |
7400 |
07 Nov 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', 'No new sequences available for processing'); |
7400 |
07 Nov 23 |
nicklas |
84 |
} |
7400 |
07 Nov 23 |
nicklas |
85 |
|
7400 |
07 Nov 23 |
nicklas |
Doc.show('step-1'); |
7400 |
07 Nov 23 |
nicklas |
Doc.show('gonext'); |
7400 |
07 Nov 23 |
nicklas |
88 |
|
7400 |
07 Nov 23 |
nicklas |
frm.alignedSequences.focus(); |
7400 |
07 Nov 23 |
nicklas |
90 |
} |
7400 |
07 Nov 23 |
nicklas |
91 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.validateStep1 = function(event) |
7400 |
07 Nov 23 |
nicklas |
93 |
{ |
7400 |
07 Nov 23 |
nicklas |
if (!selectionIsValid) event.preventDefault(); |
7400 |
07 Nov 23 |
nicklas |
95 |
} |
7400 |
07 Nov 23 |
nicklas |
96 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.selectAlignedSequences = function() |
7400 |
07 Nov 23 |
nicklas |
98 |
{ |
7400 |
07 Nov 23 |
nicklas |
var frm = document.forms['reggie']; |
7400 |
07 Nov 23 |
nicklas |
if (frm.alignedSequences.disabled) return; |
7400 |
07 Nov 23 |
nicklas |
101 |
|
7400 |
07 Nov 23 |
nicklas |
if (subtypeAlignedSequences == null) |
7400 |
07 Nov 23 |
nicklas |
103 |
{ |
7400 |
07 Nov 23 |
nicklas |
subtypeAlignedSequences = Reggie.getSubtypeInfo('ALIGNED_SEQUENCES'); |
7400 |
07 Nov 23 |
nicklas |
105 |
} |
7400 |
07 Nov 23 |
nicklas |
if (annotationTypePipeline == null) |
7400 |
07 Nov 23 |
nicklas |
107 |
{ |
7400 |
07 Nov 23 |
nicklas |
annotationTypePipeline = Reggie.getAnnotationTypeInfo('PIPELINE'); |
7400 |
07 Nov 23 |
nicklas |
109 |
} |
7400 |
07 Nov 23 |
nicklas |
110 |
|
7400 |
07 Nov 23 |
nicklas |
// Reset list |
7400 |
07 Nov 23 |
nicklas |
manuallySelected = []; |
7400 |
07 Nov 23 |
nicklas |
var url = '&resetTemporary=1'; |
7400 |
07 Nov 23 |
nicklas |
// Alignments in the 'DNA/Tumor/WGS' pipeline |
7400 |
07 Nov 23 |
nicklas |
url += '&tmpfilter:INT:itemSubtype='+subtypeAlignedSequences.id; |
7400 |
07 Nov 23 |
nicklas |
url += '&tmpfilter:STRING:'+encodeURIComponent('#')+annotationTypePipeline.id+'='+encodeURIComponent('DNA/Tumor/WGS'); |
7400 |
07 Nov 23 |
nicklas |
117 |
|
7400 |
07 Nov 23 |
nicklas |
Dialogs.selectItem('DERIVEDBIOASSAY', 'alignedSequences', 1, url); |
7400 |
07 Nov 23 |
nicklas |
119 |
} |
7400 |
07 Nov 23 |
nicklas |
120 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.setAlignedSequenceCallback = function(event) |
7400 |
07 Nov 23 |
nicklas |
122 |
{ |
7400 |
07 Nov 23 |
nicklas |
var ms = event.detail; |
7400 |
07 Nov 23 |
nicklas |
124 |
|
7400 |
07 Nov 23 |
nicklas |
var opt = Reggie.getListOption('alignedSequences', ms.id); |
7400 |
07 Nov 23 |
nicklas |
if (opt) |
7400 |
07 Nov 23 |
nicklas |
127 |
{ |
7400 |
07 Nov 23 |
nicklas |
opt.selected = true; |
7400 |
07 Nov 23 |
nicklas |
129 |
} |
7400 |
07 Nov 23 |
nicklas |
else |
7400 |
07 Nov 23 |
nicklas |
131 |
{ |
7400 |
07 Nov 23 |
nicklas |
manuallySelected[manuallySelected.length] = ms.id; |
7400 |
07 Nov 23 |
nicklas |
133 |
} |
7400 |
07 Nov 23 |
nicklas |
134 |
|
7400 |
07 Nov 23 |
nicklas |
if (ms.remaining > 0) return; |
7400 |
07 Nov 23 |
nicklas |
136 |
|
7400 |
07 Nov 23 |
nicklas |
if (manuallySelected.length > 0) |
7400 |
07 Nov 23 |
nicklas |
138 |
{ |
7400 |
07 Nov 23 |
nicklas |
var url = '../WgsVariantCalling.servlet?ID='+App.getSessionId(); |
7400 |
07 Nov 23 |
nicklas |
url += '&cmd=GetAlignedSequencesForVariantCalling'; |
7400 |
07 Nov 23 |
nicklas |
url += '&items='+manuallySelected.join(','); |
7400 |
07 Nov 23 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
7400 |
07 Nov 23 |
nicklas |
Wizard.asyncJsonRequest(url, vcall.manuallySelected); |
7400 |
07 Nov 23 |
nicklas |
144 |
} |
7400 |
07 Nov 23 |
nicklas |
else |
7400 |
07 Nov 23 |
nicklas |
146 |
{ |
7400 |
07 Nov 23 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
7400 |
07 Nov 23 |
nicklas |
148 |
} |
7400 |
07 Nov 23 |
nicklas |
149 |
} |
7400 |
07 Nov 23 |
nicklas |
150 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.manuallySelected = function(response) |
7400 |
07 Nov 23 |
nicklas |
152 |
{ |
7400 |
07 Nov 23 |
nicklas |
var alignedSequences = response.alignedSequences; |
7400 |
07 Nov 23 |
nicklas |
var frm = document.forms['reggie']; |
7400 |
07 Nov 23 |
nicklas |
155 |
|
7400 |
07 Nov 23 |
nicklas |
if (alignedSequences != null && alignedSequences.length > 0) |
7400 |
07 Nov 23 |
nicklas |
157 |
{ |
7400 |
07 Nov 23 |
nicklas |
var offset = frm.alignedSequences.length+1; |
7400 |
07 Nov 23 |
nicklas |
for (var tumorNo=0; tumorNo < alignedSequences.length; tumorNo++) |
7400 |
07 Nov 23 |
nicklas |
160 |
{ |
7400 |
07 Nov 23 |
nicklas |
var tumor = alignedSequences[tumorNo]; |
7400 |
07 Nov 23 |
nicklas |
var numNormals = tumor.normals.length; |
7400 |
07 Nov 23 |
nicklas |
for (var normalNo=0; normalNo < numNormals; normalNo++) |
7400 |
07 Nov 23 |
nicklas |
164 |
{ |
7400 |
07 Nov 23 |
nicklas |
var normal = tumor.normals[normalNo]; |
7400 |
07 Nov 23 |
nicklas |
var option = vcall.createListOption(tumorNo+offset, numNormals == 1 ? null : normalNo+1, tumor, normal, tumor.DO_NOT_USE == null && normal.DO_NOT_USE==null); |
7400 |
07 Nov 23 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
7400 |
07 Nov 23 |
nicklas |
168 |
} |
7400 |
07 Nov 23 |
nicklas |
if (numNormals == 0) |
7400 |
07 Nov 23 |
nicklas |
170 |
{ |
7400 |
07 Nov 23 |
nicklas |
var option = vcall.createListOption(tumorNo+offset, null, tumor, null, false); |
7400 |
07 Nov 23 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
7400 |
07 Nov 23 |
nicklas |
173 |
} |
7400 |
07 Nov 23 |
nicklas |
174 |
} |
7400 |
07 Nov 23 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
7400 |
07 Nov 23 |
nicklas |
176 |
} |
7400 |
07 Nov 23 |
nicklas |
177 |
} |
7400 |
07 Nov 23 |
nicklas |
178 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.createListOption = function(indexTumor, indexNormal, tumor, normal, selected) |
7400 |
07 Nov 23 |
nicklas |
180 |
{ |
7400 |
07 Nov 23 |
nicklas |
var tooltip = null; |
7439 |
16 Nov 23 |
nicklas |
var name = indexTumor+(indexNormal!=null ? '.'+indexNormal : '')+': ' + tumor.name; |
7400 |
07 Nov 23 |
nicklas |
183 |
|
7439 |
16 Nov 23 |
nicklas |
if (tumor.lib && tumor.lib.ExternalOperator) |
7439 |
16 Nov 23 |
nicklas |
185 |
{ |
7439 |
16 Nov 23 |
nicklas |
name += ' ['+tumor.lib.ExternalOperator+']'; |
7439 |
16 Nov 23 |
nicklas |
187 |
} |
7439 |
16 Nov 23 |
nicklas |
name += ' - '+(normal ? normal.name : 'missing normal'); |
7439 |
16 Nov 23 |
nicklas |
189 |
|
7400 |
07 Nov 23 |
nicklas |
if (!normal) |
7400 |
07 Nov 23 |
nicklas |
191 |
{ |
7400 |
07 Nov 23 |
nicklas |
tooltip = 'Could not find a matching normal alignment'; |
7400 |
07 Nov 23 |
nicklas |
193 |
} |
7400 |
07 Nov 23 |
nicklas |
else if (tumor.DO_NOT_USE || normal.DO_NOT_USE) |
7400 |
07 Nov 23 |
nicklas |
195 |
{ |
7400 |
07 Nov 23 |
nicklas |
name += ' [DoNotUse]'; |
7400 |
07 Nov 23 |
nicklas |
var dn = tumor.DO_NOT_USE ? tumor : normal; |
7400 |
07 Nov 23 |
nicklas |
tooltip = '['+(dn==tumor?'Tumor':'Normal')+'] DoNotUse-'+Strings.encodeTags(dn.DO_NOT_USE+': '+dn.DO_NOT_USE_COMMENT); |
7400 |
07 Nov 23 |
nicklas |
199 |
} |
7400 |
07 Nov 23 |
nicklas |
else if (tumor.AutoProcess == 'ReProcess') |
7400 |
07 Nov 23 |
nicklas |
201 |
{ |
7400 |
07 Nov 23 |
nicklas |
name += ' [R]'; |
7400 |
07 Nov 23 |
nicklas |
203 |
} |
7400 |
07 Nov 23 |
nicklas |
204 |
|
7400 |
07 Nov 23 |
nicklas |
var option = new Option(name, tumor.id, false, selected); |
7400 |
07 Nov 23 |
nicklas |
if (tooltip) option.title = tooltip; |
7400 |
07 Nov 23 |
nicklas |
option.tumor = tumor; |
7400 |
07 Nov 23 |
nicklas |
option.normal = normal; |
7400 |
07 Nov 23 |
nicklas |
if (!normal) option.disabled = true; |
7400 |
07 Nov 23 |
nicklas |
return option; |
7400 |
07 Nov 23 |
nicklas |
211 |
} |
7400 |
07 Nov 23 |
nicklas |
212 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.alignedSequencesOnChange = function() |
7400 |
07 Nov 23 |
nicklas |
214 |
{ |
7400 |
07 Nov 23 |
nicklas |
var frm = document.forms['reggie']; |
7400 |
07 Nov 23 |
nicklas |
selectionIsValid = false; |
7400 |
07 Nov 23 |
nicklas |
var numSelected = 0; |
7400 |
07 Nov 23 |
nicklas |
var numDoNotUse = 0; |
7400 |
07 Nov 23 |
nicklas |
var invalidSelection = null; |
7400 |
07 Nov 23 |
nicklas |
Wizard.setInputStatus('alignedSequences'); |
7400 |
07 Nov 23 |
nicklas |
Wizard.hideGoNextConfirmation(); |
7400 |
07 Nov 23 |
nicklas |
222 |
|
7400 |
07 Nov 23 |
nicklas |
for (var asNo = 0; asNo < frm.alignedSequences.length; asNo++) |
7400 |
07 Nov 23 |
nicklas |
224 |
{ |
7400 |
07 Nov 23 |
nicklas |
if (frm.alignedSequences[asNo].selected) |
7400 |
07 Nov 23 |
nicklas |
226 |
{ |
7400 |
07 Nov 23 |
nicklas |
numSelected++; |
7400 |
07 Nov 23 |
nicklas |
var tumor = frm.alignedSequences[asNo].tumor; |
7400 |
07 Nov 23 |
nicklas |
var normal = frm.alignedSequences[asNo].normal; |
7400 |
07 Nov 23 |
nicklas |
if (tumor.DO_NOT_USE || normal && normal.DO_NOT_USE) numDoNotUse++; |
7400 |
07 Nov 23 |
nicklas |
if (!normal) |
7400 |
07 Nov 23 |
nicklas |
232 |
{ |
7400 |
07 Nov 23 |
nicklas |
invalidSelection = Strings.encodeTags(tumor.name+' has not matched normal alignment'); |
7400 |
07 Nov 23 |
nicklas |
234 |
} |
7400 |
07 Nov 23 |
nicklas |
else if (tumor.pipeline && tumor.pipeline != 'DNA/Tumor/WGS') |
7400 |
07 Nov 23 |
nicklas |
236 |
{ |
7400 |
07 Nov 23 |
nicklas |
invalidSelection = Strings.encodeTags(tumor.name+' ('+tumor.pipeline)+') is not intended for the DNA/Tumor/WGS pipeline.'; |
7400 |
07 Nov 23 |
nicklas |
238 |
} |
7400 |
07 Nov 23 |
nicklas |
239 |
} |
7400 |
07 Nov 23 |
nicklas |
240 |
} |
7400 |
07 Nov 23 |
nicklas |
241 |
|
7400 |
07 Nov 23 |
nicklas |
if (numSelected == 0) |
7400 |
07 Nov 23 |
nicklas |
243 |
{ |
7400 |
07 Nov 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', 'Select at least one item'); |
7400 |
07 Nov 23 |
nicklas |
return; |
7400 |
07 Nov 23 |
nicklas |
246 |
} |
7400 |
07 Nov 23 |
nicklas |
if (invalidSelection) |
7400 |
07 Nov 23 |
nicklas |
248 |
{ |
7400 |
07 Nov 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', invalidSelection); |
7400 |
07 Nov 23 |
nicklas |
return; |
7400 |
07 Nov 23 |
nicklas |
251 |
} |
7400 |
07 Nov 23 |
nicklas |
selectionIsValid = true; |
7400 |
07 Nov 23 |
nicklas |
253 |
|
7400 |
07 Nov 23 |
nicklas |
if (numDoNotUse > 0) |
7400 |
07 Nov 23 |
nicklas |
255 |
{ |
7400 |
07 Nov 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'warning', numDoNotUse + ' selected items marked as DoNotUse'); |
7400 |
07 Nov 23 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Confirm ' + numDoNotUse + ' items marked as DoNotUse'); |
7400 |
07 Nov 23 |
nicklas |
258 |
} |
7400 |
07 Nov 23 |
nicklas |
else |
7400 |
07 Nov 23 |
nicklas |
260 |
{ |
7400 |
07 Nov 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'valid'); |
7400 |
07 Nov 23 |
nicklas |
262 |
} |
7400 |
07 Nov 23 |
nicklas |
263 |
} |
7400 |
07 Nov 23 |
nicklas |
264 |
|
7400 |
07 Nov 23 |
nicklas |
// --- Step 2 ----------------------------------- |
7400 |
07 Nov 23 |
nicklas |
vcall.initializeStep2 = function() |
7400 |
07 Nov 23 |
nicklas |
267 |
{ |
7400 |
07 Nov 23 |
nicklas |
Wizard.setCurrentStep(2); |
7400 |
07 Nov 23 |
nicklas |
269 |
|
7400 |
07 Nov 23 |
nicklas |
// Check debug by default if debug is set or not on a secure server (=production server) |
7400 |
07 Nov 23 |
nicklas |
var frm = document.forms['reggie']; |
7400 |
07 Nov 23 |
nicklas |
frm.debug.checked = debug || location.protocol != 'https:'; |
7400 |
07 Nov 23 |
nicklas |
273 |
|
7400 |
07 Nov 23 |
nicklas |
Reggie.loadSoftware('VARIANT_CALLING_SOFTWARE', 'vcallSoftware', 'VARIANT_CALL_TYPE,PIPELINE,PARAMETER_SET', 'VariantCall,DNA/Tumor/WGS'); |
7400 |
07 Nov 23 |
nicklas |
275 |
|
7400 |
07 Nov 23 |
nicklas |
// Load clusters |
7400 |
07 Nov 23 |
nicklas |
var url = '../OpenGrid.servlet?ID='+App.getSessionId() + '&cmd=GetHostInfo&config=wgs-variant-call'; |
7400 |
07 Nov 23 |
nicklas |
Doc.addClass('clusters', 'list-loading'); |
7400 |
07 Nov 23 |
nicklas |
frm.clusters[0] = new Option('loading...'); |
7400 |
07 Nov 23 |
nicklas |
Wizard.asyncJsonRequest(url, vcall.clustersLoaded); |
7400 |
07 Nov 23 |
nicklas |
281 |
|
7400 |
07 Nov 23 |
nicklas |
Doc.show('goregister'); |
7400 |
07 Nov 23 |
nicklas |
Doc.show('gocancel'); |
7400 |
07 Nov 23 |
nicklas |
284 |
} |
7400 |
07 Nov 23 |
nicklas |
285 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.validateStep2 = function(event) |
7400 |
07 Nov 23 |
nicklas |
287 |
{ |
7400 |
07 Nov 23 |
nicklas |
if (!clusterIsValid) event.preventDefault(); |
7400 |
07 Nov 23 |
nicklas |
289 |
} |
7400 |
07 Nov 23 |
nicklas |
290 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.clustersLoaded = function(response) |
7400 |
07 Nov 23 |
nicklas |
292 |
{ |
7400 |
07 Nov 23 |
nicklas |
Doc.removeClass('clusters', 'list-loading'); |
7400 |
07 Nov 23 |
nicklas |
var frm = document.forms['reggie']; |
7400 |
07 Nov 23 |
nicklas |
var clusters = response.hosts; |
7400 |
07 Nov 23 |
nicklas |
frm.clusters.length = 0; |
7400 |
07 Nov 23 |
nicklas |
for (var i = 0; i < clusters.length; i++) |
7400 |
07 Nov 23 |
nicklas |
298 |
{ |
7400 |
07 Nov 23 |
nicklas |
var cl = clusters[i]; |
7400 |
07 Nov 23 |
nicklas |
var option = new Option(cl.connection.name, cl.id); |
7400 |
07 Nov 23 |
nicklas |
option.cluster = cl; |
7400 |
07 Nov 23 |
nicklas |
frm.clusters[frm.clusters.length] = option; |
7400 |
07 Nov 23 |
nicklas |
Wizard.setInputStatus('clusters', 'valid'); |
7400 |
07 Nov 23 |
nicklas |
clusterIsValid = true; |
7400 |
07 Nov 23 |
nicklas |
305 |
} |
7400 |
07 Nov 23 |
nicklas |
if (frm.clusters.length == 0) |
7400 |
07 Nov 23 |
nicklas |
307 |
{ |
7400 |
07 Nov 23 |
nicklas |
Wizard.setInputStatus('clusters', 'invalid', 'No available clusters'); |
7400 |
07 Nov 23 |
nicklas |
clusterIsValid = false; |
7400 |
07 Nov 23 |
nicklas |
310 |
} |
7400 |
07 Nov 23 |
nicklas |
else |
7400 |
07 Nov 23 |
nicklas |
312 |
{ |
7400 |
07 Nov 23 |
nicklas |
vcall.clusterOnChange(); |
7400 |
07 Nov 23 |
nicklas |
314 |
} |
7400 |
07 Nov 23 |
nicklas |
315 |
} |
7400 |
07 Nov 23 |
nicklas |
316 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.softwareOnChange = function(event) |
7400 |
07 Nov 23 |
nicklas |
318 |
{ |
7400 |
07 Nov 23 |
nicklas |
var target = event.currentTarget; |
7400 |
07 Nov 23 |
nicklas |
var item = target[target.selectedIndex].item; |
7400 |
07 Nov 23 |
nicklas |
if (!item) item = {}; |
7400 |
07 Nov 23 |
nicklas |
322 |
|
7400 |
07 Nov 23 |
nicklas |
Doc.element(target.id+'.parameterSet').innerHTML = Strings.encodeTags(item.ParameterSet || 'default'); |
7400 |
07 Nov 23 |
nicklas |
Doc.element(target.id+'.description').innerHTML = Strings.encodeTags(item.description); |
7400 |
07 Nov 23 |
nicklas |
Wizard.setInputStatus(target.id, 'valid'); |
7400 |
07 Nov 23 |
nicklas |
326 |
|
7400 |
07 Nov 23 |
nicklas |
if (item.ParameterSet) |
7400 |
07 Nov 23 |
nicklas |
328 |
{ |
7400 |
07 Nov 23 |
nicklas |
var url = '../Install.servlet?ID='+App.getSessionId(); |
7400 |
07 Nov 23 |
nicklas |
url += '&cmd=GetParameterSetInfo'; |
7400 |
07 Nov 23 |
nicklas |
url += '¶meterSet='+encodeURIComponent(item.ParameterSet); |
7400 |
07 Nov 23 |
nicklas |
url += '&targetId='+target.id; |
7400 |
07 Nov 23 |
nicklas |
Wizard.asyncJsonRequest(url, vcall.parameterSetInfoLoaded); |
7400 |
07 Nov 23 |
nicklas |
334 |
} |
7400 |
07 Nov 23 |
nicklas |
vcall.updateSubmitOptions(); |
7400 |
07 Nov 23 |
nicklas |
336 |
} |
7400 |
07 Nov 23 |
nicklas |
337 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.parameterSetInfoLoaded = function(response) |
7400 |
07 Nov 23 |
nicklas |
339 |
{ |
7400 |
07 Nov 23 |
nicklas |
if (!response.parameters || response.parameters.length == 0) |
7400 |
07 Nov 23 |
nicklas |
341 |
{ |
7400 |
07 Nov 23 |
nicklas |
Wizard.setInputStatus(response.targetId, 'warning', 'Can\'t find \'' + Strings.encodeTags(response.parameterSet) + '\' parameter set in reggie-config.xml'); |
7400 |
07 Nov 23 |
nicklas |
343 |
} |
7400 |
07 Nov 23 |
nicklas |
344 |
} |
7400 |
07 Nov 23 |
nicklas |
345 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.clusterOnChange = function() |
7400 |
07 Nov 23 |
nicklas |
347 |
{ |
7400 |
07 Nov 23 |
nicklas |
var frm = document.forms['reggie']; |
7400 |
07 Nov 23 |
nicklas |
var cluster = frm.clusters[frm.clusters.selectedIndex].cluster; |
7400 |
07 Nov 23 |
nicklas |
if (cluster.priorities && cluster.priorities.length > 0) |
7400 |
07 Nov 23 |
nicklas |
351 |
{ |
7400 |
07 Nov 23 |
nicklas |
frm.priority.length = 0; |
7400 |
07 Nov 23 |
nicklas |
for (var pNo = 0; pNo < cluster.priorities.length; pNo++) |
7400 |
07 Nov 23 |
nicklas |
354 |
{ |
7400 |
07 Nov 23 |
nicklas |
var p = cluster.priorities[pNo]; |
7400 |
07 Nov 23 |
nicklas |
frm.priority[frm.priority.length] = new Option(p.name + ' ('+p.value+')', p.value, p['default'], p['default']); |
7400 |
07 Nov 23 |
nicklas |
357 |
} |
7400 |
07 Nov 23 |
nicklas |
Doc.show('job-priority'); |
7400 |
07 Nov 23 |
nicklas |
359 |
} |
7400 |
07 Nov 23 |
nicklas |
else |
7400 |
07 Nov 23 |
nicklas |
361 |
{ |
7400 |
07 Nov 23 |
nicklas |
Doc.hide('job-priority'); |
7400 |
07 Nov 23 |
nicklas |
363 |
} |
7400 |
07 Nov 23 |
nicklas |
if (cluster.partitions && cluster.partitions.length > 0) |
7400 |
07 Nov 23 |
nicklas |
365 |
{ |
7400 |
07 Nov 23 |
nicklas |
frm.partition.length = 0; |
7400 |
07 Nov 23 |
nicklas |
for (var pNo = 0; pNo < cluster.partitions.length; pNo++) |
7400 |
07 Nov 23 |
nicklas |
368 |
{ |
7400 |
07 Nov 23 |
nicklas |
var p = cluster.partitions[pNo]; |
7400 |
07 Nov 23 |
nicklas |
var title = p.name; |
7400 |
07 Nov 23 |
nicklas |
if (p.description) title += ' ('+p.description+')'; |
7400 |
07 Nov 23 |
nicklas |
frm.partition[frm.partition.length] = new Option(title, p.value, p['default'], p['default']); |
7400 |
07 Nov 23 |
nicklas |
373 |
} |
7400 |
07 Nov 23 |
nicklas |
Doc.show('job-partition'); |
7400 |
07 Nov 23 |
nicklas |
375 |
} |
7400 |
07 Nov 23 |
nicklas |
else |
7400 |
07 Nov 23 |
nicklas |
377 |
{ |
7400 |
07 Nov 23 |
nicklas |
Doc.hide('job-partition'); |
7400 |
07 Nov 23 |
nicklas |
379 |
} |
7400 |
07 Nov 23 |
nicklas |
vcall.updateSubmitOptions(); |
7400 |
07 Nov 23 |
nicklas |
381 |
} |
7400 |
07 Nov 23 |
nicklas |
382 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.debugOnChange = function() |
7400 |
07 Nov 23 |
nicklas |
384 |
{ |
7400 |
07 Nov 23 |
nicklas |
vcall.updateSubmitOptions(); |
7400 |
07 Nov 23 |
nicklas |
386 |
} |
7400 |
07 Nov 23 |
nicklas |
387 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.updateSubmitOptions = function() |
7400 |
07 Nov 23 |
nicklas |
389 |
{ |
7400 |
07 Nov 23 |
nicklas |
var frm = document.forms['reggie']; |
7400 |
07 Nov 23 |
nicklas |
var config = frm.clusters[frm.clusters.selectedIndex]?.cluster?.config?.['wgs-variant-call']; |
7400 |
07 Nov 23 |
nicklas |
if (config) |
7400 |
07 Nov 23 |
nicklas |
393 |
{ |
7400 |
07 Nov 23 |
nicklas |
var parameterSet = frm.vcallSoftware[frm.vcallSoftware.selectedIndex]?.item?.ParameterSet; |
7400 |
07 Nov 23 |
nicklas |
Doc.element('submitOptions').innerHTML = Reggie.getSubmitOptions(config, frm.debug.checked, parameterSet); |
7400 |
07 Nov 23 |
nicklas |
frm.override.disabled = false; |
7400 |
07 Nov 23 |
nicklas |
397 |
} |
7400 |
07 Nov 23 |
nicklas |
398 |
} |
7400 |
07 Nov 23 |
nicklas |
399 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.overrideOnChange = function() |
7400 |
07 Nov 23 |
nicklas |
401 |
{ |
7400 |
07 Nov 23 |
nicklas |
var frm = document.forms['reggie']; |
7400 |
07 Nov 23 |
nicklas |
Doc.showHide('submitOptions', !frm.override.checked); |
7400 |
07 Nov 23 |
nicklas |
Doc.showHide('submitOptionsOverride', frm.override.checked); |
7400 |
07 Nov 23 |
nicklas |
if (frm.submitOptionsOverride.value=='') |
7400 |
07 Nov 23 |
nicklas |
406 |
{ |
7400 |
07 Nov 23 |
nicklas |
frm.submitOptionsOverride.value = Doc.element('submitOptions').innerHTML; |
7400 |
07 Nov 23 |
nicklas |
408 |
} |
7400 |
07 Nov 23 |
nicklas |
409 |
} |
7400 |
07 Nov 23 |
nicklas |
410 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.submit = function() |
7400 |
07 Nov 23 |
nicklas |
412 |
{ |
7400 |
07 Nov 23 |
nicklas |
var frm = document.forms['reggie']; |
7400 |
07 Nov 23 |
nicklas |
414 |
|
7400 |
07 Nov 23 |
nicklas |
var submitInfo = {}; |
7439 |
16 Nov 23 |
nicklas |
submitInfo.panelOfNormals = frm.panelOfNormals.value; |
7400 |
07 Nov 23 |
nicklas |
submitInfo.vcallSoftware = parseInt(frm.vcallSoftware.value); |
7400 |
07 Nov 23 |
nicklas |
submitInfo.cluster = frm.clusters.value; |
7400 |
07 Nov 23 |
nicklas |
if (frm.priority.selectedIndex >= 0) |
7400 |
07 Nov 23 |
nicklas |
420 |
{ |
7400 |
07 Nov 23 |
nicklas |
submitInfo.priority = parseInt(frm.priority.value); |
7400 |
07 Nov 23 |
nicklas |
422 |
} |
7400 |
07 Nov 23 |
nicklas |
if (frm.partition.selectedIndex >= 0) |
7400 |
07 Nov 23 |
nicklas |
424 |
{ |
7400 |
07 Nov 23 |
nicklas |
submitInfo.partition = frm.partition.value; |
7400 |
07 Nov 23 |
nicklas |
426 |
} |
7400 |
07 Nov 23 |
nicklas |
if (frm.override.checked) |
7400 |
07 Nov 23 |
nicklas |
428 |
{ |
7400 |
07 Nov 23 |
nicklas |
submitInfo.submitOptionsOverride = frm.submitOptionsOverride.value; |
7400 |
07 Nov 23 |
nicklas |
430 |
} |
7400 |
07 Nov 23 |
nicklas |
submitInfo.debug = frm.debug.checked; |
7400 |
07 Nov 23 |
nicklas |
submitInfo.autoConfirm = frm.autoConfirm.checked; |
7400 |
07 Nov 23 |
nicklas |
433 |
|
7400 |
07 Nov 23 |
nicklas |
var alignedSequences = []; |
7400 |
07 Nov 23 |
nicklas |
submitInfo.alignedSequences = alignedSequences; |
7400 |
07 Nov 23 |
nicklas |
436 |
|
7400 |
07 Nov 23 |
nicklas |
for (var asNo = 0; asNo < frm.alignedSequences.length; asNo++) |
7400 |
07 Nov 23 |
nicklas |
438 |
{ |
7400 |
07 Nov 23 |
nicklas |
if (frm.alignedSequences[asNo].selected) |
7400 |
07 Nov 23 |
nicklas |
440 |
{ |
7400 |
07 Nov 23 |
nicklas |
var tumor = frm.alignedSequences[asNo].tumor; |
7400 |
07 Nov 23 |
nicklas |
var normal = frm.alignedSequences[asNo].normal; |
7400 |
07 Nov 23 |
nicklas |
443 |
|
7400 |
07 Nov 23 |
nicklas |
var pair = {}; |
7400 |
07 Nov 23 |
nicklas |
pair.tumorId = tumor.id; |
7400 |
07 Nov 23 |
nicklas |
pair.normalId = normal.id; |
7400 |
07 Nov 23 |
nicklas |
alignedSequences[alignedSequences.length] = pair; |
7400 |
07 Nov 23 |
nicklas |
448 |
} |
7400 |
07 Nov 23 |
nicklas |
449 |
} |
7400 |
07 Nov 23 |
nicklas |
450 |
|
7400 |
07 Nov 23 |
nicklas |
var url = '../WgsVariantCalling.servlet?ID='+App.getSessionId(); |
7400 |
07 Nov 23 |
nicklas |
url += '&cmd=StartVariantCalling'; |
7400 |
07 Nov 23 |
nicklas |
453 |
|
7400 |
07 Nov 23 |
nicklas |
Wizard.showLoadingAnimation('Performing registration...'); |
7400 |
07 Nov 23 |
nicklas |
Wizard.asyncJsonRequest(url, vcall.submissionResults, 'POST', JSON.stringify(submitInfo)); |
7400 |
07 Nov 23 |
nicklas |
456 |
} |
7400 |
07 Nov 23 |
nicklas |
457 |
|
7400 |
07 Nov 23 |
nicklas |
vcall.submissionResults = function(response) |
7400 |
07 Nov 23 |
nicklas |
459 |
{ |
7400 |
07 Nov 23 |
nicklas |
Wizard.showFinalMessage(response.messages); |
7400 |
07 Nov 23 |
nicklas |
Doc.show('gorestart'); |
7400 |
07 Nov 23 |
nicklas |
462 |
} |
7400 |
07 Nov 23 |
nicklas |
463 |
|
7400 |
07 Nov 23 |
nicklas |
return vcall; |
7400 |
07 Nov 23 |
nicklas |
465 |
}(); |
7400 |
07 Nov 23 |
nicklas |
466 |
|
7400 |
07 Nov 23 |
nicklas |
Doc.onLoad(VCall.initPage); |
7400 |
07 Nov 23 |
nicklas |
468 |
|