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