5867 |
18 Mar 20 |
nicklas |
var Sequencing = function() |
5867 |
18 Mar 20 |
nicklas |
2 |
{ |
5867 |
18 Mar 20 |
nicklas |
var seq = {}; |
5901 |
15 Apr 20 |
nicklas |
var debug = 0; |
5867 |
18 Mar 20 |
nicklas |
5 |
|
5867 |
18 Mar 20 |
nicklas |
var flowCellIdIsValid = false; |
5867 |
18 Mar 20 |
nicklas |
var sampleSheetIsValid = false; |
5867 |
18 Mar 20 |
nicklas |
var autoAnalyzeIsValid = false; |
5867 |
18 Mar 20 |
nicklas |
9 |
|
5867 |
18 Mar 20 |
nicklas |
var checkedLibraries; |
5867 |
18 Mar 20 |
nicklas |
11 |
|
5867 |
18 Mar 20 |
nicklas |
// Page initialization |
5867 |
18 Mar 20 |
nicklas |
seq.initPage = function() |
5867 |
18 Mar 20 |
nicklas |
14 |
{ |
5867 |
18 Mar 20 |
nicklas |
// Step 1 |
5867 |
18 Mar 20 |
nicklas |
Events.addEventHandler('flowCellId', 'blur', seq.flowCellIdOnChange); |
5867 |
18 Mar 20 |
nicklas |
Events.addEventHandler('sampleSheetFile', 'change', seq.sampleSheetFileOnChange); |
5867 |
18 Mar 20 |
nicklas |
Events.addEventHandler('startDate', 'change', Wizard.validateDate); |
5867 |
18 Mar 20 |
nicklas |
19 |
|
5867 |
18 Mar 20 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', seq.validateStep1); |
5867 |
18 Mar 20 |
nicklas |
21 |
|
5867 |
18 Mar 20 |
nicklas |
Events.addEventHandler('autoAnalyzeYes', 'click', seq.autoAnalyzeOnChange); |
5867 |
18 Mar 20 |
nicklas |
Events.addEventHandler('autoAnalyzeNo', 'click', seq.autoAnalyzeOnChange); |
5867 |
18 Mar 20 |
nicklas |
Events.addEventHandler('clusters', 'change', seq.clusterOnChange); |
5867 |
18 Mar 20 |
nicklas |
25 |
|
5867 |
18 Mar 20 |
nicklas |
// Navigation |
5867 |
18 Mar 20 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
5867 |
18 Mar 20 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
5867 |
18 Mar 20 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
5867 |
18 Mar 20 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
5867 |
18 Mar 20 |
nicklas |
31 |
|
5867 |
18 Mar 20 |
nicklas |
// Final registration |
5867 |
18 Mar 20 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', seq.submit); |
5867 |
18 Mar 20 |
nicklas |
34 |
|
5867 |
18 Mar 20 |
nicklas |
Doc.show('step-1'); |
5867 |
18 Mar 20 |
nicklas |
Doc.show('goregister'); |
5867 |
18 Mar 20 |
nicklas |
Doc.element('flowCellId').focus(); |
5886 |
30 Mar 20 |
nicklas |
38 |
|
5886 |
30 Mar 20 |
nicklas |
// Load Library protocols |
5899 |
15 Apr 20 |
nicklas |
Reggie.loadProtocols('LIBRARY_PROTOCOL', 'libProtocol', 'LIBPREP_TARGET', 'External'); |
5867 |
18 Mar 20 |
nicklas |
41 |
|
5867 |
18 Mar 20 |
nicklas |
var frm = document.forms['reggie']; |
6735 |
09 May 22 |
nicklas |
// Load clusters |
6633 |
08 Mar 22 |
nicklas |
var url = '../OpenGrid.servlet?ID='+App.getSessionId() + '&cmd=GetHostInfo&config=demux'; |
5867 |
18 Mar 20 |
nicklas |
Doc.addClass('clusters', 'list-loading'); |
5867 |
18 Mar 20 |
nicklas |
frm.clusters[0] = new Option('loading...'); |
5867 |
18 Mar 20 |
nicklas |
Wizard.asyncJsonRequest(url, seq.clustersLoaded); |
5867 |
18 Mar 20 |
nicklas |
48 |
|
5867 |
18 Mar 20 |
nicklas |
// Check debug by default if debug is set or not on a secure server (=production server) |
5867 |
18 Mar 20 |
nicklas |
frm.debug.checked = debug || location.protocol != 'https:'; |
5885 |
30 Mar 20 |
nicklas |
51 |
|
5885 |
30 Mar 20 |
nicklas |
if (debug) |
5885 |
30 Mar 20 |
nicklas |
53 |
{ |
5885 |
30 Mar 20 |
nicklas |
var url = '../LibPrep.servlet?ID='+App.getSessionId(); |
5885 |
30 Mar 20 |
nicklas |
url += '&cmd=GetLibraryPlatesForLibPrep&plateType=EXTERNAL_LIBRARY'; |
5885 |
30 Mar 20 |
nicklas |
Wizard.asyncJsonRequest(url, seq.initDebugTools); |
5885 |
30 Mar 20 |
nicklas |
57 |
} |
5885 |
30 Mar 20 |
nicklas |
58 |
|
5867 |
18 Mar 20 |
nicklas |
59 |
} |
5867 |
18 Mar 20 |
nicklas |
60 |
|
5867 |
18 Mar 20 |
nicklas |
61 |
|
6824 |
30 Aug 22 |
nicklas |
seq.flowCellIdOnChange = function() |
5867 |
18 Mar 20 |
nicklas |
63 |
{ |
5867 |
18 Mar 20 |
nicklas |
var frm = document.forms['reggie']; |
5867 |
18 Mar 20 |
nicklas |
65 |
|
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('flowCellId'); |
5867 |
18 Mar 20 |
nicklas |
flowCellIdIsValid = false; |
5867 |
18 Mar 20 |
nicklas |
68 |
|
5867 |
18 Mar 20 |
nicklas |
var id = frm.flowCellId.value; |
5867 |
18 Mar 20 |
nicklas |
if (id == '') |
5867 |
18 Mar 20 |
nicklas |
71 |
{ |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('flowCellId', 'invalid', 'ID is a required value'); |
5867 |
18 Mar 20 |
nicklas |
return; |
5867 |
18 Mar 20 |
nicklas |
74 |
} |
5867 |
18 Mar 20 |
nicklas |
75 |
|
5867 |
18 Mar 20 |
nicklas |
// Check if ID already exists in DB |
5867 |
18 Mar 20 |
nicklas |
var url = '../FlowCell.servlet?ID='+App.getSessionId(); |
5867 |
18 Mar 20 |
nicklas |
url += '&cmd=GetFlowCellByBarcode'; |
5867 |
18 Mar 20 |
nicklas |
url += '&barcode='+encodeURIComponent(id); |
5867 |
18 Mar 20 |
nicklas |
Wizard.showLoadingAnimation('Checking flow cell id...'); |
5867 |
18 Mar 20 |
nicklas |
Wizard.asyncJsonRequest(url, seq.flowCellIdChecked); |
5867 |
18 Mar 20 |
nicklas |
82 |
} |
5867 |
18 Mar 20 |
nicklas |
83 |
|
5867 |
18 Mar 20 |
nicklas |
seq.flowCellIdChecked = function(response) |
5867 |
18 Mar 20 |
nicklas |
85 |
{ |
5867 |
18 Mar 20 |
nicklas |
var frm = document.forms['reggie']; |
5867 |
18 Mar 20 |
nicklas |
var existing = response.flowCell; |
5867 |
18 Mar 20 |
nicklas |
if (existing != null) |
5867 |
18 Mar 20 |
nicklas |
89 |
{ |
5867 |
18 Mar 20 |
nicklas |
var id = frm.flowCellId.value; |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('flowCellId', 'invalid', 'Flow cell with ID='+Strings.encodeTags(id)+' already exists: ' + Strings.encodeTags(existing.name)); |
5867 |
18 Mar 20 |
nicklas |
return; |
5867 |
18 Mar 20 |
nicklas |
93 |
} |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('flowCellId', 'valid'); |
5867 |
18 Mar 20 |
nicklas |
flowCellIdIsValid = true; |
5867 |
18 Mar 20 |
nicklas |
96 |
} |
5867 |
18 Mar 20 |
nicklas |
97 |
|
5867 |
18 Mar 20 |
nicklas |
98 |
|
5867 |
18 Mar 20 |
nicklas |
seq.sampleSheetFileOnChange = function() |
5867 |
18 Mar 20 |
nicklas |
100 |
{ |
5867 |
18 Mar 20 |
nicklas |
var frm = document.forms['reggie']; |
5867 |
18 Mar 20 |
nicklas |
var file = frm.sampleSheetFile.files[0]; |
5867 |
18 Mar 20 |
nicklas |
103 |
|
5867 |
18 Mar 20 |
nicklas |
Wizard.hideWizardStatus(); |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('sampleSheetFile'); |
5867 |
18 Mar 20 |
nicklas |
sampleSheetIsValid = false; |
5867 |
18 Mar 20 |
nicklas |
107 |
|
5867 |
18 Mar 20 |
nicklas |
var reader = new FileReader(); |
5867 |
18 Mar 20 |
nicklas |
reader.onload = seq.sampleSheetFileLoaded; |
5867 |
18 Mar 20 |
nicklas |
reader.readAsText(file); |
5867 |
18 Mar 20 |
nicklas |
111 |
} |
5867 |
18 Mar 20 |
nicklas |
112 |
|
5867 |
18 Mar 20 |
nicklas |
seq.sampleSheetFileLoaded = function(event) |
5867 |
18 Mar 20 |
nicklas |
114 |
{ |
5867 |
18 Mar 20 |
nicklas |
seq.parseSampleSheet(event.target.result); |
5867 |
18 Mar 20 |
nicklas |
116 |
} |
5867 |
18 Mar 20 |
nicklas |
117 |
|
5867 |
18 Mar 20 |
nicklas |
seq.parseSampleSheet = function(data) |
5867 |
18 Mar 20 |
nicklas |
119 |
{ |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('sampleSheetFile'); |
5867 |
18 Mar 20 |
nicklas |
sampleSheetIsValid = false; |
5867 |
18 Mar 20 |
nicklas |
122 |
|
5867 |
18 Mar 20 |
nicklas |
var lines = data.split(/[\n\r]+/); |
5867 |
18 Mar 20 |
nicklas |
var lineNo = 0; |
5867 |
18 Mar 20 |
nicklas |
125 |
|
5867 |
18 Mar 20 |
nicklas |
// Parse out some headers |
5867 |
18 Mar 20 |
nicklas |
while (lineNo < lines.length) |
5867 |
18 Mar 20 |
nicklas |
128 |
{ |
5867 |
18 Mar 20 |
nicklas |
var line = lines[lineNo]; |
5867 |
18 Mar 20 |
nicklas |
lineNo++; |
5867 |
18 Mar 20 |
nicklas |
131 |
|
5867 |
18 Mar 20 |
nicklas |
if (line.indexOf('[Data]') >= 0) break; // Break when we reach the [Data] section |
5867 |
18 Mar 20 |
nicklas |
133 |
|
5867 |
18 Mar 20 |
nicklas |
var columns = line.split(/,/); |
5867 |
18 Mar 20 |
nicklas |
if (columns[0] == 'Date') |
5867 |
18 Mar 20 |
nicklas |
136 |
{ |
5867 |
18 Mar 20 |
nicklas |
var startDate = Dates.parseString(columns[1], 'M/d/y'); |
5867 |
18 Mar 20 |
nicklas |
Doc.element('startDate').value = startDate == null ? columns[1] : Dates.formatDate(startDate, 'yyyyMMdd'); |
5867 |
18 Mar 20 |
nicklas |
Events.sendChangeEvent('startDate'); |
5867 |
18 Mar 20 |
nicklas |
140 |
} |
5867 |
18 Mar 20 |
nicklas |
if (columns[0] == 'Instrument Type') |
5867 |
18 Mar 20 |
nicklas |
142 |
{ |
5867 |
18 Mar 20 |
nicklas |
var instrumentType = columns[1]; |
5867 |
18 Mar 20 |
nicklas |
if (instrumentType == 'NovaSeq') |
5867 |
18 Mar 20 |
nicklas |
145 |
{ |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('flowCellType', 'valid'); |
5867 |
18 Mar 20 |
nicklas |
147 |
} |
5867 |
18 Mar 20 |
nicklas |
else |
5867 |
18 Mar 20 |
nicklas |
149 |
{ |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('flowCellType', 'warning', 'Instrument type='+Strings.encodeTags(instrumentType)+' in the file.'); |
5867 |
18 Mar 20 |
nicklas |
151 |
} |
5867 |
18 Mar 20 |
nicklas |
152 |
} |
5867 |
18 Mar 20 |
nicklas |
153 |
} |
5867 |
18 Mar 20 |
nicklas |
154 |
|
5867 |
18 Mar 20 |
nicklas |
if (lineNo >= lines.length) |
5867 |
18 Mar 20 |
nicklas |
156 |
{ |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('sampleSheetFile', 'invalid', 'Could not find [Data] section.'); |
5867 |
18 Mar 20 |
nicklas |
return; |
5867 |
18 Mar 20 |
nicklas |
159 |
} |
5867 |
18 Mar 20 |
nicklas |
160 |
|
5867 |
18 Mar 20 |
nicklas |
var headers = lines[lineNo].split(/,/); |
5867 |
18 Mar 20 |
nicklas |
var numHeaders = headers.length; |
5867 |
18 Mar 20 |
nicklas |
163 |
|
5889 |
06 Apr 20 |
nicklas |
var sampleIdIndex = seq.findColumn(headers, 'Sample_ID', lineNo); |
5889 |
06 Apr 20 |
nicklas |
if (sampleIdIndex == -1) return; |
5889 |
06 Apr 20 |
nicklas |
166 |
|
5889 |
06 Apr 20 |
nicklas |
var sampleNameIndex = seq.findColumn(headers, 'Sample_Name', lineNo); |
5889 |
06 Apr 20 |
nicklas |
if (sampleNameIndex == -1) return; |
5867 |
18 Mar 20 |
nicklas |
169 |
|
5867 |
18 Mar 20 |
nicklas |
var barcodeIndex = seq.findColumn(headers, 'I7_Index_ID', lineNo); |
5867 |
18 Mar 20 |
nicklas |
if (barcodeIndex == -1) return; |
5867 |
18 Mar 20 |
nicklas |
172 |
|
5867 |
18 Mar 20 |
nicklas |
var idx1 = seq.findColumn(headers, 'index', lineNo); |
5867 |
18 Mar 20 |
nicklas |
if (idx1 == -1) return; |
5867 |
18 Mar 20 |
nicklas |
175 |
|
5867 |
18 Mar 20 |
nicklas |
var idx2 = seq.findColumn(headers, 'index2', lineNo); |
5867 |
18 Mar 20 |
nicklas |
if (idx2 == -1) return; |
5867 |
18 Mar 20 |
nicklas |
178 |
|
5870 |
20 Mar 20 |
nicklas |
var plateIndex = seq.findColumn(headers, 'Sample_Plate', lineNo, true); |
5870 |
20 Mar 20 |
nicklas |
var wellIndex = seq.findColumn(headers, 'Sample_Well', lineNo, true); |
5870 |
20 Mar 20 |
nicklas |
181 |
|
5867 |
18 Mar 20 |
nicklas |
lineNo++; |
5867 |
18 Mar 20 |
nicklas |
var libs = []; |
5867 |
18 Mar 20 |
nicklas |
while (lineNo < lines.length) |
5867 |
18 Mar 20 |
nicklas |
185 |
{ |
5867 |
18 Mar 20 |
nicklas |
var columns = lines[lineNo].split(/,/); |
5867 |
18 Mar 20 |
nicklas |
if (numHeaders == columns.length) |
5867 |
18 Mar 20 |
nicklas |
188 |
{ |
5867 |
18 Mar 20 |
nicklas |
libs[libs.length] = { |
5867 |
18 Mar 20 |
nicklas |
'lineNo': lineNo, |
5909 |
17 Apr 20 |
nicklas |
'sampleId': columns[sampleIdIndex], |
5909 |
17 Apr 20 |
nicklas |
'sampleName': columns[sampleNameIndex], |
5867 |
18 Mar 20 |
nicklas |
'barcode': columns[barcodeIndex], |
5867 |
18 Mar 20 |
nicklas |
'index1': columns[idx1], |
5870 |
20 Mar 20 |
nicklas |
'index2': columns[idx2], |
5870 |
20 Mar 20 |
nicklas |
'plate': plateIndex >= 0 ? columns[plateIndex] : null, |
5870 |
20 Mar 20 |
nicklas |
'well': wellIndex >= 0 ? columns[wellIndex] : null |
5867 |
18 Mar 20 |
nicklas |
198 |
}; |
5867 |
18 Mar 20 |
nicklas |
199 |
} |
5867 |
18 Mar 20 |
nicklas |
lineNo++; |
5867 |
18 Mar 20 |
nicklas |
201 |
} |
5867 |
18 Mar 20 |
nicklas |
202 |
|
5867 |
18 Mar 20 |
nicklas |
var submitInfo = {}; |
5867 |
18 Mar 20 |
nicklas |
submitInfo.libraries = libs; |
5867 |
18 Mar 20 |
nicklas |
205 |
|
5867 |
18 Mar 20 |
nicklas |
var url = '../SequencingRun.servlet?ID='+App.getSessionId(); |
5867 |
18 Mar 20 |
nicklas |
url += '&cmd=CheckExternalSequencing'; |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('sampleSheetFile', 'checking', 'Checking...'); |
5867 |
18 Mar 20 |
nicklas |
Wizard.showLoadingAnimation('Checking sample sheet...'); |
5867 |
18 Mar 20 |
nicklas |
Wizard.asyncJsonRequest(url, seq.sampleSheetChecked, 'POST', JSON.stringify(submitInfo)); |
5867 |
18 Mar 20 |
nicklas |
211 |
} |
5867 |
18 Mar 20 |
nicklas |
212 |
|
5867 |
18 Mar 20 |
nicklas |
// Find a column with the given header |
5870 |
20 Mar 20 |
nicklas |
seq.findColumn = function(columns, header, lineNo, optional) |
5867 |
18 Mar 20 |
nicklas |
215 |
{ |
5867 |
18 Mar 20 |
nicklas |
var colIndex = columns.indexOf(header); |
5870 |
20 Mar 20 |
nicklas |
if (colIndex == -1 && !optional) |
5867 |
18 Mar 20 |
nicklas |
218 |
{ |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('sampleSheetFile', 'invalid', 'On line '+lineNo+'; Can\'t find "' + header + '" column.'); |
5867 |
18 Mar 20 |
nicklas |
220 |
} |
5867 |
18 Mar 20 |
nicklas |
return colIndex; |
5867 |
18 Mar 20 |
nicklas |
222 |
} |
5867 |
18 Mar 20 |
nicklas |
223 |
|
5867 |
18 Mar 20 |
nicklas |
seq.sampleSheetChecked = function(response) |
5867 |
18 Mar 20 |
nicklas |
225 |
{ |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('sampleSheetFile'); |
5867 |
18 Mar 20 |
nicklas |
sampleSheetIsValid = false; |
5867 |
18 Mar 20 |
nicklas |
228 |
|
5867 |
18 Mar 20 |
nicklas |
Wizard.showFinalMessage(response.messages); |
5867 |
18 Mar 20 |
nicklas |
230 |
|
5867 |
18 Mar 20 |
nicklas |
if (response.numErrors > 0) |
5867 |
18 Mar 20 |
nicklas |
232 |
{ |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('sampleSheetFile', 'invalid', 'The sample sheet has ' + response.numErrors + ' errors.'); |
5867 |
18 Mar 20 |
nicklas |
234 |
} |
5867 |
18 Mar 20 |
nicklas |
else |
5867 |
18 Mar 20 |
nicklas |
236 |
{ |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('sampleSheetFile', 'valid'); |
5867 |
18 Mar 20 |
nicklas |
checkedLibraries = response.libraries; |
5867 |
18 Mar 20 |
nicklas |
sampleSheetIsValid = true; |
5867 |
18 Mar 20 |
nicklas |
240 |
} |
5867 |
18 Mar 20 |
nicklas |
241 |
} |
5867 |
18 Mar 20 |
nicklas |
242 |
|
5867 |
18 Mar 20 |
nicklas |
seq.clustersLoaded = function(response) |
5867 |
18 Mar 20 |
nicklas |
244 |
{ |
5867 |
18 Mar 20 |
nicklas |
Doc.removeClass('clusters', 'list-loading'); |
5867 |
18 Mar 20 |
nicklas |
var frm = document.forms['reggie']; |
5867 |
18 Mar 20 |
nicklas |
frm.clusters.length = 0; |
5867 |
18 Mar 20 |
nicklas |
var clusters = response.hosts; |
5867 |
18 Mar 20 |
nicklas |
if (clusters.length == 0) |
5867 |
18 Mar 20 |
nicklas |
250 |
{ |
5867 |
18 Mar 20 |
nicklas |
Doc.element('autoAnalyzeNo').checked = true; |
5867 |
18 Mar 20 |
nicklas |
autoAnalyzeIsValid = true; |
6735 |
09 May 22 |
nicklas |
Wizard.setInputStatus('autoAnalyze', 'warning', 'No available cluster'); |
5867 |
18 Mar 20 |
nicklas |
return; |
5867 |
18 Mar 20 |
nicklas |
255 |
} |
5867 |
18 Mar 20 |
nicklas |
256 |
|
5867 |
18 Mar 20 |
nicklas |
Doc.element('autoAnalyzeNo').disabled = false; |
5867 |
18 Mar 20 |
nicklas |
Doc.element('autoAnalyzeYes').disabled = false; |
5867 |
18 Mar 20 |
nicklas |
for (var i = 0; i < clusters.length; i++) |
5867 |
18 Mar 20 |
nicklas |
260 |
{ |
5867 |
18 Mar 20 |
nicklas |
var cl = clusters[i]; |
5867 |
18 Mar 20 |
nicklas |
var option = new Option(cl.connection.name, cl.id); |
5867 |
18 Mar 20 |
nicklas |
option.cluster = cl; |
5867 |
18 Mar 20 |
nicklas |
frm.clusters[frm.clusters.length] = option; |
5867 |
18 Mar 20 |
nicklas |
265 |
} |
5867 |
18 Mar 20 |
nicklas |
seq.autoAnalyzeOnChange(); |
5867 |
18 Mar 20 |
nicklas |
267 |
} |
5867 |
18 Mar 20 |
nicklas |
268 |
|
5867 |
18 Mar 20 |
nicklas |
seq.clusterOnChange = function() |
5867 |
18 Mar 20 |
nicklas |
270 |
{ |
5867 |
18 Mar 20 |
nicklas |
var frm = document.forms['reggie']; |
5867 |
18 Mar 20 |
nicklas |
var cluster = frm.clusters[frm.clusters.selectedIndex].cluster; |
6980 |
17 Jan 23 |
nicklas |
if (cluster.priorities && cluster.priorities.length > 0) |
5867 |
18 Mar 20 |
nicklas |
274 |
{ |
6980 |
17 Jan 23 |
nicklas |
frm.priority.length = 0; |
5867 |
18 Mar 20 |
nicklas |
for (var pNo = 0; pNo < cluster.priorities.length; pNo++) |
5867 |
18 Mar 20 |
nicklas |
277 |
{ |
5867 |
18 Mar 20 |
nicklas |
var p = cluster.priorities[pNo]; |
5867 |
18 Mar 20 |
nicklas |
frm.priority[frm.priority.length] = new Option(p.name + ' ('+p.value+')', p.value, p['default'], p['default']); |
5867 |
18 Mar 20 |
nicklas |
280 |
} |
6980 |
17 Jan 23 |
nicklas |
Doc.show('job-priority'); |
5867 |
18 Mar 20 |
nicklas |
282 |
} |
5867 |
18 Mar 20 |
nicklas |
else |
5867 |
18 Mar 20 |
nicklas |
284 |
{ |
6980 |
17 Jan 23 |
nicklas |
Doc.hide('job-priority'); |
5867 |
18 Mar 20 |
nicklas |
286 |
} |
6980 |
17 Jan 23 |
nicklas |
if (cluster.partitions && cluster.partitions.length > 0) |
6980 |
17 Jan 23 |
nicklas |
288 |
{ |
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 |
291 |
{ |
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 |
296 |
} |
6980 |
17 Jan 23 |
nicklas |
Doc.show('job-partition'); |
6980 |
17 Jan 23 |
nicklas |
298 |
} |
6980 |
17 Jan 23 |
nicklas |
else |
6980 |
17 Jan 23 |
nicklas |
300 |
{ |
6980 |
17 Jan 23 |
nicklas |
Doc.hide('job-partition'); |
6980 |
17 Jan 23 |
nicklas |
302 |
} |
5867 |
18 Mar 20 |
nicklas |
303 |
} |
5867 |
18 Mar 20 |
nicklas |
304 |
|
5867 |
18 Mar 20 |
nicklas |
seq.autoAnalyzeOnChange = function() |
5867 |
18 Mar 20 |
nicklas |
306 |
{ |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('autoAnalyze'); |
5867 |
18 Mar 20 |
nicklas |
autoAnalyzeIsValid = false; |
5867 |
18 Mar 20 |
nicklas |
309 |
|
5867 |
18 Mar 20 |
nicklas |
var frm = document.forms['reggie']; |
5867 |
18 Mar 20 |
nicklas |
var yesChecked = Doc.element('autoAnalyzeYes').checked; |
5867 |
18 Mar 20 |
nicklas |
var noChecked = Doc.element('autoAnalyzeNo').checked; |
5867 |
18 Mar 20 |
nicklas |
313 |
|
5867 |
18 Mar 20 |
nicklas |
frm.clusters.disabled = !yesChecked; |
5867 |
18 Mar 20 |
nicklas |
frm.priority.disabled = !yesChecked; |
6980 |
17 Jan 23 |
nicklas |
frm.partition.disabled = !yesChecked; |
5867 |
18 Mar 20 |
nicklas |
frm.debug.disabled = !yesChecked; |
5867 |
18 Mar 20 |
nicklas |
318 |
|
5867 |
18 Mar 20 |
nicklas |
if (!yesChecked && !noChecked) |
5867 |
18 Mar 20 |
nicklas |
320 |
{ |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('autoAnalyze', 'invalid', 'Must select Yes or No'); |
5867 |
18 Mar 20 |
nicklas |
return; |
5867 |
18 Mar 20 |
nicklas |
323 |
} |
5867 |
18 Mar 20 |
nicklas |
324 |
|
5867 |
18 Mar 20 |
nicklas |
autoAnalyzeIsValid = true; |
5867 |
18 Mar 20 |
nicklas |
Wizard.setInputStatus('autoAnalyze', 'valid'); |
5867 |
18 Mar 20 |
nicklas |
327 |
|
5867 |
18 Mar 20 |
nicklas |
if (yesChecked) seq.clusterOnChange(); |
5867 |
18 Mar 20 |
nicklas |
329 |
} |
5867 |
18 Mar 20 |
nicklas |
330 |
|
5867 |
18 Mar 20 |
nicklas |
331 |
|
5867 |
18 Mar 20 |
nicklas |
seq.validateStep1 = function(event) |
5867 |
18 Mar 20 |
nicklas |
333 |
{ |
5867 |
18 Mar 20 |
nicklas |
var valid = flowCellIdIsValid; |
5867 |
18 Mar 20 |
nicklas |
valid &= sampleSheetIsValid; |
5867 |
18 Mar 20 |
nicklas |
valid &= Wizard.isValid('startDate'); |
5867 |
18 Mar 20 |
nicklas |
valid &= autoAnalyzeIsValid; |
5867 |
18 Mar 20 |
nicklas |
338 |
|
5867 |
18 Mar 20 |
nicklas |
if (!valid) event.preventDefault(); |
5867 |
18 Mar 20 |
nicklas |
340 |
} |
5867 |
18 Mar 20 |
nicklas |
341 |
|
5867 |
18 Mar 20 |
nicklas |
seq.submit = function() |
5867 |
18 Mar 20 |
nicklas |
343 |
{ |
5867 |
18 Mar 20 |
nicklas |
var frm = document.forms['reggie']; |
5867 |
18 Mar 20 |
nicklas |
Wizard.hideWizardStatus(); |
5867 |
18 Mar 20 |
nicklas |
346 |
|
5867 |
18 Mar 20 |
nicklas |
var submitInfo = {}; |
5867 |
18 Mar 20 |
nicklas |
348 |
|
5867 |
18 Mar 20 |
nicklas |
submitInfo.libraries = checkedLibraries; |
5870 |
20 Mar 20 |
nicklas |
submitInfo.operator = frm.operator.value; |
5886 |
30 Mar 20 |
nicklas |
submitInfo.libProtocol = parseInt(frm.libProtocol.value, 10); |
5867 |
18 Mar 20 |
nicklas |
submitInfo.flowCellId = frm.flowCellId.value; |
5867 |
18 Mar 20 |
nicklas |
submitInfo.startDate = frm.startDate.value; |
5867 |
18 Mar 20 |
nicklas |
submitInfo.flowCellType = frm.flowCellType.value; |
5867 |
18 Mar 20 |
nicklas |
submitInfo.numLanes = parseInt(frm.num_lanes.value); |
5867 |
18 Mar 20 |
nicklas |
submitInfo.comments = frm.comments.value; |
5867 |
18 Mar 20 |
nicklas |
357 |
|
5867 |
18 Mar 20 |
nicklas |
if (Doc.element('autoAnalyzeYes').checked) |
5867 |
18 Mar 20 |
nicklas |
359 |
{ |
5867 |
18 Mar 20 |
nicklas |
var autoAnalyze = {}; |
5867 |
18 Mar 20 |
nicklas |
autoAnalyze.cluster = frm.clusters.value; |
5867 |
18 Mar 20 |
nicklas |
autoAnalyze.priority = parseInt(frm.priority.value); |
6980 |
17 Jan 23 |
nicklas |
if (frm.partition.selectedIndex >= 0) |
6980 |
17 Jan 23 |
nicklas |
364 |
{ |
6980 |
17 Jan 23 |
nicklas |
autoAnalyze.partition = frm.partition.value; |
6980 |
17 Jan 23 |
nicklas |
366 |
} |
5867 |
18 Mar 20 |
nicklas |
autoAnalyze.debug = frm.debug.checked; |
5867 |
18 Mar 20 |
nicklas |
submitInfo.autoAnalyze = autoAnalyze; |
5867 |
18 Mar 20 |
nicklas |
369 |
} |
5867 |
18 Mar 20 |
nicklas |
370 |
|
5867 |
18 Mar 20 |
nicklas |
var url = '../SequencingRun.servlet?ID='+App.getSessionId(); |
5867 |
18 Mar 20 |
nicklas |
url += '&cmd=RegisterExternalSequencing'; |
5867 |
18 Mar 20 |
nicklas |
373 |
|
5867 |
18 Mar 20 |
nicklas |
Wizard.showLoadingAnimation('Performing registration...'); |
5867 |
18 Mar 20 |
nicklas |
Wizard.asyncJsonRequest(url, seq.submissionResults, 'POST', JSON.stringify(submitInfo)); |
5867 |
18 Mar 20 |
nicklas |
376 |
} |
5867 |
18 Mar 20 |
nicklas |
377 |
|
5867 |
18 Mar 20 |
nicklas |
seq.submissionResults = function(response) |
5867 |
18 Mar 20 |
nicklas |
379 |
{ |
5867 |
18 Mar 20 |
nicklas |
Wizard.showFinalMessage(response.messages); |
5867 |
18 Mar 20 |
nicklas |
Doc.show('gorestart'); |
5867 |
18 Mar 20 |
nicklas |
382 |
} |
5885 |
30 Mar 20 |
nicklas |
383 |
|
5885 |
30 Mar 20 |
nicklas |
384 |
|
5885 |
30 Mar 20 |
nicklas |
seq.initDebugTools = function(response) |
5885 |
30 Mar 20 |
nicklas |
386 |
{ |
5885 |
30 Mar 20 |
nicklas |
var bioplates = response.bioplates; |
5885 |
30 Mar 20 |
nicklas |
var frm = document.forms['reggie']; |
5885 |
30 Mar 20 |
nicklas |
var plates = frm.libplate; |
5885 |
30 Mar 20 |
nicklas |
if (bioplates.length > 0) |
5885 |
30 Mar 20 |
nicklas |
391 |
{ |
5885 |
30 Mar 20 |
nicklas |
for (var i=0; i < bioplates.length; i++) |
5885 |
30 Mar 20 |
nicklas |
393 |
{ |
5885 |
30 Mar 20 |
nicklas |
var bioplate = bioplates[i]; |
5885 |
30 Mar 20 |
nicklas |
plates.options[plates.length] = new Option(bioplate.name + ' (' + bioplate.usedWells + ' libraries)', bioplate.id); |
5885 |
30 Mar 20 |
nicklas |
396 |
} |
5885 |
30 Mar 20 |
nicklas |
397 |
|
5885 |
30 Mar 20 |
nicklas |
Buttons.addClickHandler('btnFakeSampleSheet', seq.generateFakeSampleSheet); |
5885 |
30 Mar 20 |
nicklas |
Wizard.showDebugTools(); |
5885 |
30 Mar 20 |
nicklas |
400 |
} |
5885 |
30 Mar 20 |
nicklas |
401 |
} |
5885 |
30 Mar 20 |
nicklas |
402 |
|
5885 |
30 Mar 20 |
nicklas |
seq.generateFakeSampleSheet = function() |
5885 |
30 Mar 20 |
nicklas |
404 |
{ |
5885 |
30 Mar 20 |
nicklas |
var frm = document.forms['reggie']; |
5885 |
30 Mar 20 |
nicklas |
var url = '../SequencingRun.servlet?ID='+App.getSessionId(); |
5885 |
30 Mar 20 |
nicklas |
url += '&cmd=GenerateFakeSampleSheet'; |
5885 |
30 Mar 20 |
nicklas |
url += '&plateId='+frm.libplate.value; |
5885 |
30 Mar 20 |
nicklas |
409 |
|
5885 |
30 Mar 20 |
nicklas |
Wizard.showLoadingAnimation('Generating sample sheet...'); |
5885 |
30 Mar 20 |
nicklas |
Wizard.asyncJsonRequest(url, seq.sampleSheetGenerated); |
5885 |
30 Mar 20 |
nicklas |
412 |
} |
5867 |
18 Mar 20 |
nicklas |
413 |
|
5885 |
30 Mar 20 |
nicklas |
seq.sampleSheetGenerated = function(response) |
5885 |
30 Mar 20 |
nicklas |
415 |
{ |
5885 |
30 Mar 20 |
nicklas |
seq.parseSampleSheet(response.sampleSheet); |
5885 |
30 Mar 20 |
nicklas |
417 |
} |
5885 |
30 Mar 20 |
nicklas |
418 |
|
5867 |
18 Mar 20 |
nicklas |
return seq; |
5867 |
18 Mar 20 |
nicklas |
420 |
}(); |
5867 |
18 Mar 20 |
nicklas |
421 |
|
5867 |
18 Mar 20 |
nicklas |
Doc.onLoad(Sequencing.initPage); |
5867 |
18 Mar 20 |
nicklas |
423 |
|