5029 |
16 Oct 18 |
nicklas |
var MBaf = function() |
5029 |
16 Oct 18 |
nicklas |
2 |
{ |
5029 |
16 Oct 18 |
nicklas |
var mbaf = {}; |
5029 |
16 Oct 18 |
nicklas |
var debug = 0; |
5547 |
07 Aug 19 |
nicklas |
var selectionIsValid = false; |
5029 |
16 Oct 18 |
nicklas |
var subtypeAlignedSequences = null; |
5547 |
07 Aug 19 |
nicklas |
var annotationTypePipeline = null; |
5029 |
16 Oct 18 |
nicklas |
var fileTypeBAM = null; |
5029 |
16 Oct 18 |
nicklas |
9 |
|
5029 |
16 Oct 18 |
nicklas |
var clusterIsValid = false; |
5029 |
16 Oct 18 |
nicklas |
var manuallySelected = []; |
5029 |
16 Oct 18 |
nicklas |
12 |
|
5029 |
16 Oct 18 |
nicklas |
// Page initialization |
5029 |
16 Oct 18 |
nicklas |
mbaf.initPage = function() |
5029 |
16 Oct 18 |
nicklas |
15 |
{ |
5029 |
16 Oct 18 |
nicklas |
16 |
|
5029 |
16 Oct 18 |
nicklas |
// Step 1 |
5029 |
16 Oct 18 |
nicklas |
Buttons.addClickHandler('btnSelectAlignedSequences', mbaf.selectAlignedSequences); |
5029 |
16 Oct 18 |
nicklas |
Events.addEventHandler('alignedSequences', 'base-selected', mbaf.setAlignedSequenceCallback); |
5029 |
16 Oct 18 |
nicklas |
Events.addEventHandler('alignedSequences', 'change', mbaf.alignedSequencesOnChange); |
5029 |
16 Oct 18 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', mbaf.validateStep1); |
5029 |
16 Oct 18 |
nicklas |
22 |
|
5029 |
16 Oct 18 |
nicklas |
// Step 2 |
5029 |
16 Oct 18 |
nicklas |
Events.addEventHandler('step-2', 'wizard-initialize', mbaf.initializeStep2); |
5029 |
16 Oct 18 |
nicklas |
Events.addEventHandler('step-2', 'wizard-validate', mbaf.validateStep2); |
5029 |
16 Oct 18 |
nicklas |
Events.addEventHandler('clusters', 'change', mbaf.clusterOnChange); |
7372 |
06 Oct 23 |
nicklas |
Events.addEventHandler('debug', 'change', mbaf.debugOnChange); |
7372 |
06 Oct 23 |
nicklas |
Events.addEventHandler('override', 'change', mbaf.overrideOnChange); |
5029 |
16 Oct 18 |
nicklas |
Events.addEventHandler('mBafSoftware', 'change', mbaf.softwareOnChange); |
5029 |
16 Oct 18 |
nicklas |
30 |
|
5029 |
16 Oct 18 |
nicklas |
// Navigation |
5029 |
16 Oct 18 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
5029 |
16 Oct 18 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
5029 |
16 Oct 18 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
5029 |
16 Oct 18 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
5029 |
16 Oct 18 |
nicklas |
36 |
|
5029 |
16 Oct 18 |
nicklas |
// Final registration |
5029 |
16 Oct 18 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', mbaf.submit); |
5029 |
16 Oct 18 |
nicklas |
39 |
|
5029 |
16 Oct 18 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
5029 |
16 Oct 18 |
nicklas |
var url = '../MBaf.servlet?ID='+App.getSessionId(); |
5029 |
16 Oct 18 |
nicklas |
url += '&cmd=GetAlignedSequencesForMBafAnalysis'; |
5029 |
16 Oct 18 |
nicklas |
Wizard.asyncJsonRequest(url, mbaf.initializeStep1); |
5029 |
16 Oct 18 |
nicklas |
44 |
} |
5029 |
16 Oct 18 |
nicklas |
45 |
|
5029 |
16 Oct 18 |
nicklas |
// --- Step 1 ----------------------------------- |
5029 |
16 Oct 18 |
nicklas |
mbaf.initializeStep1 = function(response) |
5029 |
16 Oct 18 |
nicklas |
48 |
{ |
5029 |
16 Oct 18 |
nicklas |
var alignedSequences = response.alignedSequences; |
5029 |
16 Oct 18 |
nicklas |
var frm = document.forms['reggie']; |
5029 |
16 Oct 18 |
nicklas |
51 |
|
5029 |
16 Oct 18 |
nicklas |
if (alignedSequences != null && alignedSequences.length > 0) |
5029 |
16 Oct 18 |
nicklas |
53 |
{ |
5029 |
16 Oct 18 |
nicklas |
var firstPlate = null; |
5029 |
16 Oct 18 |
nicklas |
for (var asNo=0; asNo < alignedSequences.length; asNo++) |
5029 |
16 Oct 18 |
nicklas |
56 |
{ |
5029 |
16 Oct 18 |
nicklas |
var as = alignedSequences[asNo]; |
5029 |
16 Oct 18 |
nicklas |
var libPlate = as.lib.bioWell ? as.lib.bioWell.bioPlate : null; |
5029 |
16 Oct 18 |
nicklas |
if (firstPlate == null && libPlate != null) firstPlate = libPlate.name; |
5029 |
16 Oct 18 |
nicklas |
var option = mbaf.createListOption(asNo+1, as, as.DO_NOT_USE == null && libPlate != null && libPlate.name==firstPlate) |
5029 |
16 Oct 18 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
5029 |
16 Oct 18 |
nicklas |
62 |
} |
5547 |
07 Aug 19 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
5029 |
16 Oct 18 |
nicklas |
64 |
} |
5029 |
16 Oct 18 |
nicklas |
else |
5029 |
16 Oct 18 |
nicklas |
66 |
{ |
5029 |
16 Oct 18 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', 'No new sequences available for processing'); |
5029 |
16 Oct 18 |
nicklas |
68 |
} |
5029 |
16 Oct 18 |
nicklas |
69 |
|
5029 |
16 Oct 18 |
nicklas |
Doc.show('step-1'); |
5029 |
16 Oct 18 |
nicklas |
Doc.show('gonext'); |
5029 |
16 Oct 18 |
nicklas |
72 |
|
5029 |
16 Oct 18 |
nicklas |
frm.alignedSequences.focus(); |
5029 |
16 Oct 18 |
nicklas |
74 |
} |
5029 |
16 Oct 18 |
nicklas |
75 |
|
5029 |
16 Oct 18 |
nicklas |
mbaf.validateStep1 = function(event) |
5029 |
16 Oct 18 |
nicklas |
77 |
{ |
5547 |
07 Aug 19 |
nicklas |
if (!selectionIsValid) event.preventDefault(); |
5029 |
16 Oct 18 |
nicklas |
79 |
} |
5029 |
16 Oct 18 |
nicklas |
80 |
|
5029 |
16 Oct 18 |
nicklas |
mbaf.selectAlignedSequences = function() |
5029 |
16 Oct 18 |
nicklas |
82 |
{ |
5029 |
16 Oct 18 |
nicklas |
var frm = document.forms['reggie']; |
5029 |
16 Oct 18 |
nicklas |
if (frm.alignedSequences.disabled) return; |
5029 |
16 Oct 18 |
nicklas |
85 |
|
5029 |
16 Oct 18 |
nicklas |
if (subtypeAlignedSequences == null) |
5029 |
16 Oct 18 |
nicklas |
87 |
{ |
5029 |
16 Oct 18 |
nicklas |
subtypeAlignedSequences = Reggie.getSubtypeInfo('ALIGNED_SEQUENCES'); |
5029 |
16 Oct 18 |
nicklas |
89 |
} |
5029 |
16 Oct 18 |
nicklas |
if (fileTypeBAM == null) |
5029 |
16 Oct 18 |
nicklas |
91 |
{ |
5029 |
16 Oct 18 |
nicklas |
fileTypeBAM = Reggie.getDataFileTypeInfo('BAM'); |
5029 |
16 Oct 18 |
nicklas |
93 |
} |
5547 |
07 Aug 19 |
nicklas |
if (annotationTypePipeline == null) |
5547 |
07 Aug 19 |
nicklas |
95 |
{ |
5547 |
07 Aug 19 |
nicklas |
annotationTypePipeline = Reggie.getAnnotationTypeInfo('PIPELINE'); |
5547 |
07 Aug 19 |
nicklas |
97 |
} |
5029 |
16 Oct 18 |
nicklas |
98 |
|
5029 |
16 Oct 18 |
nicklas |
// Reset list |
5029 |
16 Oct 18 |
nicklas |
manuallySelected = []; |
5029 |
16 Oct 18 |
nicklas |
var url = '&resetTemporary=1'; |
5029 |
16 Oct 18 |
nicklas |
// Alignments with Hisat gives us 'AlignedSequences' items with 'alignment.bam' |
5029 |
16 Oct 18 |
nicklas |
url += '&tmpfilter:INT:itemSubtype='+subtypeAlignedSequences.id; |
5029 |
16 Oct 18 |
nicklas |
url += '&tmpfilter:STRING:'+encodeURIComponent('ยค'+fileTypeBAM.id+'(file.name)')+'=alignment.bam'; |
5547 |
07 Aug 19 |
nicklas |
url += '&tmpfilter:STRING:'+encodeURIComponent('#')+annotationTypePipeline.id+'='+encodeURIComponent('RNAseq/Hisat/StringTie'); |
5029 |
16 Oct 18 |
nicklas |
106 |
|
5029 |
16 Oct 18 |
nicklas |
Dialogs.selectItem('DERIVEDBIOASSAY', 'alignedSequences', 1, url); |
5029 |
16 Oct 18 |
nicklas |
108 |
} |
5029 |
16 Oct 18 |
nicklas |
109 |
|
5029 |
16 Oct 18 |
nicklas |
mbaf.setAlignedSequenceCallback = function(event) |
5029 |
16 Oct 18 |
nicklas |
111 |
{ |
5029 |
16 Oct 18 |
nicklas |
var ms = event.detail; |
5029 |
16 Oct 18 |
nicklas |
113 |
|
5029 |
16 Oct 18 |
nicklas |
var opt = Reggie.getListOption('alignedSequences', ms.id); |
5029 |
16 Oct 18 |
nicklas |
if (opt) |
5029 |
16 Oct 18 |
nicklas |
116 |
{ |
5029 |
16 Oct 18 |
nicklas |
opt.selected = true; |
5029 |
16 Oct 18 |
nicklas |
118 |
} |
5029 |
16 Oct 18 |
nicklas |
else |
5029 |
16 Oct 18 |
nicklas |
120 |
{ |
5029 |
16 Oct 18 |
nicklas |
manuallySelected[manuallySelected.length] = ms.id; |
5029 |
16 Oct 18 |
nicklas |
122 |
} |
5029 |
16 Oct 18 |
nicklas |
123 |
|
5029 |
16 Oct 18 |
nicklas |
if (ms.remaining == 0 && manuallySelected.length > 0) |
5029 |
16 Oct 18 |
nicklas |
125 |
{ |
5029 |
16 Oct 18 |
nicklas |
var url = '../MBaf.servlet?ID='+App.getSessionId(); |
5029 |
16 Oct 18 |
nicklas |
url += '&cmd=GetAlignedSequencesForMBafAnalysis'; |
5029 |
16 Oct 18 |
nicklas |
url += '&items='+manuallySelected.join(','); |
5029 |
16 Oct 18 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
5029 |
16 Oct 18 |
nicklas |
Wizard.asyncJsonRequest(url, mbaf.manuallySelected); |
5029 |
16 Oct 18 |
nicklas |
131 |
} |
5029 |
16 Oct 18 |
nicklas |
else |
5029 |
16 Oct 18 |
nicklas |
133 |
{ |
5029 |
16 Oct 18 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
5029 |
16 Oct 18 |
nicklas |
135 |
} |
5029 |
16 Oct 18 |
nicklas |
136 |
} |
5029 |
16 Oct 18 |
nicklas |
137 |
|
5029 |
16 Oct 18 |
nicklas |
mbaf.manuallySelected = function(response) |
5029 |
16 Oct 18 |
nicklas |
139 |
{ |
5029 |
16 Oct 18 |
nicklas |
var alignedSequences = response.alignedSequences; |
5029 |
16 Oct 18 |
nicklas |
var frm = document.forms['reggie']; |
5029 |
16 Oct 18 |
nicklas |
142 |
|
5029 |
16 Oct 18 |
nicklas |
if (alignedSequences != null && alignedSequences.length > 0) |
5029 |
16 Oct 18 |
nicklas |
144 |
{ |
5029 |
16 Oct 18 |
nicklas |
var offset = frm.alignedSequences.length+1; |
5029 |
16 Oct 18 |
nicklas |
for (var asNo=0; asNo < alignedSequences.length; asNo++) |
5029 |
16 Oct 18 |
nicklas |
147 |
{ |
5029 |
16 Oct 18 |
nicklas |
var as = alignedSequences[asNo]; |
5029 |
16 Oct 18 |
nicklas |
var option = mbaf.createListOption(asNo+offset, as, as.DO_NOT_USE == null); |
5029 |
16 Oct 18 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
5029 |
16 Oct 18 |
nicklas |
151 |
} |
5029 |
16 Oct 18 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
5029 |
16 Oct 18 |
nicklas |
153 |
} |
5029 |
16 Oct 18 |
nicklas |
154 |
} |
5029 |
16 Oct 18 |
nicklas |
155 |
|
5029 |
16 Oct 18 |
nicklas |
mbaf.createListOption = function(index, alignedItem, selected) |
5029 |
16 Oct 18 |
nicklas |
157 |
{ |
5029 |
16 Oct 18 |
nicklas |
var lib = alignedItem.lib; |
5029 |
16 Oct 18 |
nicklas |
var isYellow = lib.specimen && lib.specimen.YellowLabel != null; |
5029 |
16 Oct 18 |
nicklas |
var libPlate = lib.bioWell ? lib.bioWell.bioPlate : null; |
5029 |
16 Oct 18 |
nicklas |
161 |
|
5029 |
16 Oct 18 |
nicklas |
var tooltip = null; |
5029 |
16 Oct 18 |
nicklas |
var name = (index) + ': '; |
5029 |
16 Oct 18 |
nicklas |
if (libPlate) name += libPlate.name + ' - '; |
5029 |
16 Oct 18 |
nicklas |
name += alignedItem.name; |
5029 |
16 Oct 18 |
nicklas |
166 |
|
5029 |
16 Oct 18 |
nicklas |
if (alignedItem.DO_NOT_USE) |
5029 |
16 Oct 18 |
nicklas |
168 |
{ |
5029 |
16 Oct 18 |
nicklas |
name += ' [DoNotUse]'; |
5029 |
16 Oct 18 |
nicklas |
tooltip = 'DoNotUse-'+Strings.encodeTags(alignedItem.DO_NOT_USE+': '+alignedItem.DO_NOT_USE_COMMENT); |
5029 |
16 Oct 18 |
nicklas |
171 |
} |
5029 |
16 Oct 18 |
nicklas |
else if (alignedItem.AutoProcess == 'ReProcess') |
5029 |
16 Oct 18 |
nicklas |
173 |
{ |
5029 |
16 Oct 18 |
nicklas |
name += ' [R]'; |
5029 |
16 Oct 18 |
nicklas |
175 |
} |
5029 |
16 Oct 18 |
nicklas |
176 |
|
5029 |
16 Oct 18 |
nicklas |
var option = new Option(name, alignedItem.id, false, selected); |
5029 |
16 Oct 18 |
nicklas |
if (isYellow) option.className = 'yellow'; |
5029 |
16 Oct 18 |
nicklas |
if (tooltip) option.title = tooltip; |
5029 |
16 Oct 18 |
nicklas |
option.alignedSequences = alignedItem; |
5029 |
16 Oct 18 |
nicklas |
return option; |
5029 |
16 Oct 18 |
nicklas |
182 |
} |
5029 |
16 Oct 18 |
nicklas |
183 |
|
5029 |
16 Oct 18 |
nicklas |
mbaf.alignedSequencesOnChange = function() |
5029 |
16 Oct 18 |
nicklas |
185 |
{ |
5029 |
16 Oct 18 |
nicklas |
var frm = document.forms['reggie']; |
5547 |
07 Aug 19 |
nicklas |
selectionIsValid = false; |
5547 |
07 Aug 19 |
nicklas |
var numSelected = 0; |
5547 |
07 Aug 19 |
nicklas |
var numDoNotUse = 0; |
5547 |
07 Aug 19 |
nicklas |
var invalidPipeline = null; |
5547 |
07 Aug 19 |
nicklas |
Wizard.setInputStatus('alignedSequences'); |
5547 |
07 Aug 19 |
nicklas |
Wizard.hideGoNextConfirmation(); |
5029 |
16 Oct 18 |
nicklas |
193 |
|
5029 |
16 Oct 18 |
nicklas |
for (var asNo = 0; asNo < frm.alignedSequences.length; asNo++) |
5029 |
16 Oct 18 |
nicklas |
195 |
{ |
5029 |
16 Oct 18 |
nicklas |
if (frm.alignedSequences[asNo].selected) |
5029 |
16 Oct 18 |
nicklas |
197 |
{ |
5547 |
07 Aug 19 |
nicklas |
numSelected++; |
5029 |
16 Oct 18 |
nicklas |
var as = frm.alignedSequences[asNo].alignedSequences; |
5029 |
16 Oct 18 |
nicklas |
if (as.DO_NOT_USE) numDoNotUse++; |
5547 |
07 Aug 19 |
nicklas |
if (as.pipeline && as.pipeline != 'RNAseq/Hisat/StringTie') |
5547 |
07 Aug 19 |
nicklas |
202 |
{ |
5547 |
07 Aug 19 |
nicklas |
invalidPipeline = Strings.encodeTags(as.name+' ('+as.pipeline)+') is not intended for the RNAseq/Hisat/StringTie pipeline.'; |
5547 |
07 Aug 19 |
nicklas |
204 |
} |
5029 |
16 Oct 18 |
nicklas |
205 |
} |
5029 |
16 Oct 18 |
nicklas |
206 |
} |
5029 |
16 Oct 18 |
nicklas |
207 |
|
5547 |
07 Aug 19 |
nicklas |
if (numSelected == 0) |
5547 |
07 Aug 19 |
nicklas |
209 |
{ |
5547 |
07 Aug 19 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', 'Select at least one item'); |
5547 |
07 Aug 19 |
nicklas |
return; |
5547 |
07 Aug 19 |
nicklas |
212 |
} |
5547 |
07 Aug 19 |
nicklas |
if (invalidPipeline) |
5547 |
07 Aug 19 |
nicklas |
214 |
{ |
5547 |
07 Aug 19 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', invalidPipeline); |
5547 |
07 Aug 19 |
nicklas |
return; |
5547 |
07 Aug 19 |
nicklas |
217 |
} |
5547 |
07 Aug 19 |
nicklas |
selectionIsValid = true; |
5547 |
07 Aug 19 |
nicklas |
219 |
|
5029 |
16 Oct 18 |
nicklas |
if (numDoNotUse > 0) |
5029 |
16 Oct 18 |
nicklas |
221 |
{ |
5029 |
16 Oct 18 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'warning', numDoNotUse + ' selected items marked as DoNotUse'); |
5029 |
16 Oct 18 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Confirm ' + numDoNotUse + ' items marked as DoNotUse'); |
5029 |
16 Oct 18 |
nicklas |
224 |
} |
5029 |
16 Oct 18 |
nicklas |
else |
5029 |
16 Oct 18 |
nicklas |
226 |
{ |
5547 |
07 Aug 19 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'valid'); |
5029 |
16 Oct 18 |
nicklas |
228 |
} |
5029 |
16 Oct 18 |
nicklas |
229 |
} |
5029 |
16 Oct 18 |
nicklas |
230 |
|
5029 |
16 Oct 18 |
nicklas |
// --- Step 2 ----------------------------------- |
5029 |
16 Oct 18 |
nicklas |
mbaf.initializeStep2 = function() |
5029 |
16 Oct 18 |
nicklas |
233 |
{ |
5029 |
16 Oct 18 |
nicklas |
Wizard.setCurrentStep(2); |
5029 |
16 Oct 18 |
nicklas |
235 |
|
5029 |
16 Oct 18 |
nicklas |
// Check debug by default if debug is set or not on a secure server (=production server) |
5029 |
16 Oct 18 |
nicklas |
var frm = document.forms['reggie']; |
5029 |
16 Oct 18 |
nicklas |
frm.debug.checked = debug || location.protocol != 'https:'; |
5029 |
16 Oct 18 |
nicklas |
239 |
|
5057 |
29 Oct 18 |
nicklas |
Reggie.loadSoftware('VARIANT_CALLING_SOFTWARE', 'mBafSoftware', 'VARIANT_CALL_TYPE,PARAMETER_SET', 'mBAF'); |
5029 |
16 Oct 18 |
nicklas |
241 |
|
6735 |
09 May 22 |
nicklas |
// Load clusters |
6633 |
08 Mar 22 |
nicklas |
var url = '../OpenGrid.servlet?ID='+App.getSessionId() + '&cmd=GetHostInfo&config=mbaf'; |
5029 |
16 Oct 18 |
nicklas |
Doc.addClass('clusters', 'list-loading'); |
5029 |
16 Oct 18 |
nicklas |
frm.clusters[0] = new Option('loading...'); |
5029 |
16 Oct 18 |
nicklas |
Wizard.asyncJsonRequest(url, mbaf.clustersLoaded); |
5029 |
16 Oct 18 |
nicklas |
247 |
|
5029 |
16 Oct 18 |
nicklas |
Doc.show('goregister'); |
5029 |
16 Oct 18 |
nicklas |
Doc.show('gocancel'); |
5029 |
16 Oct 18 |
nicklas |
250 |
} |
5029 |
16 Oct 18 |
nicklas |
251 |
|
5029 |
16 Oct 18 |
nicklas |
mbaf.validateStep2 = function(event) |
5029 |
16 Oct 18 |
nicklas |
253 |
{ |
5029 |
16 Oct 18 |
nicklas |
if (!clusterIsValid) event.preventDefault(); |
5029 |
16 Oct 18 |
nicklas |
255 |
} |
5029 |
16 Oct 18 |
nicklas |
256 |
|
5029 |
16 Oct 18 |
nicklas |
mbaf.clustersLoaded = function(response) |
5029 |
16 Oct 18 |
nicklas |
258 |
{ |
5029 |
16 Oct 18 |
nicklas |
Doc.removeClass('clusters', 'list-loading'); |
5029 |
16 Oct 18 |
nicklas |
var frm = document.forms['reggie']; |
5029 |
16 Oct 18 |
nicklas |
var clusters = response.hosts; |
5029 |
16 Oct 18 |
nicklas |
frm.clusters.length = 0; |
5029 |
16 Oct 18 |
nicklas |
for (var i = 0; i < clusters.length; i++) |
5029 |
16 Oct 18 |
nicklas |
264 |
{ |
5029 |
16 Oct 18 |
nicklas |
var cl = clusters[i]; |
5029 |
16 Oct 18 |
nicklas |
var option = new Option(cl.connection.name, cl.id); |
5029 |
16 Oct 18 |
nicklas |
option.cluster = cl; |
5029 |
16 Oct 18 |
nicklas |
frm.clusters[frm.clusters.length] = option; |
5029 |
16 Oct 18 |
nicklas |
Wizard.setInputStatus('clusters', 'valid'); |
5029 |
16 Oct 18 |
nicklas |
clusterIsValid = true; |
5029 |
16 Oct 18 |
nicklas |
271 |
} |
5029 |
16 Oct 18 |
nicklas |
if (frm.clusters.length == 0) |
5029 |
16 Oct 18 |
nicklas |
273 |
{ |
6735 |
09 May 22 |
nicklas |
Wizard.setInputStatus('clusters', 'invalid', 'No available clusters'); |
5029 |
16 Oct 18 |
nicklas |
clusterIsValid = false; |
5029 |
16 Oct 18 |
nicklas |
276 |
} |
5029 |
16 Oct 18 |
nicklas |
else |
5029 |
16 Oct 18 |
nicklas |
278 |
{ |
5029 |
16 Oct 18 |
nicklas |
mbaf.clusterOnChange(); |
5029 |
16 Oct 18 |
nicklas |
280 |
} |
5029 |
16 Oct 18 |
nicklas |
281 |
} |
5029 |
16 Oct 18 |
nicklas |
282 |
|
5029 |
16 Oct 18 |
nicklas |
mbaf.softwareOnChange = function(event) |
5029 |
16 Oct 18 |
nicklas |
284 |
{ |
5029 |
16 Oct 18 |
nicklas |
var target = event.currentTarget; |
5029 |
16 Oct 18 |
nicklas |
var item = target[target.selectedIndex].item; |
5029 |
16 Oct 18 |
nicklas |
if (!item) item = {}; |
5029 |
16 Oct 18 |
nicklas |
288 |
|
5029 |
16 Oct 18 |
nicklas |
Doc.element(target.id+'.parameterSet').innerHTML = Strings.encodeTags(item.ParameterSet || 'default'); |
5029 |
16 Oct 18 |
nicklas |
Doc.element(target.id+'.description').innerHTML = Strings.encodeTags(item.description); |
5029 |
16 Oct 18 |
nicklas |
Wizard.setInputStatus(target.id, 'valid'); |
5029 |
16 Oct 18 |
nicklas |
292 |
|
5029 |
16 Oct 18 |
nicklas |
if (item.ParameterSet) |
5029 |
16 Oct 18 |
nicklas |
294 |
{ |
5029 |
16 Oct 18 |
nicklas |
var url = '../Install.servlet?ID='+App.getSessionId(); |
5029 |
16 Oct 18 |
nicklas |
url += '&cmd=GetParameterSetInfo'; |
5029 |
16 Oct 18 |
nicklas |
url += '¶meterSet='+encodeURIComponent(item.ParameterSet); |
5029 |
16 Oct 18 |
nicklas |
url += '&targetId='+target.id; |
5029 |
16 Oct 18 |
nicklas |
Wizard.asyncJsonRequest(url, mbaf.parameterSetInfoLoaded); |
5029 |
16 Oct 18 |
nicklas |
300 |
} |
7372 |
06 Oct 23 |
nicklas |
mbaf.updateSubmitOptions(); |
5029 |
16 Oct 18 |
nicklas |
302 |
} |
5029 |
16 Oct 18 |
nicklas |
303 |
|
5029 |
16 Oct 18 |
nicklas |
mbaf.parameterSetInfoLoaded = function(response) |
5029 |
16 Oct 18 |
nicklas |
305 |
{ |
5029 |
16 Oct 18 |
nicklas |
if (!response.parameters || response.parameters.length == 0) |
5029 |
16 Oct 18 |
nicklas |
307 |
{ |
5029 |
16 Oct 18 |
nicklas |
Wizard.setInputStatus(response.targetId, 'warning', 'Can\'t find \'' + Strings.encodeTags(response.parameterSet) + '\' parameter set in reggie-config.xml'); |
5029 |
16 Oct 18 |
nicklas |
309 |
} |
5029 |
16 Oct 18 |
nicklas |
310 |
} |
5029 |
16 Oct 18 |
nicklas |
311 |
|
5029 |
16 Oct 18 |
nicklas |
mbaf.clusterOnChange = function() |
5029 |
16 Oct 18 |
nicklas |
313 |
{ |
5029 |
16 Oct 18 |
nicklas |
var frm = document.forms['reggie']; |
5029 |
16 Oct 18 |
nicklas |
var cluster = frm.clusters[frm.clusters.selectedIndex].cluster; |
5029 |
16 Oct 18 |
nicklas |
if (cluster.priorities && cluster.priorities.length > 0) |
5029 |
16 Oct 18 |
nicklas |
317 |
{ |
5029 |
16 Oct 18 |
nicklas |
frm.priority.length = 0; |
5029 |
16 Oct 18 |
nicklas |
for (var pNo = 0; pNo < cluster.priorities.length; pNo++) |
5029 |
16 Oct 18 |
nicklas |
320 |
{ |
5029 |
16 Oct 18 |
nicklas |
var p = cluster.priorities[pNo]; |
5029 |
16 Oct 18 |
nicklas |
frm.priority[frm.priority.length] = new Option(p.name + ' ('+p.value+')', p.value, p['default'], p['default']); |
5029 |
16 Oct 18 |
nicklas |
323 |
} |
5029 |
16 Oct 18 |
nicklas |
Doc.show('job-priority'); |
5029 |
16 Oct 18 |
nicklas |
325 |
} |
5029 |
16 Oct 18 |
nicklas |
else |
5029 |
16 Oct 18 |
nicklas |
327 |
{ |
5029 |
16 Oct 18 |
nicklas |
Doc.hide('job-priority'); |
5029 |
16 Oct 18 |
nicklas |
329 |
} |
6980 |
17 Jan 23 |
nicklas |
if (cluster.partitions && cluster.partitions.length > 0) |
6980 |
17 Jan 23 |
nicklas |
331 |
{ |
6980 |
17 Jan 23 |
nicklas |
frm.partition.length = 0; |
6980 |
17 Jan 23 |
nicklas |
for (var pNo = 0; pNo < cluster.partitions.length; pNo++) |
6980 |
17 Jan 23 |
nicklas |
334 |
{ |
6980 |
17 Jan 23 |
nicklas |
var p = cluster.partitions[pNo]; |
6980 |
17 Jan 23 |
nicklas |
var title = p.name; |
6980 |
17 Jan 23 |
nicklas |
if (p.description) title += ' ('+p.description+')'; |
6980 |
17 Jan 23 |
nicklas |
frm.partition[frm.partition.length] = new Option(title, p.value, p['default'], p['default']); |
6980 |
17 Jan 23 |
nicklas |
339 |
} |
6980 |
17 Jan 23 |
nicklas |
Doc.show('job-partition'); |
6980 |
17 Jan 23 |
nicklas |
341 |
} |
6980 |
17 Jan 23 |
nicklas |
else |
6980 |
17 Jan 23 |
nicklas |
343 |
{ |
6980 |
17 Jan 23 |
nicklas |
Doc.hide('job-partition'); |
6980 |
17 Jan 23 |
nicklas |
345 |
} |
7372 |
06 Oct 23 |
nicklas |
mbaf.updateSubmitOptions(); |
5029 |
16 Oct 18 |
nicklas |
347 |
} |
7372 |
06 Oct 23 |
nicklas |
348 |
|
7372 |
06 Oct 23 |
nicklas |
mbaf.debugOnChange = function() |
7372 |
06 Oct 23 |
nicklas |
350 |
{ |
7372 |
06 Oct 23 |
nicklas |
mbaf.updateSubmitOptions(); |
7372 |
06 Oct 23 |
nicklas |
352 |
} |
7372 |
06 Oct 23 |
nicklas |
353 |
|
7372 |
06 Oct 23 |
nicklas |
mbaf.updateSubmitOptions = function() |
7372 |
06 Oct 23 |
nicklas |
355 |
{ |
7372 |
06 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7372 |
06 Oct 23 |
nicklas |
var config = frm.clusters[frm.clusters.selectedIndex]?.cluster?.config?.mbaf; |
7372 |
06 Oct 23 |
nicklas |
if (config) |
7372 |
06 Oct 23 |
nicklas |
359 |
{ |
7372 |
06 Oct 23 |
nicklas |
var parameterSet = frm.mBafSoftware[frm.mBafSoftware.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 |
363 |
} |
7372 |
06 Oct 23 |
nicklas |
364 |
} |
7372 |
06 Oct 23 |
nicklas |
365 |
|
7372 |
06 Oct 23 |
nicklas |
mbaf.overrideOnChange = function() |
7372 |
06 Oct 23 |
nicklas |
367 |
{ |
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 |
372 |
{ |
7372 |
06 Oct 23 |
nicklas |
frm.submitOptionsOverride.value = Doc.element('submitOptions').innerHTML; |
7372 |
06 Oct 23 |
nicklas |
374 |
} |
7372 |
06 Oct 23 |
nicklas |
375 |
} |
5029 |
16 Oct 18 |
nicklas |
376 |
|
5029 |
16 Oct 18 |
nicklas |
mbaf.submit = function() |
5029 |
16 Oct 18 |
nicklas |
378 |
{ |
5029 |
16 Oct 18 |
nicklas |
var frm = document.forms['reggie']; |
5029 |
16 Oct 18 |
nicklas |
380 |
|
5029 |
16 Oct 18 |
nicklas |
var submitInfo = {}; |
5057 |
29 Oct 18 |
nicklas |
submitInfo.mBafSoftware = parseInt(frm.mBafSoftware.value); |
5029 |
16 Oct 18 |
nicklas |
submitInfo.cluster = frm.clusters.value; |
5029 |
16 Oct 18 |
nicklas |
if (frm.priority.selectedIndex >= 0) |
5029 |
16 Oct 18 |
nicklas |
385 |
{ |
5029 |
16 Oct 18 |
nicklas |
submitInfo.priority = parseInt(frm.priority.value); |
5029 |
16 Oct 18 |
nicklas |
387 |
} |
6980 |
17 Jan 23 |
nicklas |
if (frm.partition.selectedIndex >= 0) |
6980 |
17 Jan 23 |
nicklas |
389 |
{ |
6980 |
17 Jan 23 |
nicklas |
submitInfo.partition = frm.partition.value; |
6980 |
17 Jan 23 |
nicklas |
391 |
} |
7372 |
06 Oct 23 |
nicklas |
if (frm.override.checked) |
7372 |
06 Oct 23 |
nicklas |
393 |
{ |
7372 |
06 Oct 23 |
nicklas |
submitInfo.submitOptionsOverride = frm.submitOptionsOverride.value; |
7372 |
06 Oct 23 |
nicklas |
395 |
} |
5029 |
16 Oct 18 |
nicklas |
submitInfo.debug = frm.debug.checked; |
5029 |
16 Oct 18 |
nicklas |
submitInfo.autoConfirm = frm.autoConfirm.checked; |
5029 |
16 Oct 18 |
nicklas |
398 |
|
5029 |
16 Oct 18 |
nicklas |
var alignedSequences = []; |
5029 |
16 Oct 18 |
nicklas |
submitInfo.alignedSequences = alignedSequences; |
5029 |
16 Oct 18 |
nicklas |
401 |
|
5029 |
16 Oct 18 |
nicklas |
for (var asNo = 0; asNo < frm.alignedSequences.length; asNo++) |
5029 |
16 Oct 18 |
nicklas |
403 |
{ |
5029 |
16 Oct 18 |
nicklas |
if (frm.alignedSequences[asNo].selected) |
5029 |
16 Oct 18 |
nicklas |
405 |
{ |
5029 |
16 Oct 18 |
nicklas |
var as = {}; |
5029 |
16 Oct 18 |
nicklas |
as.id = frm.alignedSequences[asNo].alignedSequences.id; |
5029 |
16 Oct 18 |
nicklas |
alignedSequences[alignedSequences.length] = as; |
5029 |
16 Oct 18 |
nicklas |
409 |
} |
5029 |
16 Oct 18 |
nicklas |
410 |
} |
5029 |
16 Oct 18 |
nicklas |
411 |
|
5029 |
16 Oct 18 |
nicklas |
var url = '../MBaf.servlet?ID='+App.getSessionId(); |
5029 |
16 Oct 18 |
nicklas |
url += '&cmd=StartMBafAnalysis'; |
5029 |
16 Oct 18 |
nicklas |
414 |
|
5029 |
16 Oct 18 |
nicklas |
Wizard.showLoadingAnimation('Performing registration...'); |
5029 |
16 Oct 18 |
nicklas |
Wizard.asyncJsonRequest(url, mbaf.submissionResults, 'POST', JSON.stringify(submitInfo)); |
5029 |
16 Oct 18 |
nicklas |
417 |
} |
5029 |
16 Oct 18 |
nicklas |
418 |
|
5029 |
16 Oct 18 |
nicklas |
mbaf.submissionResults = function(response) |
5029 |
16 Oct 18 |
nicklas |
420 |
{ |
5029 |
16 Oct 18 |
nicklas |
Wizard.showFinalMessage(response.messages); |
5029 |
16 Oct 18 |
nicklas |
Doc.show('gorestart'); |
5029 |
16 Oct 18 |
nicklas |
423 |
} |
5029 |
16 Oct 18 |
nicklas |
424 |
|
5029 |
16 Oct 18 |
nicklas |
return mbaf; |
5029 |
16 Oct 18 |
nicklas |
426 |
}(); |
5029 |
16 Oct 18 |
nicklas |
427 |
|
5029 |
16 Oct 18 |
nicklas |
Doc.onLoad(MBaf.initPage); |
5029 |
16 Oct 18 |
nicklas |
429 |
|