7267 |
21 Jun 23 |
nicklas |
var Ascat = function() |
7267 |
21 Jun 23 |
nicklas |
2 |
{ |
7267 |
21 Jun 23 |
nicklas |
var ascat = {}; |
7267 |
21 Jun 23 |
nicklas |
var debug = 0; |
7267 |
21 Jun 23 |
nicklas |
var selectionIsValid = false; |
7267 |
21 Jun 23 |
nicklas |
var subtypeAlignedSequences = null; |
7267 |
21 Jun 23 |
nicklas |
var annotationTypePipeline = null; |
7267 |
21 Jun 23 |
nicklas |
8 |
|
7279 |
11 Aug 23 |
nicklas |
var tauIsValid = true; |
7279 |
11 Aug 23 |
nicklas |
var rhoIsValid = true; |
7279 |
11 Aug 23 |
nicklas |
var psiIsValid = true; |
7341 |
11 Sep 23 |
nicklas |
var penaltyIsValid = true; |
7341 |
11 Sep 23 |
nicklas |
var minDepthIsValid = true; |
7279 |
11 Aug 23 |
nicklas |
14 |
|
7267 |
21 Jun 23 |
nicklas |
var clusterIsValid = false; |
7267 |
21 Jun 23 |
nicklas |
var manuallySelected = []; |
7267 |
21 Jun 23 |
nicklas |
17 |
|
7267 |
21 Jun 23 |
nicklas |
// Page initialization |
7267 |
21 Jun 23 |
nicklas |
ascat.initPage = function() |
7267 |
21 Jun 23 |
nicklas |
20 |
{ |
7267 |
21 Jun 23 |
nicklas |
21 |
|
7267 |
21 Jun 23 |
nicklas |
// Step 1 |
7267 |
21 Jun 23 |
nicklas |
Buttons.addClickHandler('btnSelectAlignedSequences', ascat.selectAlignedSequences); |
7267 |
21 Jun 23 |
nicklas |
Events.addEventHandler('alignedSequences', 'base-selected', ascat.setAlignedSequenceCallback); |
7267 |
21 Jun 23 |
nicklas |
Events.addEventHandler('alignedSequences', 'change', ascat.alignedSequencesOnChange); |
7267 |
21 Jun 23 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', ascat.validateStep1); |
7267 |
21 Jun 23 |
nicklas |
27 |
|
7267 |
21 Jun 23 |
nicklas |
// Step 2 |
7267 |
21 Jun 23 |
nicklas |
Events.addEventHandler('step-2', 'wizard-initialize', ascat.initializeStep2); |
7267 |
21 Jun 23 |
nicklas |
Events.addEventHandler('step-2', 'wizard-validate', ascat.validateStep2); |
7267 |
21 Jun 23 |
nicklas |
Events.addEventHandler('clusters', 'change', ascat.clusterOnChange); |
7372 |
06 Oct 23 |
nicklas |
Events.addEventHandler('debug', 'change', ascat.debugOnChange); |
7372 |
06 Oct 23 |
nicklas |
Events.addEventHandler('override', 'change', ascat.overrideOnChange); |
7267 |
21 Jun 23 |
nicklas |
Events.addEventHandler('ascatSoftware', 'change', ascat.softwareOnChange); |
7341 |
11 Sep 23 |
nicklas |
Events.addEventHandler('imbalanceTest', 'change', ascat.imbalanceTestOnChange); |
7341 |
11 Sep 23 |
nicklas |
Events.addEventHandler('penalty', 'keypress', Events.integerOnly); |
7341 |
11 Sep 23 |
nicklas |
Events.addEventHandler('penalty', 'change', ascat.penaltyOnChange); |
7341 |
11 Sep 23 |
nicklas |
Events.addEventHandler('minDepth', 'keypress', Events.integerOnly); |
7341 |
11 Sep 23 |
nicklas |
Events.addEventHandler('minDepth', 'change', ascat.minDepthOnChange); |
7279 |
11 Aug 23 |
nicklas |
Events.addEventHandler('tau', 'keypress', Events.numberOnly); |
7279 |
11 Aug 23 |
nicklas |
Events.addEventHandler('tau', 'change', ascat.tauOnChange); |
7279 |
11 Aug 23 |
nicklas |
Events.addEventHandler('rho', 'keypress', Events.numberOnly); |
7279 |
11 Aug 23 |
nicklas |
Events.addEventHandler('rho', 'change', ascat.checkRhoAndPsi); |
7279 |
11 Aug 23 |
nicklas |
Events.addEventHandler('psi', 'keypress', Events.numberOnly); |
7279 |
11 Aug 23 |
nicklas |
Events.addEventHandler('psi', 'change', ascat.checkRhoAndPsi); |
7290 |
18 Aug 23 |
nicklas |
Buttons.addClickHandler('viewExistingResults', ascat.viewExistingResults); |
7267 |
21 Jun 23 |
nicklas |
47 |
|
7267 |
21 Jun 23 |
nicklas |
// Navigation |
7267 |
21 Jun 23 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
7267 |
21 Jun 23 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
7267 |
21 Jun 23 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
7267 |
21 Jun 23 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
7267 |
21 Jun 23 |
nicklas |
53 |
|
7267 |
21 Jun 23 |
nicklas |
// Final registration |
7267 |
21 Jun 23 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', ascat.submit); |
7267 |
21 Jun 23 |
nicklas |
56 |
|
7267 |
21 Jun 23 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
7267 |
21 Jun 23 |
nicklas |
var url = '../Ascat.servlet?ID='+App.getSessionId(); |
7267 |
21 Jun 23 |
nicklas |
url += '&cmd=GetAlignedSequencesForAscatAnalysis'; |
7267 |
21 Jun 23 |
nicklas |
Wizard.asyncJsonRequest(url, ascat.initializeStep1); |
7267 |
21 Jun 23 |
nicklas |
61 |
} |
7267 |
21 Jun 23 |
nicklas |
62 |
|
7267 |
21 Jun 23 |
nicklas |
// --- Step 1 ----------------------------------- |
7267 |
21 Jun 23 |
nicklas |
ascat.initializeStep1 = function(response) |
7267 |
21 Jun 23 |
nicklas |
65 |
{ |
7267 |
21 Jun 23 |
nicklas |
var alignedSequences = response.alignedSequences; |
7267 |
21 Jun 23 |
nicklas |
var frm = document.forms['reggie']; |
7267 |
21 Jun 23 |
nicklas |
68 |
|
7267 |
21 Jun 23 |
nicklas |
if (alignedSequences != null && alignedSequences.length > 0) |
7267 |
21 Jun 23 |
nicklas |
70 |
{ |
7269 |
26 Jun 23 |
nicklas |
for (var tumorNo=0; tumorNo < alignedSequences.length; tumorNo++) |
7267 |
21 Jun 23 |
nicklas |
72 |
{ |
7269 |
26 Jun 23 |
nicklas |
var tumor = alignedSequences[tumorNo]; |
7269 |
26 Jun 23 |
nicklas |
var numNormals = tumor.normals.length; |
7269 |
26 Jun 23 |
nicklas |
for (var normalNo=0; normalNo < numNormals; normalNo++) |
7269 |
26 Jun 23 |
nicklas |
76 |
{ |
7269 |
26 Jun 23 |
nicklas |
var normal = tumor.normals[normalNo]; |
7269 |
26 Jun 23 |
nicklas |
var option = ascat.createListOption(tumorNo+1, numNormals == 1 ? null : normalNo+1, tumor, normal, tumor.DO_NOT_USE == null && normal.DO_NOT_USE==null); |
7269 |
26 Jun 23 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
7269 |
26 Jun 23 |
nicklas |
80 |
} |
7269 |
26 Jun 23 |
nicklas |
if (numNormals == 0) |
7269 |
26 Jun 23 |
nicklas |
82 |
{ |
7269 |
26 Jun 23 |
nicklas |
var option = ascat.createListOption(tumorNo+1, null, tumor, null, false); |
7269 |
26 Jun 23 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
7269 |
26 Jun 23 |
nicklas |
85 |
} |
7267 |
21 Jun 23 |
nicklas |
86 |
} |
7267 |
21 Jun 23 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
7267 |
21 Jun 23 |
nicklas |
88 |
} |
7267 |
21 Jun 23 |
nicklas |
else |
7267 |
21 Jun 23 |
nicklas |
90 |
{ |
7267 |
21 Jun 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', 'No new sequences available for processing'); |
7267 |
21 Jun 23 |
nicklas |
92 |
} |
7267 |
21 Jun 23 |
nicklas |
93 |
|
7267 |
21 Jun 23 |
nicklas |
Doc.show('step-1'); |
7267 |
21 Jun 23 |
nicklas |
Doc.show('gonext'); |
7267 |
21 Jun 23 |
nicklas |
96 |
|
7267 |
21 Jun 23 |
nicklas |
frm.alignedSequences.focus(); |
7267 |
21 Jun 23 |
nicklas |
98 |
} |
7267 |
21 Jun 23 |
nicklas |
99 |
|
7267 |
21 Jun 23 |
nicklas |
ascat.validateStep1 = function(event) |
7267 |
21 Jun 23 |
nicklas |
101 |
{ |
7267 |
21 Jun 23 |
nicklas |
if (!selectionIsValid) event.preventDefault(); |
7267 |
21 Jun 23 |
nicklas |
103 |
} |
7267 |
21 Jun 23 |
nicklas |
104 |
|
7267 |
21 Jun 23 |
nicklas |
ascat.selectAlignedSequences = function() |
7267 |
21 Jun 23 |
nicklas |
106 |
{ |
7267 |
21 Jun 23 |
nicklas |
var frm = document.forms['reggie']; |
7267 |
21 Jun 23 |
nicklas |
if (frm.alignedSequences.disabled) return; |
7267 |
21 Jun 23 |
nicklas |
109 |
|
7267 |
21 Jun 23 |
nicklas |
if (subtypeAlignedSequences == null) |
7267 |
21 Jun 23 |
nicklas |
111 |
{ |
7267 |
21 Jun 23 |
nicklas |
subtypeAlignedSequences = Reggie.getSubtypeInfo('ALIGNED_SEQUENCES'); |
7267 |
21 Jun 23 |
nicklas |
113 |
} |
7267 |
21 Jun 23 |
nicklas |
if (annotationTypePipeline == null) |
7267 |
21 Jun 23 |
nicklas |
115 |
{ |
7267 |
21 Jun 23 |
nicklas |
annotationTypePipeline = Reggie.getAnnotationTypeInfo('PIPELINE'); |
7267 |
21 Jun 23 |
nicklas |
117 |
} |
7267 |
21 Jun 23 |
nicklas |
118 |
|
7267 |
21 Jun 23 |
nicklas |
// Reset list |
7267 |
21 Jun 23 |
nicklas |
manuallySelected = []; |
7267 |
21 Jun 23 |
nicklas |
var url = '&resetTemporary=1'; |
7267 |
21 Jun 23 |
nicklas |
// Alignments in the 'DNA/Tumor/WGS' pipeline |
7267 |
21 Jun 23 |
nicklas |
url += '&tmpfilter:INT:itemSubtype='+subtypeAlignedSequences.id; |
7267 |
21 Jun 23 |
nicklas |
url += '&tmpfilter:STRING:'+encodeURIComponent('#')+annotationTypePipeline.id+'='+encodeURIComponent('DNA/Tumor/WGS'); |
7267 |
21 Jun 23 |
nicklas |
125 |
|
7267 |
21 Jun 23 |
nicklas |
Dialogs.selectItem('DERIVEDBIOASSAY', 'alignedSequences', 1, url); |
7267 |
21 Jun 23 |
nicklas |
127 |
} |
7267 |
21 Jun 23 |
nicklas |
128 |
|
7267 |
21 Jun 23 |
nicklas |
ascat.setAlignedSequenceCallback = function(event) |
7267 |
21 Jun 23 |
nicklas |
130 |
{ |
7267 |
21 Jun 23 |
nicklas |
var ms = event.detail; |
7267 |
21 Jun 23 |
nicklas |
132 |
|
7267 |
21 Jun 23 |
nicklas |
var opt = Reggie.getListOption('alignedSequences', ms.id); |
7267 |
21 Jun 23 |
nicklas |
if (opt) |
7267 |
21 Jun 23 |
nicklas |
135 |
{ |
7267 |
21 Jun 23 |
nicklas |
opt.selected = true; |
7267 |
21 Jun 23 |
nicklas |
137 |
} |
7267 |
21 Jun 23 |
nicklas |
else |
7267 |
21 Jun 23 |
nicklas |
139 |
{ |
7267 |
21 Jun 23 |
nicklas |
manuallySelected[manuallySelected.length] = ms.id; |
7267 |
21 Jun 23 |
nicklas |
141 |
} |
7267 |
21 Jun 23 |
nicklas |
142 |
|
7267 |
21 Jun 23 |
nicklas |
if (ms.remaining == 0 && manuallySelected.length > 0) |
7267 |
21 Jun 23 |
nicklas |
144 |
{ |
7267 |
21 Jun 23 |
nicklas |
var url = '../Ascat.servlet?ID='+App.getSessionId(); |
7267 |
21 Jun 23 |
nicklas |
url += '&cmd=GetAlignedSequencesForAscatAnalysis'; |
7267 |
21 Jun 23 |
nicklas |
url += '&items='+manuallySelected.join(','); |
7267 |
21 Jun 23 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
7267 |
21 Jun 23 |
nicklas |
Wizard.asyncJsonRequest(url, ascat.manuallySelected); |
7267 |
21 Jun 23 |
nicklas |
150 |
} |
7267 |
21 Jun 23 |
nicklas |
else |
7267 |
21 Jun 23 |
nicklas |
152 |
{ |
7267 |
21 Jun 23 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
7267 |
21 Jun 23 |
nicklas |
154 |
} |
7267 |
21 Jun 23 |
nicklas |
155 |
} |
7267 |
21 Jun 23 |
nicklas |
156 |
|
7267 |
21 Jun 23 |
nicklas |
ascat.manuallySelected = function(response) |
7267 |
21 Jun 23 |
nicklas |
158 |
{ |
7267 |
21 Jun 23 |
nicklas |
var alignedSequences = response.alignedSequences; |
7267 |
21 Jun 23 |
nicklas |
var frm = document.forms['reggie']; |
7267 |
21 Jun 23 |
nicklas |
161 |
|
7267 |
21 Jun 23 |
nicklas |
if (alignedSequences != null && alignedSequences.length > 0) |
7267 |
21 Jun 23 |
nicklas |
163 |
{ |
7267 |
21 Jun 23 |
nicklas |
var offset = frm.alignedSequences.length+1; |
7269 |
26 Jun 23 |
nicklas |
for (var tumorNo=0; tumorNo < alignedSequences.length; tumorNo++) |
7267 |
21 Jun 23 |
nicklas |
166 |
{ |
7269 |
26 Jun 23 |
nicklas |
var tumor = alignedSequences[tumorNo]; |
7269 |
26 Jun 23 |
nicklas |
var numNormals = tumor.normals.length; |
7269 |
26 Jun 23 |
nicklas |
for (var normalNo=0; normalNo < numNormals; normalNo++) |
7269 |
26 Jun 23 |
nicklas |
170 |
{ |
7269 |
26 Jun 23 |
nicklas |
var normal = tumor.normals[normalNo]; |
7269 |
26 Jun 23 |
nicklas |
var option = ascat.createListOption(tumorNo+offset, numNormals == 1 ? null : normalNo+1, tumor, normal, tumor.DO_NOT_USE == null && normal.DO_NOT_USE==null); |
7269 |
26 Jun 23 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
7269 |
26 Jun 23 |
nicklas |
174 |
} |
7269 |
26 Jun 23 |
nicklas |
if (numNormals == 0) |
7269 |
26 Jun 23 |
nicklas |
176 |
{ |
7269 |
26 Jun 23 |
nicklas |
var option = ascat.createListOption(tumorNo+offset, null, tumor, null, false); |
7269 |
26 Jun 23 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
7269 |
26 Jun 23 |
nicklas |
179 |
} |
7267 |
21 Jun 23 |
nicklas |
180 |
} |
7267 |
21 Jun 23 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
7267 |
21 Jun 23 |
nicklas |
182 |
} |
7267 |
21 Jun 23 |
nicklas |
183 |
} |
7267 |
21 Jun 23 |
nicklas |
184 |
|
7269 |
26 Jun 23 |
nicklas |
ascat.createListOption = function(indexTumor, indexNormal, tumor, normal, selected) |
7267 |
21 Jun 23 |
nicklas |
186 |
{ |
7267 |
21 Jun 23 |
nicklas |
var tooltip = null; |
7294 |
23 Aug 23 |
nicklas |
var name = indexTumor+(indexNormal!=null ? '.'+indexNormal : '')+': ' + tumor.name+' - '+(normal ? normal.name : 'missing normal'); |
7267 |
21 Jun 23 |
nicklas |
189 |
|
7269 |
26 Jun 23 |
nicklas |
if (!normal) |
7267 |
21 Jun 23 |
nicklas |
191 |
{ |
7269 |
26 Jun 23 |
nicklas |
tooltip = 'Could not find a matching normal alignment'; |
7269 |
26 Jun 23 |
nicklas |
193 |
} |
7269 |
26 Jun 23 |
nicklas |
else if (tumor.DO_NOT_USE || normal.DO_NOT_USE) |
7269 |
26 Jun 23 |
nicklas |
195 |
{ |
7267 |
21 Jun 23 |
nicklas |
name += ' [DoNotUse]'; |
7269 |
26 Jun 23 |
nicklas |
var dn = tumor.DO_NOT_USE ? tumor : normal; |
7269 |
26 Jun 23 |
nicklas |
tooltip = '['+(dn==tumor?'Tumor':'Normal')+'] DoNotUse-'+Strings.encodeTags(dn.DO_NOT_USE+': '+dn.DO_NOT_USE_COMMENT); |
7267 |
21 Jun 23 |
nicklas |
199 |
} |
7269 |
26 Jun 23 |
nicklas |
else if (tumor.AutoProcess == 'ReProcess') |
7267 |
21 Jun 23 |
nicklas |
201 |
{ |
7267 |
21 Jun 23 |
nicklas |
name += ' [R]'; |
7267 |
21 Jun 23 |
nicklas |
203 |
} |
7267 |
21 Jun 23 |
nicklas |
204 |
|
7269 |
26 Jun 23 |
nicklas |
var option = new Option(name, tumor.id, false, selected); |
7267 |
21 Jun 23 |
nicklas |
if (tooltip) option.title = tooltip; |
7269 |
26 Jun 23 |
nicklas |
option.tumor = tumor; |
7269 |
26 Jun 23 |
nicklas |
option.normal = normal; |
7269 |
26 Jun 23 |
nicklas |
if (!normal) option.disabled = true; |
7267 |
21 Jun 23 |
nicklas |
return option; |
7267 |
21 Jun 23 |
nicklas |
211 |
} |
7267 |
21 Jun 23 |
nicklas |
212 |
|
7267 |
21 Jun 23 |
nicklas |
ascat.alignedSequencesOnChange = function() |
7267 |
21 Jun 23 |
nicklas |
214 |
{ |
7267 |
21 Jun 23 |
nicklas |
var frm = document.forms['reggie']; |
7267 |
21 Jun 23 |
nicklas |
selectionIsValid = false; |
7290 |
18 Aug 23 |
nicklas |
var numSelected = 0; |
7267 |
21 Jun 23 |
nicklas |
var numDoNotUse = 0; |
7269 |
26 Jun 23 |
nicklas |
var invalidSelection = null; |
7267 |
21 Jun 23 |
nicklas |
Wizard.setInputStatus('alignedSequences'); |
7267 |
21 Jun 23 |
nicklas |
Wizard.hideGoNextConfirmation(); |
7267 |
21 Jun 23 |
nicklas |
222 |
|
7267 |
21 Jun 23 |
nicklas |
for (var asNo = 0; asNo < frm.alignedSequences.length; asNo++) |
7267 |
21 Jun 23 |
nicklas |
224 |
{ |
7267 |
21 Jun 23 |
nicklas |
if (frm.alignedSequences[asNo].selected) |
7267 |
21 Jun 23 |
nicklas |
226 |
{ |
7267 |
21 Jun 23 |
nicklas |
numSelected++; |
7269 |
26 Jun 23 |
nicklas |
var tumor = frm.alignedSequences[asNo].tumor; |
7269 |
26 Jun 23 |
nicklas |
var normal = frm.alignedSequences[asNo].normal; |
7269 |
26 Jun 23 |
nicklas |
if (tumor.DO_NOT_USE || normal && normal.DO_NOT_USE) numDoNotUse++; |
7269 |
26 Jun 23 |
nicklas |
if (!normal) |
7267 |
21 Jun 23 |
nicklas |
232 |
{ |
7269 |
26 Jun 23 |
nicklas |
invalidSelection = Strings.encodeTags(tumor.name+' has not matched normal alignment'); |
7267 |
21 Jun 23 |
nicklas |
234 |
} |
7269 |
26 Jun 23 |
nicklas |
else if (tumor.pipeline && tumor.pipeline != 'DNA/Tumor/WGS') |
7269 |
26 Jun 23 |
nicklas |
236 |
{ |
7269 |
26 Jun 23 |
nicklas |
invalidSelection = Strings.encodeTags(tumor.name+' ('+tumor.pipeline)+') is not intended for the DNA/Tumor/WGS pipeline.'; |
7269 |
26 Jun 23 |
nicklas |
238 |
} |
7267 |
21 Jun 23 |
nicklas |
239 |
} |
7267 |
21 Jun 23 |
nicklas |
240 |
} |
7267 |
21 Jun 23 |
nicklas |
241 |
|
7267 |
21 Jun 23 |
nicklas |
if (numSelected == 0) |
7267 |
21 Jun 23 |
nicklas |
243 |
{ |
7267 |
21 Jun 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', 'Select at least one item'); |
7267 |
21 Jun 23 |
nicklas |
return; |
7267 |
21 Jun 23 |
nicklas |
246 |
} |
7269 |
26 Jun 23 |
nicklas |
if (invalidSelection) |
7267 |
21 Jun 23 |
nicklas |
248 |
{ |
7269 |
26 Jun 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', invalidSelection); |
7267 |
21 Jun 23 |
nicklas |
return; |
7267 |
21 Jun 23 |
nicklas |
251 |
} |
7267 |
21 Jun 23 |
nicklas |
selectionIsValid = true; |
7267 |
21 Jun 23 |
nicklas |
253 |
|
7267 |
21 Jun 23 |
nicklas |
if (numDoNotUse > 0) |
7267 |
21 Jun 23 |
nicklas |
255 |
{ |
7267 |
21 Jun 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'warning', numDoNotUse + ' selected items marked as DoNotUse'); |
7267 |
21 Jun 23 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Confirm ' + numDoNotUse + ' items marked as DoNotUse'); |
7267 |
21 Jun 23 |
nicklas |
258 |
} |
7267 |
21 Jun 23 |
nicklas |
else |
7267 |
21 Jun 23 |
nicklas |
260 |
{ |
7267 |
21 Jun 23 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'valid'); |
7267 |
21 Jun 23 |
nicklas |
262 |
} |
7267 |
21 Jun 23 |
nicklas |
263 |
} |
7267 |
21 Jun 23 |
nicklas |
264 |
|
7267 |
21 Jun 23 |
nicklas |
// --- Step 2 ----------------------------------- |
7267 |
21 Jun 23 |
nicklas |
ascat.initializeStep2 = function() |
7267 |
21 Jun 23 |
nicklas |
267 |
{ |
7267 |
21 Jun 23 |
nicklas |
Wizard.setCurrentStep(2); |
7267 |
21 Jun 23 |
nicklas |
269 |
|
7267 |
21 Jun 23 |
nicklas |
// Check debug by default if debug is set or not on a secure server (=production server) |
7267 |
21 Jun 23 |
nicklas |
var frm = document.forms['reggie']; |
7267 |
21 Jun 23 |
nicklas |
frm.debug.checked = debug || location.protocol != 'https:'; |
7267 |
21 Jun 23 |
nicklas |
273 |
|
7267 |
21 Jun 23 |
nicklas |
Reggie.loadSoftware('COPY_NUMBER_SOFTWARE', 'ascatSoftware', 'PARAMETER_SET'); |
7267 |
21 Jun 23 |
nicklas |
275 |
|
7267 |
21 Jun 23 |
nicklas |
// Load clusters |
7267 |
21 Jun 23 |
nicklas |
var url = '../OpenGrid.servlet?ID='+App.getSessionId() + '&cmd=GetHostInfo&config=ascat'; |
7267 |
21 Jun 23 |
nicklas |
Doc.addClass('clusters', 'list-loading'); |
7267 |
21 Jun 23 |
nicklas |
frm.clusters[0] = new Option('loading...'); |
7267 |
21 Jun 23 |
nicklas |
Wizard.asyncJsonRequest(url, ascat.clustersLoaded); |
7290 |
18 Aug 23 |
nicklas |
281 |
|
7290 |
18 Aug 23 |
nicklas |
// Check if only a single item is selected |
7290 |
18 Aug 23 |
nicklas |
var numSelected = 0; |
7290 |
18 Aug 23 |
nicklas |
var firstSelected = 0; |
7290 |
18 Aug 23 |
nicklas |
for (var asNo = 0; asNo < frm.alignedSequences.length; asNo++) |
7290 |
18 Aug 23 |
nicklas |
286 |
{ |
7290 |
18 Aug 23 |
nicklas |
if (frm.alignedSequences[asNo].selected) |
7290 |
18 Aug 23 |
nicklas |
288 |
{ |
7290 |
18 Aug 23 |
nicklas |
numSelected++; |
7290 |
18 Aug 23 |
nicklas |
if (numSelected == 1) firstSelected = asNo; |
7290 |
18 Aug 23 |
nicklas |
291 |
} |
7290 |
18 Aug 23 |
nicklas |
292 |
} |
7279 |
11 Aug 23 |
nicklas |
293 |
|
7290 |
18 Aug 23 |
nicklas |
if (numSelected == 1) |
7279 |
11 Aug 23 |
nicklas |
295 |
{ |
7290 |
18 Aug 23 |
nicklas |
// Load information about existing results |
7290 |
18 Aug 23 |
nicklas |
var tumor = frm.alignedSequences[firstSelected].tumor; |
7290 |
18 Aug 23 |
nicklas |
var normal = frm.alignedSequences[firstSelected].normal; |
7290 |
18 Aug 23 |
nicklas |
var url = '../Ascat.servlet?ID='+App.getSessionId(); |
7290 |
18 Aug 23 |
nicklas |
url += '&cmd=LoadExistingResults'; |
7290 |
18 Aug 23 |
nicklas |
url += '&tumorId='+tumor.id+'&normalId='+normal.id; |
7290 |
18 Aug 23 |
nicklas |
Wizard.asyncJsonRequest(url, ascat.existingResultsLoaded); |
7290 |
18 Aug 23 |
nicklas |
303 |
} |
7290 |
18 Aug 23 |
nicklas |
else |
7290 |
18 Aug 23 |
nicklas |
305 |
{ |
7290 |
18 Aug 23 |
nicklas |
// Disable 'rho' and 'psi' options if more than one item is selected |
7279 |
11 Aug 23 |
nicklas |
frm.rho.disabled = true; |
7279 |
11 Aug 23 |
nicklas |
frm.psi.disabled = true; |
7279 |
11 Aug 23 |
nicklas |
Wizard.setInputStatus('rho', '', 'Disabled since more than one item is selected'); |
7279 |
11 Aug 23 |
nicklas |
Wizard.setInputStatus('psi', '', 'Disabled since more than one item is selected'); |
7279 |
11 Aug 23 |
nicklas |
311 |
} |
7341 |
11 Sep 23 |
nicklas |
312 |
|
7341 |
11 Sep 23 |
nicklas |
ascat.imbalanceTestOnChange(); |
7267 |
21 Jun 23 |
nicklas |
Doc.show('goregister'); |
7267 |
21 Jun 23 |
nicklas |
Doc.show('gocancel'); |
7267 |
21 Jun 23 |
nicklas |
316 |
} |
7267 |
21 Jun 23 |
nicklas |
317 |
|
7290 |
18 Aug 23 |
nicklas |
ascat.existingResultsLoaded = function(response) |
7290 |
18 Aug 23 |
nicklas |
319 |
{ |
7290 |
18 Aug 23 |
nicklas |
var existingResults = response.ascatItems; |
7290 |
18 Aug 23 |
nicklas |
if (existingResults && existingResults.length > 0) |
7290 |
18 Aug 23 |
nicklas |
322 |
{ |
7290 |
18 Aug 23 |
nicklas |
Data.set('viewExistingResults', 'tumor-id', response.tumor.id); |
7290 |
18 Aug 23 |
nicklas |
Data.set('viewExistingResults', 'normal-id', response.normal.id); |
7290 |
18 Aug 23 |
nicklas |
Doc.element('numExistingResults').innerHTML = existingResults.length; |
7290 |
18 Aug 23 |
nicklas |
Doc.show('existingResults'); |
7290 |
18 Aug 23 |
nicklas |
327 |
} |
7290 |
18 Aug 23 |
nicklas |
328 |
} |
7290 |
18 Aug 23 |
nicklas |
329 |
|
7290 |
18 Aug 23 |
nicklas |
ascat.viewExistingResults = function(event) |
7290 |
18 Aug 23 |
nicklas |
331 |
{ |
7290 |
18 Aug 23 |
nicklas |
var tumorId = Data.get(event.currentTarget, 'tumor-id'); |
7290 |
18 Aug 23 |
nicklas |
var normalId = Data.get(event.currentTarget, 'normal-id'); |
7290 |
18 Aug 23 |
nicklas |
334 |
|
7290 |
18 Aug 23 |
nicklas |
var url = 'view_existing_ascat_results.jsp?ID='+App.getSessionId(); |
7290 |
18 Aug 23 |
nicklas |
url += '&tumorId='+tumorId; |
7290 |
18 Aug 23 |
nicklas |
url += '&normalId='+normalId; |
7290 |
18 Aug 23 |
nicklas |
Dialogs.openPopup(url, 'ViewAscatResults', 1500, 800); |
7290 |
18 Aug 23 |
nicklas |
339 |
} |
7290 |
18 Aug 23 |
nicklas |
340 |
|
7267 |
21 Jun 23 |
nicklas |
ascat.validateStep2 = function(event) |
7267 |
21 Jun 23 |
nicklas |
342 |
{ |
7279 |
11 Aug 23 |
nicklas |
var valid = tauIsValid; |
7279 |
11 Aug 23 |
nicklas |
valid &= rhoIsValid; |
7279 |
11 Aug 23 |
nicklas |
valid &= psiIsValid; |
7341 |
11 Sep 23 |
nicklas |
valid &= penaltyIsValid; |
7279 |
11 Aug 23 |
nicklas |
valid &= clusterIsValid; |
7279 |
11 Aug 23 |
nicklas |
if (!valid) event.preventDefault(); |
7267 |
21 Jun 23 |
nicklas |
349 |
} |
7267 |
21 Jun 23 |
nicklas |
350 |
|
7267 |
21 Jun 23 |
nicklas |
ascat.clustersLoaded = function(response) |
7267 |
21 Jun 23 |
nicklas |
352 |
{ |
7267 |
21 Jun 23 |
nicklas |
Doc.removeClass('clusters', 'list-loading'); |
7267 |
21 Jun 23 |
nicklas |
var frm = document.forms['reggie']; |
7267 |
21 Jun 23 |
nicklas |
var clusters = response.hosts; |
7267 |
21 Jun 23 |
nicklas |
frm.clusters.length = 0; |
7267 |
21 Jun 23 |
nicklas |
for (var i = 0; i < clusters.length; i++) |
7267 |
21 Jun 23 |
nicklas |
358 |
{ |
7267 |
21 Jun 23 |
nicklas |
var cl = clusters[i]; |
7267 |
21 Jun 23 |
nicklas |
var option = new Option(cl.connection.name, cl.id); |
7267 |
21 Jun 23 |
nicklas |
option.cluster = cl; |
7267 |
21 Jun 23 |
nicklas |
frm.clusters[frm.clusters.length] = option; |
7267 |
21 Jun 23 |
nicklas |
Wizard.setInputStatus('clusters', 'valid'); |
7267 |
21 Jun 23 |
nicklas |
clusterIsValid = true; |
7267 |
21 Jun 23 |
nicklas |
365 |
} |
7267 |
21 Jun 23 |
nicklas |
if (frm.clusters.length == 0) |
7267 |
21 Jun 23 |
nicklas |
367 |
{ |
7267 |
21 Jun 23 |
nicklas |
Wizard.setInputStatus('clusters', 'invalid', 'No available clusters'); |
7267 |
21 Jun 23 |
nicklas |
clusterIsValid = false; |
7267 |
21 Jun 23 |
nicklas |
370 |
} |
7267 |
21 Jun 23 |
nicklas |
else |
7267 |
21 Jun 23 |
nicklas |
372 |
{ |
7267 |
21 Jun 23 |
nicklas |
ascat.clusterOnChange(); |
7267 |
21 Jun 23 |
nicklas |
374 |
} |
7267 |
21 Jun 23 |
nicklas |
375 |
} |
7267 |
21 Jun 23 |
nicklas |
376 |
|
7267 |
21 Jun 23 |
nicklas |
ascat.softwareOnChange = function(event) |
7267 |
21 Jun 23 |
nicklas |
378 |
{ |
7267 |
21 Jun 23 |
nicklas |
var target = event.currentTarget; |
7267 |
21 Jun 23 |
nicklas |
var item = target[target.selectedIndex].item; |
7267 |
21 Jun 23 |
nicklas |
if (!item) item = {}; |
7267 |
21 Jun 23 |
nicklas |
382 |
|
7267 |
21 Jun 23 |
nicklas |
Doc.element(target.id+'.parameterSet').innerHTML = Strings.encodeTags(item.ParameterSet || 'default'); |
7267 |
21 Jun 23 |
nicklas |
Doc.element(target.id+'.description').innerHTML = Strings.encodeTags(item.description); |
7267 |
21 Jun 23 |
nicklas |
Wizard.setInputStatus(target.id, 'valid'); |
7267 |
21 Jun 23 |
nicklas |
386 |
|
7267 |
21 Jun 23 |
nicklas |
if (item.ParameterSet) |
7267 |
21 Jun 23 |
nicklas |
388 |
{ |
7267 |
21 Jun 23 |
nicklas |
var url = '../Install.servlet?ID='+App.getSessionId(); |
7267 |
21 Jun 23 |
nicklas |
url += '&cmd=GetParameterSetInfo'; |
7267 |
21 Jun 23 |
nicklas |
url += '¶meterSet='+encodeURIComponent(item.ParameterSet); |
7267 |
21 Jun 23 |
nicklas |
url += '&targetId='+target.id; |
7267 |
21 Jun 23 |
nicklas |
Wizard.asyncJsonRequest(url, ascat.parameterSetInfoLoaded); |
7267 |
21 Jun 23 |
nicklas |
394 |
} |
7372 |
06 Oct 23 |
nicklas |
ascat.updateSubmitOptions(); |
7267 |
21 Jun 23 |
nicklas |
396 |
} |
7267 |
21 Jun 23 |
nicklas |
397 |
|
7267 |
21 Jun 23 |
nicklas |
ascat.parameterSetInfoLoaded = function(response) |
7267 |
21 Jun 23 |
nicklas |
399 |
{ |
7267 |
21 Jun 23 |
nicklas |
if (!response.parameters || response.parameters.length == 0) |
7267 |
21 Jun 23 |
nicklas |
401 |
{ |
7267 |
21 Jun 23 |
nicklas |
Wizard.setInputStatus(response.targetId, 'warning', 'Can\'t find \'' + Strings.encodeTags(response.parameterSet) + '\' parameter set in reggie-config.xml'); |
7267 |
21 Jun 23 |
nicklas |
403 |
} |
7267 |
21 Jun 23 |
nicklas |
404 |
} |
7267 |
21 Jun 23 |
nicklas |
405 |
|
7341 |
11 Sep 23 |
nicklas |
ascat.imbalanceTestOnChange = function() |
7341 |
11 Sep 23 |
nicklas |
407 |
{ |
7341 |
11 Sep 23 |
nicklas |
var frm = document.forms['reggie']; |
7341 |
11 Sep 23 |
nicklas |
var imbalanceTest = frm.imbalanceTest[frm.imbalanceTest.selectedIndex]; |
7341 |
11 Sep 23 |
nicklas |
var tauMin = Data.get(imbalanceTest, 'tau-min'); |
7341 |
11 Sep 23 |
nicklas |
var tauMax = Data.get(imbalanceTest, 'tau-max'); |
7341 |
11 Sep 23 |
nicklas |
var tauDefault = Data.get(imbalanceTest, 'tau'); |
7341 |
11 Sep 23 |
nicklas |
Doc.element('tau-range').innerHTML = tauMin+' ≤ τ ≤ '+tauMax; |
7341 |
11 Sep 23 |
nicklas |
frm.tau.placeholder = tauDefault; |
7341 |
11 Sep 23 |
nicklas |
ascat.tauOnChange(); |
7341 |
11 Sep 23 |
nicklas |
416 |
} |
7341 |
11 Sep 23 |
nicklas |
417 |
|
7341 |
11 Sep 23 |
nicklas |
ascat.penaltyOnChange = function() |
7341 |
11 Sep 23 |
nicklas |
419 |
{ |
7341 |
11 Sep 23 |
nicklas |
var frm = document.forms['reggie']; |
7341 |
11 Sep 23 |
nicklas |
Wizard.setInputStatus('penalty'); |
7341 |
11 Sep 23 |
nicklas |
penaltyIsValid = false; |
7341 |
11 Sep 23 |
nicklas |
423 |
|
7341 |
11 Sep 23 |
nicklas |
if (frm.penalty.value != '') |
7341 |
11 Sep 23 |
nicklas |
425 |
{ |
7341 |
11 Sep 23 |
nicklas |
var penalty = parseInt(frm.penalty.value); |
7341 |
11 Sep 23 |
nicklas |
if (isNaN(penalty) || penalty <= 0) |
7341 |
11 Sep 23 |
nicklas |
428 |
{ |
7341 |
11 Sep 23 |
nicklas |
Wizard.setInputStatus('penalty', 'invalid', 'Please enter a number >0'); |
7341 |
11 Sep 23 |
nicklas |
return; |
7341 |
11 Sep 23 |
nicklas |
431 |
} |
7341 |
11 Sep 23 |
nicklas |
frm.penalty.value = penalty; |
7341 |
11 Sep 23 |
nicklas |
433 |
} |
7341 |
11 Sep 23 |
nicklas |
Wizard.setInputStatus('penalty', 'valid'); |
7341 |
11 Sep 23 |
nicklas |
penaltyIsValid = true; |
7341 |
11 Sep 23 |
nicklas |
436 |
} |
7341 |
11 Sep 23 |
nicklas |
437 |
|
7341 |
11 Sep 23 |
nicklas |
ascat.minDepthOnChange = function() |
7341 |
11 Sep 23 |
nicklas |
439 |
{ |
7341 |
11 Sep 23 |
nicklas |
var frm = document.forms['reggie']; |
7341 |
11 Sep 23 |
nicklas |
Wizard.setInputStatus('minDepth'); |
7341 |
11 Sep 23 |
nicklas |
minDepthIsValid = false; |
7341 |
11 Sep 23 |
nicklas |
443 |
|
7341 |
11 Sep 23 |
nicklas |
if (frm.minDepth.value != '') |
7341 |
11 Sep 23 |
nicklas |
445 |
{ |
7341 |
11 Sep 23 |
nicklas |
var minDepth = parseInt(frm.minDepth.value); |
7341 |
11 Sep 23 |
nicklas |
if (isNaN(minDepth) || minDepth <= 0) |
7341 |
11 Sep 23 |
nicklas |
448 |
{ |
7341 |
11 Sep 23 |
nicklas |
Wizard.setInputStatus('minDepth', 'invalid', 'Please enter a number >0'); |
7341 |
11 Sep 23 |
nicklas |
return; |
7341 |
11 Sep 23 |
nicklas |
451 |
} |
7341 |
11 Sep 23 |
nicklas |
frm.minDepth.value = minDepth; |
7341 |
11 Sep 23 |
nicklas |
453 |
} |
7341 |
11 Sep 23 |
nicklas |
Wizard.setInputStatus('minDepth', 'valid'); |
7341 |
11 Sep 23 |
nicklas |
minDepthIsValid = true; |
7341 |
11 Sep 23 |
nicklas |
456 |
} |
7341 |
11 Sep 23 |
nicklas |
457 |
|
7279 |
11 Aug 23 |
nicklas |
ascat.tauOnChange = function() |
7279 |
11 Aug 23 |
nicklas |
459 |
{ |
7279 |
11 Aug 23 |
nicklas |
var frm = document.forms['reggie']; |
7279 |
11 Aug 23 |
nicklas |
Wizard.setInputStatus('tau'); |
7279 |
11 Aug 23 |
nicklas |
tauIsValid = false; |
7279 |
11 Aug 23 |
nicklas |
463 |
|
7279 |
11 Aug 23 |
nicklas |
if (frm.tau.value != '') |
7279 |
11 Aug 23 |
nicklas |
465 |
{ |
7341 |
11 Sep 23 |
nicklas |
var imbalanceTest = frm.imbalanceTest[frm.imbalanceTest.selectedIndex]; |
7341 |
11 Sep 23 |
nicklas |
var tauMin = Data.float(imbalanceTest, 'tau-min'); |
7341 |
11 Sep 23 |
nicklas |
var tauMax = Data.float(imbalanceTest, 'tau-max'); |
7279 |
11 Aug 23 |
nicklas |
var tau = parseFloat(frm.tau.value); |
7341 |
11 Sep 23 |
nicklas |
if (isNaN(tau) || tau < tauMin || tau > tauMax) |
7279 |
11 Aug 23 |
nicklas |
471 |
{ |
7341 |
11 Sep 23 |
nicklas |
Wizard.setInputStatus('tau', 'invalid', 'Please enter a number between '+tauMin+' and '+tauMax); |
7279 |
11 Aug 23 |
nicklas |
return; |
7279 |
11 Aug 23 |
nicklas |
474 |
} |
7341 |
11 Sep 23 |
nicklas |
frm.tau.value = tau; |
7279 |
11 Aug 23 |
nicklas |
476 |
} |
7279 |
11 Aug 23 |
nicklas |
Wizard.setInputStatus('tau', 'valid'); |
7279 |
11 Aug 23 |
nicklas |
tauIsValid = true; |
7279 |
11 Aug 23 |
nicklas |
479 |
} |
7279 |
11 Aug 23 |
nicklas |
480 |
|
7279 |
11 Aug 23 |
nicklas |
ascat.checkRhoAndPsi = function() |
7279 |
11 Aug 23 |
nicklas |
482 |
{ |
7279 |
11 Aug 23 |
nicklas |
var frm = document.forms['reggie']; |
7279 |
11 Aug 23 |
nicklas |
484 |
|
7279 |
11 Aug 23 |
nicklas |
Wizard.setInputStatus('rho'); |
7279 |
11 Aug 23 |
nicklas |
Wizard.setInputStatus('psi'); |
7279 |
11 Aug 23 |
nicklas |
rhoIsValid = false; |
7279 |
11 Aug 23 |
nicklas |
psiIsValid = false; |
7279 |
11 Aug 23 |
nicklas |
489 |
|
7279 |
11 Aug 23 |
nicklas |
var haveRho = frm.rho.value != ''; |
7279 |
11 Aug 23 |
nicklas |
var havePsi = frm.psi.value != ''; |
7279 |
11 Aug 23 |
nicklas |
if (haveRho != havePsi) |
7279 |
11 Aug 23 |
nicklas |
493 |
{ |
7279 |
11 Aug 23 |
nicklas |
// Only one value has been specified |
7279 |
11 Aug 23 |
nicklas |
Wizard.setInputStatus('rho', 'invalid', 'Both rho and psi must be specified'); |
7279 |
11 Aug 23 |
nicklas |
Wizard.setInputStatus('psi', 'invalid', 'Both rho and psi must be specified'); |
7279 |
11 Aug 23 |
nicklas |
return; |
7279 |
11 Aug 23 |
nicklas |
498 |
} |
7279 |
11 Aug 23 |
nicklas |
499 |
|
7279 |
11 Aug 23 |
nicklas |
if (haveRho) |
7279 |
11 Aug 23 |
nicklas |
501 |
{ |
7279 |
11 Aug 23 |
nicklas |
var rho = parseFloat(frm.rho.value); |
7279 |
11 Aug 23 |
nicklas |
rhoIsValid = !isNaN(rho) && rho >= 0 && rho <= 1; |
7279 |
11 Aug 23 |
nicklas |
504 |
} |
7279 |
11 Aug 23 |
nicklas |
else |
7279 |
11 Aug 23 |
nicklas |
506 |
{ |
7279 |
11 Aug 23 |
nicklas |
rhoIsValid = true; |
7279 |
11 Aug 23 |
nicklas |
508 |
} |
7279 |
11 Aug 23 |
nicklas |
if (havePsi) |
7279 |
11 Aug 23 |
nicklas |
510 |
{ |
7279 |
11 Aug 23 |
nicklas |
var psi = parseFloat(frm.psi.value); |
7279 |
11 Aug 23 |
nicklas |
psiIsValid = !isNaN(psi) && psi >= 0 && psi <= 6; |
7279 |
11 Aug 23 |
nicklas |
513 |
} |
7279 |
11 Aug 23 |
nicklas |
else |
7279 |
11 Aug 23 |
nicklas |
515 |
{ |
7279 |
11 Aug 23 |
nicklas |
psiIsValid = true; |
7279 |
11 Aug 23 |
nicklas |
517 |
} |
7279 |
11 Aug 23 |
nicklas |
518 |
|
7279 |
11 Aug 23 |
nicklas |
if (rhoIsValid) |
7279 |
11 Aug 23 |
nicklas |
520 |
{ |
7279 |
11 Aug 23 |
nicklas |
Wizard.setInputStatus('rho', 'valid'); |
7279 |
11 Aug 23 |
nicklas |
522 |
} |
7279 |
11 Aug 23 |
nicklas |
else |
7279 |
11 Aug 23 |
nicklas |
524 |
{ |
7279 |
11 Aug 23 |
nicklas |
Wizard.setInputStatus('rho', 'invalid', 'Please enter a number between 0 and 1'); |
7279 |
11 Aug 23 |
nicklas |
526 |
} |
7279 |
11 Aug 23 |
nicklas |
527 |
|
7279 |
11 Aug 23 |
nicklas |
if (psiIsValid) |
7279 |
11 Aug 23 |
nicklas |
529 |
{ |
7279 |
11 Aug 23 |
nicklas |
Wizard.setInputStatus('psi', 'valid'); |
7279 |
11 Aug 23 |
nicklas |
531 |
} |
7279 |
11 Aug 23 |
nicklas |
else |
7279 |
11 Aug 23 |
nicklas |
533 |
{ |
7279 |
11 Aug 23 |
nicklas |
Wizard.setInputStatus('psi', 'invalid', 'Please enter a number between 0 and 6'); |
7279 |
11 Aug 23 |
nicklas |
535 |
} |
7279 |
11 Aug 23 |
nicklas |
536 |
} |
7279 |
11 Aug 23 |
nicklas |
537 |
|
7267 |
21 Jun 23 |
nicklas |
ascat.clusterOnChange = function() |
7267 |
21 Jun 23 |
nicklas |
539 |
{ |
7267 |
21 Jun 23 |
nicklas |
var frm = document.forms['reggie']; |
7267 |
21 Jun 23 |
nicklas |
var cluster = frm.clusters[frm.clusters.selectedIndex].cluster; |
7267 |
21 Jun 23 |
nicklas |
if (cluster.priorities && cluster.priorities.length > 0) |
7267 |
21 Jun 23 |
nicklas |
543 |
{ |
7267 |
21 Jun 23 |
nicklas |
frm.priority.length = 0; |
7267 |
21 Jun 23 |
nicklas |
for (var pNo = 0; pNo < cluster.priorities.length; pNo++) |
7267 |
21 Jun 23 |
nicklas |
546 |
{ |
7267 |
21 Jun 23 |
nicklas |
var p = cluster.priorities[pNo]; |
7267 |
21 Jun 23 |
nicklas |
frm.priority[frm.priority.length] = new Option(p.name + ' ('+p.value+')', p.value, p['default'], p['default']); |
7267 |
21 Jun 23 |
nicklas |
549 |
} |
7267 |
21 Jun 23 |
nicklas |
Doc.show('job-priority'); |
7267 |
21 Jun 23 |
nicklas |
551 |
} |
7267 |
21 Jun 23 |
nicklas |
else |
7267 |
21 Jun 23 |
nicklas |
553 |
{ |
7267 |
21 Jun 23 |
nicklas |
Doc.hide('job-priority'); |
7267 |
21 Jun 23 |
nicklas |
555 |
} |
7267 |
21 Jun 23 |
nicklas |
if (cluster.partitions && cluster.partitions.length > 0) |
7267 |
21 Jun 23 |
nicklas |
557 |
{ |
7267 |
21 Jun 23 |
nicklas |
frm.partition.length = 0; |
7267 |
21 Jun 23 |
nicklas |
for (var pNo = 0; pNo < cluster.partitions.length; pNo++) |
7267 |
21 Jun 23 |
nicklas |
560 |
{ |
7267 |
21 Jun 23 |
nicklas |
var p = cluster.partitions[pNo]; |
7267 |
21 Jun 23 |
nicklas |
var title = p.name; |
7267 |
21 Jun 23 |
nicklas |
if (p.description) title += ' ('+p.description+')'; |
7267 |
21 Jun 23 |
nicklas |
frm.partition[frm.partition.length] = new Option(title, p.value, p['default'], p['default']); |
7267 |
21 Jun 23 |
nicklas |
565 |
} |
7267 |
21 Jun 23 |
nicklas |
Doc.show('job-partition'); |
7267 |
21 Jun 23 |
nicklas |
567 |
} |
7267 |
21 Jun 23 |
nicklas |
else |
7267 |
21 Jun 23 |
nicklas |
569 |
{ |
7267 |
21 Jun 23 |
nicklas |
Doc.hide('job-partition'); |
7267 |
21 Jun 23 |
nicklas |
571 |
} |
7372 |
06 Oct 23 |
nicklas |
ascat.updateSubmitOptions(); |
7267 |
21 Jun 23 |
nicklas |
573 |
} |
7372 |
06 Oct 23 |
nicklas |
574 |
|
7372 |
06 Oct 23 |
nicklas |
ascat.debugOnChange = function() |
7372 |
06 Oct 23 |
nicklas |
576 |
{ |
7372 |
06 Oct 23 |
nicklas |
ascat.updateSubmitOptions(); |
7372 |
06 Oct 23 |
nicklas |
578 |
} |
7372 |
06 Oct 23 |
nicklas |
579 |
|
7372 |
06 Oct 23 |
nicklas |
ascat.updateSubmitOptions = function() |
7372 |
06 Oct 23 |
nicklas |
581 |
{ |
7372 |
06 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7372 |
06 Oct 23 |
nicklas |
var config = frm.clusters[frm.clusters.selectedIndex]?.cluster?.config?.ascat; |
7372 |
06 Oct 23 |
nicklas |
if (config) |
7372 |
06 Oct 23 |
nicklas |
585 |
{ |
7372 |
06 Oct 23 |
nicklas |
var parameterSet = frm.ascatSoftware[frm.ascatSoftware.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 |
589 |
} |
7372 |
06 Oct 23 |
nicklas |
590 |
} |
7372 |
06 Oct 23 |
nicklas |
591 |
|
7372 |
06 Oct 23 |
nicklas |
ascat.overrideOnChange = function() |
7372 |
06 Oct 23 |
nicklas |
593 |
{ |
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 |
598 |
{ |
7372 |
06 Oct 23 |
nicklas |
frm.submitOptionsOverride.value = Doc.element('submitOptions').innerHTML; |
7372 |
06 Oct 23 |
nicklas |
600 |
} |
7372 |
06 Oct 23 |
nicklas |
601 |
} |
7267 |
21 Jun 23 |
nicklas |
602 |
|
7267 |
21 Jun 23 |
nicklas |
ascat.submit = function() |
7267 |
21 Jun 23 |
nicklas |
604 |
{ |
7267 |
21 Jun 23 |
nicklas |
var frm = document.forms['reggie']; |
7267 |
21 Jun 23 |
nicklas |
606 |
|
7267 |
21 Jun 23 |
nicklas |
var submitInfo = {}; |
7267 |
21 Jun 23 |
nicklas |
submitInfo.ascatSoftware = parseInt(frm.ascatSoftware.value); |
7341 |
11 Sep 23 |
nicklas |
submitInfo.imbalanceTest = frm.imbalanceTest.value; |
7279 |
11 Aug 23 |
nicklas |
submitInfo.tau = parseFloat(frm.tau.value); |
7279 |
11 Aug 23 |
nicklas |
submitInfo.rho = parseFloat(frm.rho.value); |
7279 |
11 Aug 23 |
nicklas |
submitInfo.psi = parseFloat(frm.psi.value); |
7341 |
11 Sep 23 |
nicklas |
submitInfo.penalty = parseInt(frm.penalty.value); |
7341 |
11 Sep 23 |
nicklas |
submitInfo.minDepth = parseInt(frm.minDepth.value); |
7267 |
21 Jun 23 |
nicklas |
submitInfo.cluster = frm.clusters.value; |
7267 |
21 Jun 23 |
nicklas |
if (frm.priority.selectedIndex >= 0) |
7267 |
21 Jun 23 |
nicklas |
617 |
{ |
7267 |
21 Jun 23 |
nicklas |
submitInfo.priority = parseInt(frm.priority.value); |
7267 |
21 Jun 23 |
nicklas |
619 |
} |
7267 |
21 Jun 23 |
nicklas |
if (frm.partition.selectedIndex >= 0) |
7267 |
21 Jun 23 |
nicklas |
621 |
{ |
7267 |
21 Jun 23 |
nicklas |
submitInfo.partition = frm.partition.value; |
7267 |
21 Jun 23 |
nicklas |
623 |
} |
7267 |
21 Jun 23 |
nicklas |
submitInfo.debug = frm.debug.checked; |
7372 |
06 Oct 23 |
nicklas |
if (frm.override.checked) |
7372 |
06 Oct 23 |
nicklas |
626 |
{ |
7372 |
06 Oct 23 |
nicklas |
submitInfo.submitOptionsOverride = frm.submitOptionsOverride.value; |
7372 |
06 Oct 23 |
nicklas |
628 |
} |
7290 |
18 Aug 23 |
nicklas |
// Auto-confirm is not supported since results need to be manually inspected |
7290 |
18 Aug 23 |
nicklas |
// submitInfo.autoConfirm = frm.autoConfirm.checked; |
7267 |
21 Jun 23 |
nicklas |
631 |
|
7267 |
21 Jun 23 |
nicklas |
var alignedSequences = []; |
7267 |
21 Jun 23 |
nicklas |
submitInfo.alignedSequences = alignedSequences; |
7267 |
21 Jun 23 |
nicklas |
634 |
|
7267 |
21 Jun 23 |
nicklas |
for (var asNo = 0; asNo < frm.alignedSequences.length; asNo++) |
7267 |
21 Jun 23 |
nicklas |
636 |
{ |
7267 |
21 Jun 23 |
nicklas |
if (frm.alignedSequences[asNo].selected) |
7267 |
21 Jun 23 |
nicklas |
638 |
{ |
7269 |
26 Jun 23 |
nicklas |
var tumor = frm.alignedSequences[asNo].tumor; |
7269 |
26 Jun 23 |
nicklas |
var normal = frm.alignedSequences[asNo].normal; |
7269 |
26 Jun 23 |
nicklas |
641 |
|
7269 |
26 Jun 23 |
nicklas |
var pair = {}; |
7269 |
26 Jun 23 |
nicklas |
pair.tumorId = tumor.id; |
7269 |
26 Jun 23 |
nicklas |
pair.normalId = normal.id; |
7269 |
26 Jun 23 |
nicklas |
alignedSequences[alignedSequences.length] = pair; |
7267 |
21 Jun 23 |
nicklas |
646 |
} |
7267 |
21 Jun 23 |
nicklas |
647 |
} |
7267 |
21 Jun 23 |
nicklas |
648 |
|
7267 |
21 Jun 23 |
nicklas |
var url = '../Ascat.servlet?ID='+App.getSessionId(); |
7267 |
21 Jun 23 |
nicklas |
url += '&cmd=StartAscatAnalysis'; |
7267 |
21 Jun 23 |
nicklas |
651 |
|
7267 |
21 Jun 23 |
nicklas |
Wizard.showLoadingAnimation('Performing registration...'); |
7267 |
21 Jun 23 |
nicklas |
Wizard.asyncJsonRequest(url, ascat.submissionResults, 'POST', JSON.stringify(submitInfo)); |
7267 |
21 Jun 23 |
nicklas |
654 |
} |
7267 |
21 Jun 23 |
nicklas |
655 |
|
7267 |
21 Jun 23 |
nicklas |
ascat.submissionResults = function(response) |
7267 |
21 Jun 23 |
nicklas |
657 |
{ |
7267 |
21 Jun 23 |
nicklas |
Wizard.showFinalMessage(response.messages); |
7267 |
21 Jun 23 |
nicklas |
Doc.show('gorestart'); |
7267 |
21 Jun 23 |
nicklas |
660 |
} |
7267 |
21 Jun 23 |
nicklas |
661 |
|
7267 |
21 Jun 23 |
nicklas |
return ascat; |
7267 |
21 Jun 23 |
nicklas |
663 |
}(); |
7267 |
21 Jun 23 |
nicklas |
664 |
|
7267 |
21 Jun 23 |
nicklas |
Doc.onLoad(Ascat.initPage); |
7267 |
21 Jun 23 |
nicklas |
666 |
|