6818 |
26 Aug 22 |
nicklas |
var StringTie = function() |
6818 |
26 Aug 22 |
nicklas |
2 |
{ |
6818 |
26 Aug 22 |
nicklas |
var stringtie = {}; |
6818 |
26 Aug 22 |
nicklas |
var debug = 0; |
6818 |
26 Aug 22 |
nicklas |
var selectionIsValid = false; |
6818 |
26 Aug 22 |
nicklas |
var subtypeAlignedSequences = null; |
6818 |
26 Aug 22 |
nicklas |
var annotationTypePipeline = null; |
6818 |
26 Aug 22 |
nicklas |
var fileTypeBAM = null; |
6818 |
26 Aug 22 |
nicklas |
9 |
|
6818 |
26 Aug 22 |
nicklas |
var clusterIsValid = false; |
6818 |
26 Aug 22 |
nicklas |
var arrayDesignIsValid = false; |
6818 |
26 Aug 22 |
nicklas |
var manuallySelected = []; |
6818 |
26 Aug 22 |
nicklas |
13 |
|
6818 |
26 Aug 22 |
nicklas |
// Page initialization |
6818 |
26 Aug 22 |
nicklas |
stringtie.initPage = function() |
6818 |
26 Aug 22 |
nicklas |
16 |
{ |
6818 |
26 Aug 22 |
nicklas |
17 |
|
6818 |
26 Aug 22 |
nicklas |
// Step 1 |
6818 |
26 Aug 22 |
nicklas |
Buttons.addClickHandler('btnSelectAlignedSequences', stringtie.selectAlignedSequences); |
6818 |
26 Aug 22 |
nicklas |
Events.addEventHandler('alignedSequences', 'base-selected', stringtie.setAlignedSequenceCallback); |
6818 |
26 Aug 22 |
nicklas |
Events.addEventHandler('alignedSequences', 'change', stringtie.alignedSequencesOnChange); |
6818 |
26 Aug 22 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', stringtie.validateStep1); |
6818 |
26 Aug 22 |
nicklas |
23 |
|
6818 |
26 Aug 22 |
nicklas |
// Step 2 |
6818 |
26 Aug 22 |
nicklas |
Events.addEventHandler('step-2', 'wizard-initialize', stringtie.initializeStep2); |
6818 |
26 Aug 22 |
nicklas |
Events.addEventHandler('step-2', 'wizard-validate', stringtie.validateStep2); |
6818 |
26 Aug 22 |
nicklas |
Events.addEventHandler('clusters', 'change', stringtie.clusterOnChange); |
7372 |
06 Oct 23 |
nicklas |
Events.addEventHandler('debug', 'change', stringtie.debugOnChange); |
7372 |
06 Oct 23 |
nicklas |
Events.addEventHandler('override', 'change', stringtie.overrideOnChange); |
6818 |
26 Aug 22 |
nicklas |
Events.addEventHandler('stringtieSoftware', 'change', stringtie.softwareOnChange); |
6818 |
26 Aug 22 |
nicklas |
31 |
|
6818 |
26 Aug 22 |
nicklas |
// Navigation |
6818 |
26 Aug 22 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
6818 |
26 Aug 22 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
6818 |
26 Aug 22 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
6818 |
26 Aug 22 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
6818 |
26 Aug 22 |
nicklas |
37 |
|
6818 |
26 Aug 22 |
nicklas |
// Final registration |
6818 |
26 Aug 22 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', stringtie.submit); |
6818 |
26 Aug 22 |
nicklas |
40 |
|
6818 |
26 Aug 22 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
6818 |
26 Aug 22 |
nicklas |
var url = '../StringTie2023.servlet?ID='+App.getSessionId(); |
6818 |
26 Aug 22 |
nicklas |
url += '&cmd=GetAlignedSequencesForStringTie2023'; |
6818 |
26 Aug 22 |
nicklas |
Wizard.asyncJsonRequest(url, stringtie.initializeStep1); |
6818 |
26 Aug 22 |
nicklas |
45 |
} |
6818 |
26 Aug 22 |
nicklas |
46 |
|
6818 |
26 Aug 22 |
nicklas |
// --- Step 1 ----------------------------------- |
6818 |
26 Aug 22 |
nicklas |
stringtie.initializeStep1 = function(response) |
6818 |
26 Aug 22 |
nicklas |
49 |
{ |
6818 |
26 Aug 22 |
nicklas |
var alignedSequences = response.alignedSequences; |
6818 |
26 Aug 22 |
nicklas |
var frm = document.forms['reggie']; |
6818 |
26 Aug 22 |
nicklas |
52 |
|
6818 |
26 Aug 22 |
nicklas |
if (alignedSequences != null && alignedSequences.length > 0) |
6818 |
26 Aug 22 |
nicklas |
54 |
{ |
6818 |
26 Aug 22 |
nicklas |
var firstPlate = null; |
6818 |
26 Aug 22 |
nicklas |
for (var asNo=0; asNo < alignedSequences.length; asNo++) |
6818 |
26 Aug 22 |
nicklas |
57 |
{ |
6818 |
26 Aug 22 |
nicklas |
var as = alignedSequences[asNo]; |
6818 |
26 Aug 22 |
nicklas |
var libPlate = as.lib.bioWell ? as.lib.bioWell.bioPlate : null; |
6818 |
26 Aug 22 |
nicklas |
if (firstPlate == null && libPlate != null) firstPlate = libPlate.name; |
6818 |
26 Aug 22 |
nicklas |
var option = stringtie.createListOption(asNo+1, as, as.DO_NOT_USE == null && libPlate != null && libPlate.name==firstPlate) |
6818 |
26 Aug 22 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
6818 |
26 Aug 22 |
nicklas |
63 |
} |
6818 |
26 Aug 22 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
6818 |
26 Aug 22 |
nicklas |
65 |
} |
6818 |
26 Aug 22 |
nicklas |
else |
6818 |
26 Aug 22 |
nicklas |
67 |
{ |
6818 |
26 Aug 22 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', 'No new sequences available for processing'); |
6818 |
26 Aug 22 |
nicklas |
69 |
} |
6818 |
26 Aug 22 |
nicklas |
70 |
|
6818 |
26 Aug 22 |
nicklas |
Doc.show('step-1'); |
6818 |
26 Aug 22 |
nicklas |
Doc.show('gonext'); |
6818 |
26 Aug 22 |
nicklas |
73 |
|
6818 |
26 Aug 22 |
nicklas |
frm.alignedSequences.focus(); |
6818 |
26 Aug 22 |
nicklas |
75 |
} |
6818 |
26 Aug 22 |
nicklas |
76 |
|
6818 |
26 Aug 22 |
nicklas |
stringtie.validateStep1 = function(event) |
6818 |
26 Aug 22 |
nicklas |
78 |
{ |
6818 |
26 Aug 22 |
nicklas |
if (!selectionIsValid) event.preventDefault(); |
6818 |
26 Aug 22 |
nicklas |
80 |
} |
6818 |
26 Aug 22 |
nicklas |
81 |
|
6818 |
26 Aug 22 |
nicklas |
stringtie.selectAlignedSequences = function() |
6818 |
26 Aug 22 |
nicklas |
83 |
{ |
6818 |
26 Aug 22 |
nicklas |
var frm = document.forms['reggie']; |
6818 |
26 Aug 22 |
nicklas |
if (frm.alignedSequences.disabled) return; |
6818 |
26 Aug 22 |
nicklas |
86 |
|
6818 |
26 Aug 22 |
nicklas |
if (subtypeAlignedSequences == null) |
6818 |
26 Aug 22 |
nicklas |
88 |
{ |
6818 |
26 Aug 22 |
nicklas |
subtypeAlignedSequences = Reggie.getSubtypeInfo('ALIGNED_SEQUENCES'); |
6818 |
26 Aug 22 |
nicklas |
90 |
} |
6818 |
26 Aug 22 |
nicklas |
if (fileTypeBAM == null) |
6818 |
26 Aug 22 |
nicklas |
92 |
{ |
6818 |
26 Aug 22 |
nicklas |
fileTypeBAM = Reggie.getDataFileTypeInfo('BAM'); |
6818 |
26 Aug 22 |
nicklas |
94 |
} |
6818 |
26 Aug 22 |
nicklas |
if (annotationTypePipeline == null) |
6818 |
26 Aug 22 |
nicklas |
96 |
{ |
6818 |
26 Aug 22 |
nicklas |
annotationTypePipeline = Reggie.getAnnotationTypeInfo('PIPELINE'); |
6818 |
26 Aug 22 |
nicklas |
98 |
} |
6818 |
26 Aug 22 |
nicklas |
99 |
|
6818 |
26 Aug 22 |
nicklas |
// Reset list |
6818 |
26 Aug 22 |
nicklas |
manuallySelected = []; |
6818 |
26 Aug 22 |
nicklas |
var url = '&resetTemporary=1'; |
6818 |
26 Aug 22 |
nicklas |
// Alignments with Hisat gives us 'AlignedSequences' items with 'alignment.bam' |
6818 |
26 Aug 22 |
nicklas |
url += '&tmpfilter:INT:itemSubtype='+subtypeAlignedSequences.id; |
6818 |
26 Aug 22 |
nicklas |
url += '&tmpfilter:STRING:'+encodeURIComponent('ยค'+fileTypeBAM.id+'(file.name)')+'=alignment.bam'; |
6818 |
26 Aug 22 |
nicklas |
url += '&tmpfilter:STRING:'+encodeURIComponent('#')+annotationTypePipeline.id+'='+encodeURIComponent('RNAseq/Hisat/2023'); |
6818 |
26 Aug 22 |
nicklas |
107 |
|
6818 |
26 Aug 22 |
nicklas |
Dialogs.selectItem('DERIVEDBIOASSAY', 'alignedSequences', 1, url); |
6818 |
26 Aug 22 |
nicklas |
109 |
} |
6818 |
26 Aug 22 |
nicklas |
110 |
|
6818 |
26 Aug 22 |
nicklas |
stringtie.setAlignedSequenceCallback = function(event) |
6818 |
26 Aug 22 |
nicklas |
112 |
{ |
6818 |
26 Aug 22 |
nicklas |
var ms = event.detail; |
6818 |
26 Aug 22 |
nicklas |
114 |
|
6818 |
26 Aug 22 |
nicklas |
var opt = Reggie.getListOption('alignedSequences', ms.id); |
6818 |
26 Aug 22 |
nicklas |
if (opt) |
6818 |
26 Aug 22 |
nicklas |
117 |
{ |
6818 |
26 Aug 22 |
nicklas |
opt.selected = true; |
6818 |
26 Aug 22 |
nicklas |
119 |
} |
6818 |
26 Aug 22 |
nicklas |
else |
6818 |
26 Aug 22 |
nicklas |
121 |
{ |
6818 |
26 Aug 22 |
nicklas |
manuallySelected[manuallySelected.length] = ms.id; |
6818 |
26 Aug 22 |
nicklas |
123 |
} |
6818 |
26 Aug 22 |
nicklas |
124 |
|
6818 |
26 Aug 22 |
nicklas |
if (ms.remaining == 0 && manuallySelected.length > 0) |
6818 |
26 Aug 22 |
nicklas |
126 |
{ |
6818 |
26 Aug 22 |
nicklas |
var url = '../StringTie2023.servlet?ID='+App.getSessionId(); |
6818 |
26 Aug 22 |
nicklas |
url += '&cmd=GetAlignedSequencesForStringTie2023'; |
6818 |
26 Aug 22 |
nicklas |
url += '&items='+manuallySelected.join(','); |
6818 |
26 Aug 22 |
nicklas |
Wizard.showLoadingAnimation('Loading bioassays...'); |
6818 |
26 Aug 22 |
nicklas |
Wizard.asyncJsonRequest(url, stringtie.manuallySelected); |
6818 |
26 Aug 22 |
nicklas |
132 |
} |
6818 |
26 Aug 22 |
nicklas |
else |
6818 |
26 Aug 22 |
nicklas |
134 |
{ |
6818 |
26 Aug 22 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
6818 |
26 Aug 22 |
nicklas |
136 |
} |
6818 |
26 Aug 22 |
nicklas |
137 |
} |
6818 |
26 Aug 22 |
nicklas |
138 |
|
6818 |
26 Aug 22 |
nicklas |
stringtie.manuallySelected = function(response) |
6818 |
26 Aug 22 |
nicklas |
140 |
{ |
6818 |
26 Aug 22 |
nicklas |
var alignedSequences = response.alignedSequences; |
6818 |
26 Aug 22 |
nicklas |
var frm = document.forms['reggie']; |
6818 |
26 Aug 22 |
nicklas |
143 |
|
6818 |
26 Aug 22 |
nicklas |
if (alignedSequences != null && alignedSequences.length > 0) |
6818 |
26 Aug 22 |
nicklas |
145 |
{ |
6818 |
26 Aug 22 |
nicklas |
var offset = frm.alignedSequences.length+1; |
6818 |
26 Aug 22 |
nicklas |
for (var asNo=0; asNo < alignedSequences.length; asNo++) |
6818 |
26 Aug 22 |
nicklas |
148 |
{ |
6818 |
26 Aug 22 |
nicklas |
var as = alignedSequences[asNo]; |
6818 |
26 Aug 22 |
nicklas |
var option = stringtie.createListOption(asNo+offset, as, as.DO_NOT_USE == null); |
6818 |
26 Aug 22 |
nicklas |
frm.alignedSequences.options[frm.alignedSequences.length] = option; |
6818 |
26 Aug 22 |
nicklas |
152 |
} |
6818 |
26 Aug 22 |
nicklas |
Events.sendChangeEvent('alignedSequences'); |
6818 |
26 Aug 22 |
nicklas |
154 |
} |
6818 |
26 Aug 22 |
nicklas |
155 |
} |
6818 |
26 Aug 22 |
nicklas |
156 |
|
6818 |
26 Aug 22 |
nicklas |
stringtie.createListOption = function(index, alignedItem, selected) |
6818 |
26 Aug 22 |
nicklas |
158 |
{ |
6818 |
26 Aug 22 |
nicklas |
var lib = alignedItem.lib; |
6818 |
26 Aug 22 |
nicklas |
var isYellow = lib.specimen && lib.specimen.YellowLabel != null; |
6818 |
26 Aug 22 |
nicklas |
var libPlate = lib.bioWell ? lib.bioWell.bioPlate : null; |
6818 |
26 Aug 22 |
nicklas |
162 |
|
6818 |
26 Aug 22 |
nicklas |
var tooltip = null; |
6818 |
26 Aug 22 |
nicklas |
var name = (index) + ': '; |
6818 |
26 Aug 22 |
nicklas |
if (libPlate) name += libPlate.name + ' - '; |
6818 |
26 Aug 22 |
nicklas |
name += alignedItem.name; |
6818 |
26 Aug 22 |
nicklas |
167 |
|
6818 |
26 Aug 22 |
nicklas |
if (alignedItem.DO_NOT_USE) |
6818 |
26 Aug 22 |
nicklas |
169 |
{ |
6818 |
26 Aug 22 |
nicklas |
name += ' [DoNotUse]'; |
6818 |
26 Aug 22 |
nicklas |
tooltip = 'DoNotUse-'+Strings.encodeTags(alignedItem.DO_NOT_USE+': '+alignedItem.DO_NOT_USE_COMMENT); |
6818 |
26 Aug 22 |
nicklas |
172 |
} |
6818 |
26 Aug 22 |
nicklas |
else if (alignedItem.AutoProcess == 'ReProcess') |
6818 |
26 Aug 22 |
nicklas |
174 |
{ |
6818 |
26 Aug 22 |
nicklas |
name += ' [R]'; |
6818 |
26 Aug 22 |
nicklas |
176 |
} |
6818 |
26 Aug 22 |
nicklas |
177 |
|
6818 |
26 Aug 22 |
nicklas |
var option = new Option(name, alignedItem.id, false, selected); |
6818 |
26 Aug 22 |
nicklas |
if (isYellow) option.className = 'yellow'; |
6818 |
26 Aug 22 |
nicklas |
if (tooltip) option.title = tooltip; |
6818 |
26 Aug 22 |
nicklas |
option.alignedSequences = alignedItem; |
6818 |
26 Aug 22 |
nicklas |
return option; |
6818 |
26 Aug 22 |
nicklas |
183 |
} |
6818 |
26 Aug 22 |
nicklas |
184 |
|
6818 |
26 Aug 22 |
nicklas |
stringtie.alignedSequencesOnChange = function() |
6818 |
26 Aug 22 |
nicklas |
186 |
{ |
6818 |
26 Aug 22 |
nicklas |
var frm = document.forms['reggie']; |
6818 |
26 Aug 22 |
nicklas |
188 |
|
6818 |
26 Aug 22 |
nicklas |
selectionIsValid = false; |
6818 |
26 Aug 22 |
nicklas |
var numSelected = 0; |
6818 |
26 Aug 22 |
nicklas |
var numDoNotUse = 0; |
6818 |
26 Aug 22 |
nicklas |
var invalidPipeline = null; |
6818 |
26 Aug 22 |
nicklas |
Wizard.setInputStatus('alignedSequences'); |
6818 |
26 Aug 22 |
nicklas |
Wizard.hideGoNextConfirmation(); |
6818 |
26 Aug 22 |
nicklas |
195 |
|
6818 |
26 Aug 22 |
nicklas |
for (var asNo = 0; asNo < frm.alignedSequences.length; asNo++) |
6818 |
26 Aug 22 |
nicklas |
197 |
{ |
6818 |
26 Aug 22 |
nicklas |
if (frm.alignedSequences[asNo].selected) |
6818 |
26 Aug 22 |
nicklas |
199 |
{ |
6818 |
26 Aug 22 |
nicklas |
numSelected++; |
6818 |
26 Aug 22 |
nicklas |
var as = frm.alignedSequences[asNo].alignedSequences; |
6818 |
26 Aug 22 |
nicklas |
if (as.DO_NOT_USE) numDoNotUse++; |
6818 |
26 Aug 22 |
nicklas |
if (as.pipeline && as.pipeline != 'RNAseq/Hisat/2023') |
6818 |
26 Aug 22 |
nicklas |
204 |
{ |
6818 |
26 Aug 22 |
nicklas |
invalidPipeline = Strings.encodeTags(as.name+' ('+as.pipeline)+') is not intended for the RNAseq/StringTie/2023 pipeline.'; |
6818 |
26 Aug 22 |
nicklas |
206 |
} |
6818 |
26 Aug 22 |
nicklas |
207 |
} |
6818 |
26 Aug 22 |
nicklas |
208 |
} |
6818 |
26 Aug 22 |
nicklas |
209 |
|
6818 |
26 Aug 22 |
nicklas |
if (numSelected == 0) |
6818 |
26 Aug 22 |
nicklas |
211 |
{ |
6818 |
26 Aug 22 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', 'Select at least one item'); |
6818 |
26 Aug 22 |
nicklas |
return; |
6818 |
26 Aug 22 |
nicklas |
214 |
} |
6818 |
26 Aug 22 |
nicklas |
if (invalidPipeline) |
6818 |
26 Aug 22 |
nicklas |
216 |
{ |
6818 |
26 Aug 22 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'invalid', invalidPipeline); |
6818 |
26 Aug 22 |
nicklas |
return; |
6818 |
26 Aug 22 |
nicklas |
219 |
} |
6818 |
26 Aug 22 |
nicklas |
selectionIsValid = true; |
6818 |
26 Aug 22 |
nicklas |
if (numDoNotUse > 0) |
6818 |
26 Aug 22 |
nicklas |
222 |
{ |
6818 |
26 Aug 22 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'warning', numDoNotUse + ' selected items marked as DoNotUse'); |
6818 |
26 Aug 22 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Confirm ' + numDoNotUse + ' items marked as DoNotUse'); |
6818 |
26 Aug 22 |
nicklas |
225 |
} |
6818 |
26 Aug 22 |
nicklas |
else |
6818 |
26 Aug 22 |
nicklas |
227 |
{ |
6818 |
26 Aug 22 |
nicklas |
Wizard.setInputStatus('alignedSequences', 'valid'); |
6818 |
26 Aug 22 |
nicklas |
229 |
} |
6818 |
26 Aug 22 |
nicklas |
230 |
} |
6818 |
26 Aug 22 |
nicklas |
231 |
|
6818 |
26 Aug 22 |
nicklas |
// --- Step 2 ----------------------------------- |
6818 |
26 Aug 22 |
nicklas |
stringtie.initializeStep2 = function() |
6818 |
26 Aug 22 |
nicklas |
234 |
{ |
6818 |
26 Aug 22 |
nicklas |
Wizard.setCurrentStep(2); |
6818 |
26 Aug 22 |
nicklas |
236 |
|
6818 |
26 Aug 22 |
nicklas |
// Check debug by default if debug is set or not on a secure server (=production server) |
6818 |
26 Aug 22 |
nicklas |
var frm = document.forms['reggie']; |
6818 |
26 Aug 22 |
nicklas |
frm.debug.checked = debug || location.protocol != 'https:'; |
6818 |
26 Aug 22 |
nicklas |
240 |
|
6818 |
26 Aug 22 |
nicklas |
Reggie.loadProtocols('FEATURE_EXTRACTION_PROTOCOL', 'stringtieProtocol', 'PIPELINE', 'RNAseq/StringTie/2023'); |
6818 |
26 Aug 22 |
nicklas |
Reggie.loadSoftware('FEATURE_EXTRACTION_SOFTWARE', 'stringtieSoftware', 'PIPELINE,PARAMETER_SET', 'RNAseq/StringTie/2023'); |
6818 |
26 Aug 22 |
nicklas |
243 |
|
6818 |
26 Aug 22 |
nicklas |
// Load array design |
6818 |
26 Aug 22 |
nicklas |
var url = '../StringTie2023.servlet?ID='+App.getSessionId() + '&cmd=GetArrayDesigns'; |
6818 |
26 Aug 22 |
nicklas |
Doc.addClass('arrayDesign', 'list-loading'); |
6818 |
26 Aug 22 |
nicklas |
frm.arrayDesign[0] = new Option('loading...'); |
6818 |
26 Aug 22 |
nicklas |
Wizard.asyncJsonRequest(url, stringtie.arrayDesignsLoaded); |
6818 |
26 Aug 22 |
nicklas |
249 |
|
6818 |
26 Aug 22 |
nicklas |
// Load clusters |
6818 |
26 Aug 22 |
nicklas |
var url = '../OpenGrid.servlet?ID='+App.getSessionId() + '&cmd=GetHostInfo&config=stringtie-2023'; |
6818 |
26 Aug 22 |
nicklas |
Doc.addClass('clusters', 'list-loading'); |
6818 |
26 Aug 22 |
nicklas |
frm.clusters[0] = new Option('loading...'); |
6818 |
26 Aug 22 |
nicklas |
Wizard.asyncJsonRequest(url, stringtie.clustersLoaded); |
6818 |
26 Aug 22 |
nicklas |
255 |
|
6818 |
26 Aug 22 |
nicklas |
Doc.show('goregister'); |
6818 |
26 Aug 22 |
nicklas |
Doc.show('gocancel'); |
6818 |
26 Aug 22 |
nicklas |
258 |
} |
6818 |
26 Aug 22 |
nicklas |
259 |
|
6818 |
26 Aug 22 |
nicklas |
stringtie.validateStep2 = function(event) |
6818 |
26 Aug 22 |
nicklas |
261 |
{ |
6818 |
26 Aug 22 |
nicklas |
if (!clusterIsValid) event.preventDefault(); |
6818 |
26 Aug 22 |
nicklas |
if (!arrayDesignIsValid) event.preventDefault(); |
6818 |
26 Aug 22 |
nicklas |
264 |
} |
6818 |
26 Aug 22 |
nicklas |
265 |
|
6818 |
26 Aug 22 |
nicklas |
stringtie.arrayDesignsLoaded = function(response) |
6818 |
26 Aug 22 |
nicklas |
267 |
{ |
6818 |
26 Aug 22 |
nicklas |
Doc.removeClass('arrayDesign', 'list-loading'); |
6818 |
26 Aug 22 |
nicklas |
var frm = document.forms['reggie']; |
6818 |
26 Aug 22 |
nicklas |
var designs = response.arrayDesigns; |
6818 |
26 Aug 22 |
nicklas |
frm.arrayDesign.length = 0; |
6818 |
26 Aug 22 |
nicklas |
for (var i = 0; i < designs.length; i++) |
6818 |
26 Aug 22 |
nicklas |
273 |
{ |
6818 |
26 Aug 22 |
nicklas |
var design = designs[i]; |
6818 |
26 Aug 22 |
nicklas |
var option = new Option(design.name + ' ('+design.numFeatures+')', design.id, design.isDefault, design.isDefault); |
6818 |
26 Aug 22 |
nicklas |
option.arrayDesign = design; |
6818 |
26 Aug 22 |
nicklas |
frm.arrayDesign[frm.arrayDesign.length] = option; |
6818 |
26 Aug 22 |
nicklas |
278 |
} |
6818 |
26 Aug 22 |
nicklas |
if (frm.arrayDesign.length == 0) |
6818 |
26 Aug 22 |
nicklas |
280 |
{ |
6818 |
26 Aug 22 |
nicklas |
Wizard.setInputStatus('arrayDesign', 'invalid', 'No available array designs'); |
6818 |
26 Aug 22 |
nicklas |
arrayDesignIsValid = false; |
6818 |
26 Aug 22 |
nicklas |
283 |
} |
6818 |
26 Aug 22 |
nicklas |
else |
6818 |
26 Aug 22 |
nicklas |
285 |
{ |
6818 |
26 Aug 22 |
nicklas |
Wizard.setInputStatus('arrayDesign', 'valid'); |
6818 |
26 Aug 22 |
nicklas |
arrayDesignIsValid = true; |
6818 |
26 Aug 22 |
nicklas |
288 |
} |
6818 |
26 Aug 22 |
nicklas |
289 |
} |
6818 |
26 Aug 22 |
nicklas |
290 |
|
6818 |
26 Aug 22 |
nicklas |
stringtie.clustersLoaded = function(response) |
6818 |
26 Aug 22 |
nicklas |
292 |
{ |
6818 |
26 Aug 22 |
nicklas |
Doc.removeClass('clusters', 'list-loading'); |
6818 |
26 Aug 22 |
nicklas |
var frm = document.forms['reggie']; |
6818 |
26 Aug 22 |
nicklas |
var clusters = response.hosts; |
6818 |
26 Aug 22 |
nicklas |
frm.clusters.length = 0; |
6818 |
26 Aug 22 |
nicklas |
for (var i = 0; i < clusters.length; i++) |
6818 |
26 Aug 22 |
nicklas |
298 |
{ |
6818 |
26 Aug 22 |
nicklas |
var cl = clusters[i]; |
6818 |
26 Aug 22 |
nicklas |
var option = new Option(cl.connection.name, cl.id); |
6818 |
26 Aug 22 |
nicklas |
option.cluster = cl; |
6818 |
26 Aug 22 |
nicklas |
frm.clusters[frm.clusters.length] = option; |
6818 |
26 Aug 22 |
nicklas |
Wizard.setInputStatus('clusters', 'valid'); |
6818 |
26 Aug 22 |
nicklas |
clusterIsValid = true; |
6818 |
26 Aug 22 |
nicklas |
305 |
} |
6818 |
26 Aug 22 |
nicklas |
if (frm.clusters.length == 0) |
6818 |
26 Aug 22 |
nicklas |
307 |
{ |
6818 |
26 Aug 22 |
nicklas |
Wizard.setInputStatus('clusters', 'invalid', 'No available clusters'); |
6818 |
26 Aug 22 |
nicklas |
clusterIsValid = false; |
6818 |
26 Aug 22 |
nicklas |
310 |
} |
6818 |
26 Aug 22 |
nicklas |
else |
6818 |
26 Aug 22 |
nicklas |
312 |
{ |
6818 |
26 Aug 22 |
nicklas |
stringtie.clusterOnChange(); |
6818 |
26 Aug 22 |
nicklas |
314 |
} |
6818 |
26 Aug 22 |
nicklas |
315 |
} |
6818 |
26 Aug 22 |
nicklas |
316 |
|
6818 |
26 Aug 22 |
nicklas |
stringtie.softwareOnChange = function(event) |
6818 |
26 Aug 22 |
nicklas |
318 |
{ |
6818 |
26 Aug 22 |
nicklas |
var target = event.currentTarget; |
6818 |
26 Aug 22 |
nicklas |
var item = target[target.selectedIndex].item; |
6818 |
26 Aug 22 |
nicklas |
if (!item) item = {}; |
6818 |
26 Aug 22 |
nicklas |
322 |
|
6818 |
26 Aug 22 |
nicklas |
Doc.element(target.id+'.parameterSet').innerHTML = Strings.encodeTags(item.ParameterSet || 'default'); |
6818 |
26 Aug 22 |
nicklas |
Doc.element(target.id+'.description').innerHTML = Strings.encodeTags(item.description); |
6818 |
26 Aug 22 |
nicklas |
Wizard.setInputStatus(target.id, 'valid'); |
6818 |
26 Aug 22 |
nicklas |
326 |
|
6818 |
26 Aug 22 |
nicklas |
if (item.ParameterSet) |
6818 |
26 Aug 22 |
nicklas |
328 |
{ |
6818 |
26 Aug 22 |
nicklas |
var url = '../Install.servlet?ID='+App.getSessionId(); |
6818 |
26 Aug 22 |
nicklas |
url += '&cmd=GetParameterSetInfo'; |
6818 |
26 Aug 22 |
nicklas |
url += '¶meterSet='+encodeURIComponent(item.ParameterSet); |
6818 |
26 Aug 22 |
nicklas |
url += '&targetId='+target.id; |
6818 |
26 Aug 22 |
nicklas |
Wizard.asyncJsonRequest(url, stringtie.parameterSetInfoLoaded); |
6818 |
26 Aug 22 |
nicklas |
334 |
} |
7372 |
06 Oct 23 |
nicklas |
stringtie.updateSubmitOptions(); |
6818 |
26 Aug 22 |
nicklas |
336 |
} |
6818 |
26 Aug 22 |
nicklas |
337 |
|
6818 |
26 Aug 22 |
nicklas |
stringtie.parameterSetInfoLoaded = function(response) |
6818 |
26 Aug 22 |
nicklas |
339 |
{ |
6818 |
26 Aug 22 |
nicklas |
if (!response.parameters || response.parameters.length == 0) |
6818 |
26 Aug 22 |
nicklas |
341 |
{ |
6818 |
26 Aug 22 |
nicklas |
Wizard.setInputStatus(response.targetId, 'warning', 'Can\'t find \'' + Strings.encodeTags(response.parameterSet) + '\' parameter set in reggie-config.xml'); |
6818 |
26 Aug 22 |
nicklas |
343 |
} |
6818 |
26 Aug 22 |
nicklas |
344 |
} |
6818 |
26 Aug 22 |
nicklas |
345 |
|
6818 |
26 Aug 22 |
nicklas |
stringtie.clusterOnChange = function() |
6818 |
26 Aug 22 |
nicklas |
347 |
{ |
6818 |
26 Aug 22 |
nicklas |
var frm = document.forms['reggie']; |
6818 |
26 Aug 22 |
nicklas |
var cluster = frm.clusters[frm.clusters.selectedIndex].cluster; |
6818 |
26 Aug 22 |
nicklas |
if (cluster.priorities && cluster.priorities.length > 0) |
6818 |
26 Aug 22 |
nicklas |
351 |
{ |
6818 |
26 Aug 22 |
nicklas |
frm.priority.length = 0; |
6818 |
26 Aug 22 |
nicklas |
for (var pNo = 0; pNo < cluster.priorities.length; pNo++) |
6818 |
26 Aug 22 |
nicklas |
354 |
{ |
6818 |
26 Aug 22 |
nicklas |
var p = cluster.priorities[pNo]; |
6818 |
26 Aug 22 |
nicklas |
frm.priority[frm.priority.length] = new Option(p.name + ' ('+p.value+')', p.value, p['default'], p['default']); |
6818 |
26 Aug 22 |
nicklas |
357 |
} |
6818 |
26 Aug 22 |
nicklas |
Doc.show('job-priority'); |
6818 |
26 Aug 22 |
nicklas |
359 |
} |
6818 |
26 Aug 22 |
nicklas |
else |
6818 |
26 Aug 22 |
nicklas |
361 |
{ |
6818 |
26 Aug 22 |
nicklas |
Doc.hide('job-priority'); |
6818 |
26 Aug 22 |
nicklas |
363 |
} |
6980 |
17 Jan 23 |
nicklas |
if (cluster.partitions && cluster.partitions.length > 0) |
6980 |
17 Jan 23 |
nicklas |
365 |
{ |
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 |
368 |
{ |
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 |
373 |
} |
6980 |
17 Jan 23 |
nicklas |
Doc.show('job-partition'); |
6980 |
17 Jan 23 |
nicklas |
375 |
} |
6980 |
17 Jan 23 |
nicklas |
else |
6980 |
17 Jan 23 |
nicklas |
377 |
{ |
6980 |
17 Jan 23 |
nicklas |
Doc.hide('job-partition'); |
6980 |
17 Jan 23 |
nicklas |
379 |
} |
7372 |
06 Oct 23 |
nicklas |
stringtie.updateSubmitOptions(); |
6818 |
26 Aug 22 |
nicklas |
381 |
} |
7372 |
06 Oct 23 |
nicklas |
382 |
|
7372 |
06 Oct 23 |
nicklas |
stringtie.debugOnChange = function() |
7372 |
06 Oct 23 |
nicklas |
384 |
{ |
7372 |
06 Oct 23 |
nicklas |
stringtie.updateSubmitOptions(); |
7372 |
06 Oct 23 |
nicklas |
386 |
} |
7372 |
06 Oct 23 |
nicklas |
387 |
|
7372 |
06 Oct 23 |
nicklas |
stringtie.updateSubmitOptions = function() |
7372 |
06 Oct 23 |
nicklas |
389 |
{ |
7372 |
06 Oct 23 |
nicklas |
var frm = document.forms['reggie']; |
7372 |
06 Oct 23 |
nicklas |
var config = frm.clusters[frm.clusters.selectedIndex]?.cluster?.config?.['stringtie-2023']; |
7372 |
06 Oct 23 |
nicklas |
if (config) |
7372 |
06 Oct 23 |
nicklas |
393 |
{ |
7372 |
06 Oct 23 |
nicklas |
var parameterSet = frm.stringtieSoftware[frm.stringtieSoftware.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 |
397 |
} |
7372 |
06 Oct 23 |
nicklas |
398 |
} |
7372 |
06 Oct 23 |
nicklas |
399 |
|
7372 |
06 Oct 23 |
nicklas |
stringtie.overrideOnChange = function() |
7372 |
06 Oct 23 |
nicklas |
401 |
{ |
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 |
406 |
{ |
7372 |
06 Oct 23 |
nicklas |
frm.submitOptionsOverride.value = Doc.element('submitOptions').innerHTML; |
7372 |
06 Oct 23 |
nicklas |
408 |
} |
7372 |
06 Oct 23 |
nicklas |
409 |
} |
6818 |
26 Aug 22 |
nicklas |
410 |
|
6818 |
26 Aug 22 |
nicklas |
stringtie.submit = function() |
6818 |
26 Aug 22 |
nicklas |
412 |
{ |
6818 |
26 Aug 22 |
nicklas |
var frm = document.forms['reggie']; |
6818 |
26 Aug 22 |
nicklas |
414 |
|
6818 |
26 Aug 22 |
nicklas |
var submitInfo = {}; |
6818 |
26 Aug 22 |
nicklas |
submitInfo.stringtieSoftware = parseInt(frm.stringtieSoftware.value); |
6818 |
26 Aug 22 |
nicklas |
submitInfo.stringtieProtocol = parseInt(frm.stringtieProtocol.value); |
6818 |
26 Aug 22 |
nicklas |
submitInfo.arrayDesign = parseInt(frm.arrayDesign.value); |
6818 |
26 Aug 22 |
nicklas |
submitInfo.cluster = frm.clusters.value; |
6818 |
26 Aug 22 |
nicklas |
if (frm.priority.selectedIndex >= 0) |
6818 |
26 Aug 22 |
nicklas |
421 |
{ |
6818 |
26 Aug 22 |
nicklas |
submitInfo.priority = parseInt(frm.priority.value); |
6818 |
26 Aug 22 |
nicklas |
423 |
} |
6980 |
17 Jan 23 |
nicklas |
if (frm.partition.selectedIndex >= 0) |
6980 |
17 Jan 23 |
nicklas |
425 |
{ |
6980 |
17 Jan 23 |
nicklas |
submitInfo.partition = frm.partition.value; |
6980 |
17 Jan 23 |
nicklas |
427 |
} |
7372 |
06 Oct 23 |
nicklas |
if (frm.override.checked) |
7372 |
06 Oct 23 |
nicklas |
429 |
{ |
7372 |
06 Oct 23 |
nicklas |
submitInfo.submitOptionsOverride = frm.submitOptionsOverride.value; |
7372 |
06 Oct 23 |
nicklas |
431 |
} |
6818 |
26 Aug 22 |
nicklas |
submitInfo.debug = frm.debug.checked; |
6818 |
26 Aug 22 |
nicklas |
submitInfo.autoConfirm = frm.autoConfirm.checked; |
6818 |
26 Aug 22 |
nicklas |
434 |
|
6818 |
26 Aug 22 |
nicklas |
var alignedSequences = []; |
6818 |
26 Aug 22 |
nicklas |
submitInfo.alignedSequences = alignedSequences; |
6818 |
26 Aug 22 |
nicklas |
437 |
|
6818 |
26 Aug 22 |
nicklas |
for (var asNo = 0; asNo < frm.alignedSequences.length; asNo++) |
6818 |
26 Aug 22 |
nicklas |
439 |
{ |
6818 |
26 Aug 22 |
nicklas |
if (frm.alignedSequences[asNo].selected) |
6818 |
26 Aug 22 |
nicklas |
441 |
{ |
6818 |
26 Aug 22 |
nicklas |
var as = {}; |
6818 |
26 Aug 22 |
nicklas |
as.id = frm.alignedSequences[asNo].alignedSequences.id; |
6818 |
26 Aug 22 |
nicklas |
alignedSequences[alignedSequences.length] = as; |
6818 |
26 Aug 22 |
nicklas |
445 |
} |
6818 |
26 Aug 22 |
nicklas |
446 |
} |
6818 |
26 Aug 22 |
nicklas |
447 |
|
6818 |
26 Aug 22 |
nicklas |
var url = '../StringTie2023.servlet?ID='+App.getSessionId(); |
6818 |
26 Aug 22 |
nicklas |
url += '&cmd=StartStringTie2023'; |
6818 |
26 Aug 22 |
nicklas |
450 |
|
6818 |
26 Aug 22 |
nicklas |
Wizard.showLoadingAnimation('Performing registration...'); |
6818 |
26 Aug 22 |
nicklas |
Wizard.asyncJsonRequest(url, stringtie.submissionResults, 'POST', JSON.stringify(submitInfo)); |
6818 |
26 Aug 22 |
nicklas |
453 |
} |
6818 |
26 Aug 22 |
nicklas |
454 |
|
6818 |
26 Aug 22 |
nicklas |
stringtie.submissionResults = function(response) |
6818 |
26 Aug 22 |
nicklas |
456 |
{ |
6818 |
26 Aug 22 |
nicklas |
Wizard.showFinalMessage(response.messages); |
6818 |
26 Aug 22 |
nicklas |
Doc.show('gorestart'); |
6818 |
26 Aug 22 |
nicklas |
459 |
} |
6818 |
26 Aug 22 |
nicklas |
460 |
|
6818 |
26 Aug 22 |
nicklas |
return stringtie; |
6818 |
26 Aug 22 |
nicklas |
462 |
}(); |
6818 |
26 Aug 22 |
nicklas |
463 |
|
6818 |
26 Aug 22 |
nicklas |
Doc.onLoad(StringTie.initPage); |
6818 |
26 Aug 22 |
nicklas |
465 |
|