1 | <%@ page |
---|
2 | pageEncoding="UTF-8" |
---|
3 | session="false" |
---|
4 | import="net.sf.basedb.core.User" |
---|
5 | import="net.sf.basedb.core.DbControl" |
---|
6 | import="net.sf.basedb.core.SessionControl" |
---|
7 | import="net.sf.basedb.core.Application" |
---|
8 | import="net.sf.basedb.clients.web.Base" |
---|
9 | import="net.sf.basedb.clients.web.util.HTML" |
---|
10 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
11 | %> |
---|
12 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
13 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
14 | <% |
---|
15 | final SessionControl sc = Base.getExistingSessionControl(request, true); |
---|
16 | final String ID = sc.getId(); |
---|
17 | final float scale = Base.getScale(sc); |
---|
18 | final String home = ExtensionsControl.getHomeUrl("net.sf.basedb.reggie"); |
---|
19 | DbControl dc = null; |
---|
20 | try |
---|
21 | { |
---|
22 | dc = sc.newDbControl(); |
---|
23 | final User user = User.getById(dc, sc.getLoggedInUserId()); |
---|
24 | %> |
---|
25 | <base:page type="default" > |
---|
26 | <base:head scripts="ajax.js" styles="path.css"> |
---|
27 | <link rel="stylesheet" type="text/css" href="../css/reggie.css"> |
---|
28 | <link rel="stylesheet" type="text/css" href="../css/plate.css"> |
---|
29 | <script language="JavaScript" src="../reggie.js" type="text/javascript" charset="UTF-8"></script> |
---|
30 | |
---|
31 | <script language="JavaScript"> |
---|
32 | var debug = 0; |
---|
33 | var currentStep = 1; |
---|
34 | |
---|
35 | var PRESET_HISEQ = 'HiSeq'; |
---|
36 | var PRESET_NEXTSEQ = 'NextSeq'; |
---|
37 | |
---|
38 | var DEFAULT_READ_HISEQ = [55, 7, 54]; |
---|
39 | var DEFAULT_READ_NEXTSEQ = [76, 6, 76]; |
---|
40 | var VOLUME_TO_USE_FROM_POOL = 10.0; // µl |
---|
41 | |
---|
42 | var poolsAreValid = false; |
---|
43 | var flowCellsAreValid = false; |
---|
44 | var readIsValid = []; |
---|
45 | |
---|
46 | var flowCells = []; |
---|
47 | var selectedPools = []; |
---|
48 | |
---|
49 | function init() |
---|
50 | { |
---|
51 | var frm = document.forms['reggie']; |
---|
52 | var pools = getUnusedPools(); |
---|
53 | |
---|
54 | var poolsList = frm.pools; |
---|
55 | if (pools != null && pools.length > 0) |
---|
56 | { |
---|
57 | for (var poolNo=0; poolNo < pools.length; poolNo++) |
---|
58 | { |
---|
59 | var pool = pools[poolNo]; |
---|
60 | var name = pool.name + ' - '; |
---|
61 | |
---|
62 | var numPlates = pool.libPlates.length; |
---|
63 | var title = ''; |
---|
64 | |
---|
65 | if (numPlates <= 2) |
---|
66 | { |
---|
67 | for (var plateNo=0; plateNo < numPlates; plateNo++) |
---|
68 | { |
---|
69 | var libPlate = pool.libPlates[plateNo]; |
---|
70 | if (plateNo > 0) name += ', '; |
---|
71 | name += libPlate.name; |
---|
72 | } |
---|
73 | } |
---|
74 | else |
---|
75 | { |
---|
76 | name += pool.libPlates[0].name + ' + ' + (numPlates-1) + ' more...'; |
---|
77 | for (var plateNo=0; plateNo < numPlates; plateNo++) |
---|
78 | { |
---|
79 | var libPlate = pool.libPlates[plateNo]; |
---|
80 | if (plateNo > 0) title += ', '; |
---|
81 | title += libPlate.name; |
---|
82 | } |
---|
83 | } |
---|
84 | |
---|
85 | var option = new Option(name, pool.id, poolNo < 4); |
---|
86 | option.title = title; |
---|
87 | option.pool = pool; |
---|
88 | |
---|
89 | poolsList[poolsList.length] = option; |
---|
90 | } |
---|
91 | } |
---|
92 | |
---|
93 | Main.show('step.1.section'); |
---|
94 | Main.show('gocreate'); |
---|
95 | Main.show('navigation'); |
---|
96 | poolsOnChange(); |
---|
97 | presetOnChange() |
---|
98 | } |
---|
99 | |
---|
100 | function getUnusedPools() |
---|
101 | { |
---|
102 | var frm = document.forms['reggie']; |
---|
103 | |
---|
104 | var request = Ajax.getXmlHttpRequest(); |
---|
105 | try |
---|
106 | { |
---|
107 | showLoadingAnimation('Loading pools...'); |
---|
108 | var url = '../FlowCell.servlet?ID=<%=ID%>&cmd=GetUnusedPools'; |
---|
109 | request.open("GET", url, false); |
---|
110 | request.send(null); |
---|
111 | } |
---|
112 | finally |
---|
113 | { |
---|
114 | hideLoadingAnimation(); |
---|
115 | } |
---|
116 | |
---|
117 | if (debug) Main.debug(request.responseText); |
---|
118 | var response = JSON.parse(request.responseText); |
---|
119 | if (response.status != 'ok') |
---|
120 | { |
---|
121 | setFatalError(response.message); |
---|
122 | return false; |
---|
123 | } |
---|
124 | return response.pools; |
---|
125 | } |
---|
126 | |
---|
127 | function loadFlowCellNames(numNames) |
---|
128 | { |
---|
129 | var frm = document.forms['reggie']; |
---|
130 | |
---|
131 | // Load Libraries and related info from the selected bioplate |
---|
132 | var request = Ajax.getXmlHttpRequest(); |
---|
133 | try |
---|
134 | { |
---|
135 | showLoadingAnimation('Loading flow cell information...'); |
---|
136 | var url = '../FlowCell.servlet?ID=<%=ID%>&cmd=GetNextAutoGeneratedFlowCellNames&numNames='+numNames; |
---|
137 | request.open("GET", url, false); |
---|
138 | request.send(null); |
---|
139 | } |
---|
140 | finally |
---|
141 | { |
---|
142 | hideLoadingAnimation(); |
---|
143 | } |
---|
144 | |
---|
145 | if (debug) Main.debug(request.responseText); |
---|
146 | var response = JSON.parse(request.responseText); |
---|
147 | if (response.status != 'ok') |
---|
148 | { |
---|
149 | setFatalError(response.message); |
---|
150 | return false; |
---|
151 | } |
---|
152 | |
---|
153 | var names = response.names; |
---|
154 | for (var i = 0; i < names.length; i++) |
---|
155 | { |
---|
156 | var fc = {}; |
---|
157 | fc.name = names[i]; |
---|
158 | flowCells[i] = fc; |
---|
159 | setInnerHTML('fc.'+i, fc.name); |
---|
160 | setInnerHTML('comments.'+i+'.name', fc.name); |
---|
161 | } |
---|
162 | } |
---|
163 | |
---|
164 | function poolsOnChange() |
---|
165 | { |
---|
166 | poolsAreValid = false; |
---|
167 | |
---|
168 | var frm = document.forms['reggie']; |
---|
169 | var preset = frm.preset.value; |
---|
170 | var poolsList = frm.pools; |
---|
171 | |
---|
172 | var numSelected = 0; |
---|
173 | for (var i = 0; i < poolsList.length; i++) |
---|
174 | { |
---|
175 | if (poolsList[i].selected) numSelected++; |
---|
176 | } |
---|
177 | |
---|
178 | setInnerHTML('numSelected', numSelected + ' selected'); |
---|
179 | |
---|
180 | if (numSelected == 0) |
---|
181 | { |
---|
182 | setInputStatus('pools', 'Must select at least 1 pool.', 'invalid'); |
---|
183 | return; |
---|
184 | } |
---|
185 | if (preset == PRESET_NEXTSEQ && numSelected > 1) |
---|
186 | { |
---|
187 | setInputStatus('pools', 'Can only use 1 pool with the NextSeq.', 'invalid'); |
---|
188 | return; |
---|
189 | } |
---|
190 | |
---|
191 | poolsAreValid = true; |
---|
192 | setInputStatus('pools', '', 'valid'); |
---|
193 | } |
---|
194 | |
---|
195 | |
---|
196 | var subtypePooledLibrary = null; |
---|
197 | function selectPools() |
---|
198 | { |
---|
199 | var frm = document.forms['reggie']; |
---|
200 | if (frm.pools.disabled) return; |
---|
201 | |
---|
202 | if (subtypePooledLibrary == null) |
---|
203 | { |
---|
204 | var request = Ajax.getXmlHttpRequest(); |
---|
205 | var url = '../Subtype.servlet?ID=<%=ID%>&cmd=GetSubtypeInfo&name=POOLED_LIBRARY'; |
---|
206 | request.open("GET", url, false); |
---|
207 | request.send(null); |
---|
208 | |
---|
209 | if (debug) Main.debug(request.responseText); |
---|
210 | var response = JSON.parse(request.responseText); |
---|
211 | if (response.status != 'ok') |
---|
212 | { |
---|
213 | setFatalError(response.message); |
---|
214 | return false; |
---|
215 | } |
---|
216 | subtypePooledLibrary = response.subtype; |
---|
217 | } |
---|
218 | |
---|
219 | var url = getRoot() + 'biomaterials/extracts/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectmultiple&callback=setPoolCallback'; |
---|
220 | url += '&tmpfilter:INT:itemSubtype='+subtypePooledLibrary.id; |
---|
221 | url += '&tmpfilter:DATE:creationEvent.eventDate='+encodeURIComponent('<>'); |
---|
222 | url += '&resetTemporary=1'; |
---|
223 | Main.openPopup(url, 'SelectPooledLibraries', 1050, 700); |
---|
224 | } |
---|
225 | |
---|
226 | function setPoolCallback(id, name) |
---|
227 | { |
---|
228 | var frm = document.forms['reggie']; |
---|
229 | var poolsList = frm.pools; |
---|
230 | for (var i = 0; i < poolsList.length; i++) |
---|
231 | { |
---|
232 | if (poolsList[i].value == id) |
---|
233 | { |
---|
234 | poolsList[i].selected = true; |
---|
235 | poolsOnChange(); |
---|
236 | return; |
---|
237 | } |
---|
238 | } |
---|
239 | |
---|
240 | var option = new Option(name, id, true, true); |
---|
241 | option.pool = {'id': parseInt(id), 'name': name }; |
---|
242 | poolsList[poolsList.length] = option; |
---|
243 | poolsOnChange(); |
---|
244 | } |
---|
245 | |
---|
246 | |
---|
247 | function goNext(manual) |
---|
248 | { |
---|
249 | setInnerHTML('gonext.message', ''); |
---|
250 | if (currentStep == 1) |
---|
251 | { |
---|
252 | gotoStep2(); |
---|
253 | } |
---|
254 | setCurrentStep(currentStep); |
---|
255 | } |
---|
256 | |
---|
257 | function gotoStep2() |
---|
258 | { |
---|
259 | if (!poolsAreValid) return; |
---|
260 | |
---|
261 | var frm = document.forms['reggie']; |
---|
262 | frm.preset.disabled = true; |
---|
263 | frm.pools.disabled = true; |
---|
264 | frm.num_flowcells[0].disabled = true; |
---|
265 | frm.num_flowcells[1].disabled = true; |
---|
266 | frm.num_lanes[0].disabled = true; |
---|
267 | frm.num_lanes[1].disabled = true; |
---|
268 | frm.num_lanes[2].disabled = true; |
---|
269 | |
---|
270 | var numFlowCells = Forms.getCheckedRadio(frm.num_flowcells).value; |
---|
271 | loadFlowCellNames(numFlowCells); |
---|
272 | var plate = document.getElementById('plate'); |
---|
273 | if (numFlowCells == 1) |
---|
274 | { |
---|
275 | Main.addClass(plate, 'hide-fc-1'); |
---|
276 | Main.hide('comments.1'); |
---|
277 | } |
---|
278 | |
---|
279 | var numLanes = Forms.getCheckedRadio(frm.num_lanes).value; |
---|
280 | for (var i = numLanes; i < 8; i++) |
---|
281 | { |
---|
282 | Main.hide('lane.'+i); |
---|
283 | } |
---|
284 | |
---|
285 | var selectPoolHtml = ''; |
---|
286 | for (var i = 0; i < frm.pools.length; i++) |
---|
287 | { |
---|
288 | if (frm.pools[i].selected) |
---|
289 | { |
---|
290 | var pool = frm.pools[i].pool; |
---|
291 | var index = selectedPools.length; |
---|
292 | selectedPools[index] = pool; |
---|
293 | |
---|
294 | selectPoolHtml += '<div class="menuitem enabled" id="pool-'+pool.id+'" data-index="'+index+'">'; |
---|
295 | selectPoolHtml += pool.name+'</div>'; |
---|
296 | } |
---|
297 | } |
---|
298 | // Add separator |
---|
299 | selectPoolHtml += '<div class="menuseparator"></div>'; |
---|
300 | // Add option for empty lane |
---|
301 | selectPoolHtml += '<div class="menuitem enabled" id="pool-none">'; |
---|
302 | selectPoolHtml += '<i>empty</i>'+'</div>'; |
---|
303 | |
---|
304 | setInnerHTML('select-pool-all', selectPoolHtml); |
---|
305 | |
---|
306 | // Initialize flowCell->lane->pool array |
---|
307 | for (var fcNo = 0; fcNo < numFlowCells; fcNo++) |
---|
308 | { |
---|
309 | var flowCell = flowCells[fcNo]; |
---|
310 | flowCell.lanes = []; |
---|
311 | for (var laneNo = 0; laneNo < numLanes; laneNo++) |
---|
312 | { |
---|
313 | flowCell.lanes[laneNo] = {}; |
---|
314 | } |
---|
315 | } |
---|
316 | |
---|
317 | // Case 1: 4 pools on 2+2 lanes |
---|
318 | if (numFlowCells == 2 && numLanes == 8 && selectedPools.length == 4) |
---|
319 | { |
---|
320 | // Assign all pools to 2 lanes on each flow cell |
---|
321 | for (var poolNo = 0; poolNo < 4; poolNo++) |
---|
322 | { |
---|
323 | var pool = selectedPools[poolNo]; |
---|
324 | flowCells[0].lanes[poolNo] = {'pool': pool, 'defaultPool': pool}; |
---|
325 | flowCells[0].lanes[poolNo+4] = {'pool': pool, 'defaultPool': pool}; |
---|
326 | flowCells[1].lanes[3-poolNo] = {'pool': pool, 'defaultPool': pool}; |
---|
327 | flowCells[1].lanes[7-poolNo] = {'pool': pool, 'defaultPool': pool}; |
---|
328 | } |
---|
329 | } |
---|
330 | |
---|
331 | // Case 2: A single pool on all lanes |
---|
332 | if (selectedPools.length == 1) |
---|
333 | { |
---|
334 | var pool = selectedPools[0]; |
---|
335 | for (var fcNo = 0; fcNo < numFlowCells; fcNo++) |
---|
336 | { |
---|
337 | for (var laneNo = 0; laneNo < numLanes; laneNo++) |
---|
338 | { |
---|
339 | flowCells[fcNo].lanes[laneNo] = {'pool': pool, 'defaultPool': pool}; |
---|
340 | } |
---|
341 | } |
---|
342 | } |
---|
343 | |
---|
344 | checkFlowCells(); |
---|
345 | |
---|
346 | currentStep = 2; |
---|
347 | Main.show('step.2.section'); |
---|
348 | Main.addClass(document.getElementById('step.1.section'), 'disabled'); |
---|
349 | Main.hide('gonext'); |
---|
350 | Main.show('gocancel'); |
---|
351 | Main.show('goregister'); |
---|
352 | |
---|
353 | readOnBlur('read1'); |
---|
354 | readOnBlur('indexRead'); |
---|
355 | readOnBlur('read2'); |
---|
356 | frm.read1.focus(); |
---|
357 | |
---|
358 | } |
---|
359 | |
---|
360 | function checkFlowCells() |
---|
361 | { |
---|
362 | setInputStatus('flowCells', '', ''); |
---|
363 | flowCellsAreValid = false; |
---|
364 | |
---|
365 | var frm = document.forms['reggie']; |
---|
366 | var numFlowCells = Forms.getCheckedRadio(frm.num_flowcells).value; |
---|
367 | var numLanes = Forms.getCheckedRadio(frm.num_lanes).value; |
---|
368 | var numEmptyLanes = 0; |
---|
369 | var missingValues = false; |
---|
370 | for (var fcNo = 0; fcNo < flowCells.length; fcNo++) |
---|
371 | { |
---|
372 | for (var laneNo = 0; laneNo < flowCells[fcNo].lanes.length; laneNo++) |
---|
373 | { |
---|
374 | var lane = flowCells[fcNo].lanes[laneNo]; |
---|
375 | var pool = lane.pool; |
---|
376 | |
---|
377 | var name = pool ? pool.name : ''; |
---|
378 | if (lane.defaultPool && pool != lane.defaultPool) |
---|
379 | { |
---|
380 | name += ' *'; |
---|
381 | } |
---|
382 | |
---|
383 | setInnerHTML('lane.'+laneNo+'.'+fcNo, name); |
---|
384 | |
---|
385 | if (!pool) |
---|
386 | { |
---|
387 | missingValues = true; |
---|
388 | numEmptyLanes++; |
---|
389 | } |
---|
390 | } |
---|
391 | } |
---|
392 | |
---|
393 | if (numEmptyLanes >= numFlowCells*numLanes) |
---|
394 | { |
---|
395 | setInputStatus('flowCells', 'All lanes empty', 'invalid'); |
---|
396 | } |
---|
397 | else if (missingValues) |
---|
398 | { |
---|
399 | setInputStatus('flowCells', 'Missing', 'warning'); |
---|
400 | flowCellsAreValid = true; |
---|
401 | } |
---|
402 | else |
---|
403 | { |
---|
404 | setInputStatus('flowCells', '', 'valid'); |
---|
405 | flowCellsAreValid = true; |
---|
406 | } |
---|
407 | } |
---|
408 | |
---|
409 | function readOnBlur(name, defaultIndex) |
---|
410 | { |
---|
411 | var frm = document.forms['reggie']; |
---|
412 | setInputStatus(name, '', ''); |
---|
413 | |
---|
414 | var defaultArray = frm.preset.value == PRESET_NEXTSEQ ? DEFAULT_READ_NEXTSEQ : DEFAULT_READ_HISEQ; |
---|
415 | var defaultValue = frm.preset.value ? defaultArray[defaultIndex] : 0; |
---|
416 | |
---|
417 | var value = frm[name].value; |
---|
418 | if (value == '') |
---|
419 | { |
---|
420 | readIsValid[name] = false; |
---|
421 | setInputStatus(name, 'Missing', 'invalid'); |
---|
422 | return; |
---|
423 | } |
---|
424 | |
---|
425 | if (!Numbers.isInteger(value)) |
---|
426 | { |
---|
427 | readIsValid[name] = false; |
---|
428 | setInputStatus(name, 'Not a number', 'invalid'); |
---|
429 | return; |
---|
430 | } |
---|
431 | |
---|
432 | readIsValid[name] = true; |
---|
433 | if (defaultValue && parseInt(value) != defaultValue) |
---|
434 | { |
---|
435 | setInputStatus(name, 'Default: ' + defaultValue, 'warning'); |
---|
436 | } |
---|
437 | else |
---|
438 | { |
---|
439 | setInputStatus(name, '', 'valid'); |
---|
440 | } |
---|
441 | } |
---|
442 | |
---|
443 | function step2IsValid() |
---|
444 | { |
---|
445 | if (!flowCellsAreValid) return false; |
---|
446 | |
---|
447 | if (readIsValid['read1'] != true) return false; |
---|
448 | if (readIsValid['indexRead'] != true) return false; |
---|
449 | if (readIsValid['read2'] != true) return false; |
---|
450 | |
---|
451 | return true; |
---|
452 | } |
---|
453 | |
---|
454 | function goRegister() |
---|
455 | { |
---|
456 | if (!step2IsValid()) return; |
---|
457 | |
---|
458 | var frm = document.forms['reggie']; |
---|
459 | frm.read1.disabled = true; |
---|
460 | frm.indexRead.disabled = true; |
---|
461 | frm.read2.disabled = true; |
---|
462 | |
---|
463 | Main.hide('goregister'); |
---|
464 | Main.hide('gocancel'); |
---|
465 | Main.addClass(document.getElementById('step.2.section'), 'disabled'); |
---|
466 | |
---|
467 | var submitInfo = {}; |
---|
468 | submitInfo.flowCellType = frm.preset.value; |
---|
469 | submitInfo.read1 = parseInt(frm.read1.value); |
---|
470 | submitInfo.indexRead = parseInt(frm.indexRead.value); |
---|
471 | submitInfo.read2 = parseInt(frm.read2.value); |
---|
472 | submitInfo.flowCells = flowCells; |
---|
473 | |
---|
474 | // Calculate volume to use for each pool |
---|
475 | for (var fcNo = 0; fcNo < flowCells.length; fcNo++) |
---|
476 | { |
---|
477 | var flowCell = flowCells[fcNo]; |
---|
478 | flowCell.comment = frm['comments.'+fcNo].value; |
---|
479 | for (var laneNo = 0; laneNo < flowCell.lanes.length; laneNo++) |
---|
480 | { |
---|
481 | var lane = flowCell.lanes[laneNo]; |
---|
482 | lane.defaultPool = null; // Do not need to submit this information |
---|
483 | var pool = lane.pool; |
---|
484 | if (pool != null) |
---|
485 | { |
---|
486 | pool.count = pool.count ? pool.count+1 : 1; |
---|
487 | } |
---|
488 | } |
---|
489 | } |
---|
490 | |
---|
491 | for (var poolNo = 0; poolNo < selectedPools.length; poolNo++) |
---|
492 | { |
---|
493 | var pool = selectedPools[poolNo]; |
---|
494 | if (pool != null) |
---|
495 | { |
---|
496 | pool.usedVolume = VOLUME_TO_USE_FROM_POOL / pool.count; |
---|
497 | } |
---|
498 | } |
---|
499 | |
---|
500 | if (debug) Main.debug(JSON.stringify(submitInfo)); |
---|
501 | |
---|
502 | var url = '../FlowCell.servlet?ID=<%=ID%>&cmd=CreateFlowCells'; |
---|
503 | |
---|
504 | var request = Ajax.getXmlHttpRequest(); |
---|
505 | try |
---|
506 | { |
---|
507 | showLoadingAnimation('Performing registration...'); |
---|
508 | request.open("POST", url, false); |
---|
509 | request.send(JSON.stringify(submitInfo)); |
---|
510 | } |
---|
511 | finally |
---|
512 | { |
---|
513 | hideLoadingAnimation(); |
---|
514 | } |
---|
515 | |
---|
516 | if (debug) Main.debug(request.responseText); |
---|
517 | var response = JSON.parse(request.responseText); |
---|
518 | |
---|
519 | if (response.messages && response.messages.length > 0) |
---|
520 | { |
---|
521 | var msg = '<ul>'; |
---|
522 | for (var i = 0; i < response.messages.length; i++) |
---|
523 | { |
---|
524 | var msgLine = response.messages[i]; |
---|
525 | if (msgLine.indexOf('[Warning]') >= 0) |
---|
526 | { |
---|
527 | msg += '<li class="warning">' + msgLine.replace('[Warning]', ''); |
---|
528 | } |
---|
529 | else |
---|
530 | { |
---|
531 | msg += '<li>' + msgLine; |
---|
532 | } |
---|
533 | } |
---|
534 | msg += '</ul>'; |
---|
535 | setInnerHTML('messages', msg); |
---|
536 | Main.show('messages'); |
---|
537 | } |
---|
538 | |
---|
539 | if (response.status != 'ok') |
---|
540 | { |
---|
541 | Main.addClass(document.getElementById('messages'), 'failure'); |
---|
542 | setFatalError(response.message); |
---|
543 | return false; |
---|
544 | } |
---|
545 | |
---|
546 | Main.show('gorestart'); |
---|
547 | |
---|
548 | |
---|
549 | } |
---|
550 | |
---|
551 | var currentFcNo; |
---|
552 | var currentLaneNo; |
---|
553 | function selectPool(event, fcNo, laneNo) |
---|
554 | { |
---|
555 | var frm = document.forms['reggie']; |
---|
556 | if (frm.preset.value == PRESET_NEXTSEQ) return; |
---|
557 | |
---|
558 | currentFcNo = fcNo; |
---|
559 | currentLaneNo = laneNo; |
---|
560 | |
---|
561 | // Reset 'current' selection |
---|
562 | var menu = document.getElementById('select-pool'); |
---|
563 | var selectAll = document.getElementById('select-pool-all'); |
---|
564 | for (var i = 0; i < selectAll.childNodes.length; i++) |
---|
565 | { |
---|
566 | Main.removeClass(selectAll.childNodes[i], 'current'); |
---|
567 | Main.removeClass(selectAll.childNodes[i], 'default'); |
---|
568 | } |
---|
569 | menu.style.display = 'block'; |
---|
570 | |
---|
571 | var currentPool = flowCells[fcNo].lanes[laneNo].pool; |
---|
572 | var defaultPool = flowCells[fcNo].lanes[laneNo].defaultPool; |
---|
573 | if (currentPool) |
---|
574 | { |
---|
575 | Main.addClass(document.getElementById('pool-'+currentPool.id), 'current'); |
---|
576 | } |
---|
577 | if (defaultPool && defaultPool != currentPool) |
---|
578 | { |
---|
579 | Main.addClass(document.getElementById('pool-'+defaultPool.id), 'default'); |
---|
580 | } |
---|
581 | |
---|
582 | |
---|
583 | var x = event.clientX; |
---|
584 | var halfHeight = Math.floor(selectAll.offsetHeight/2) |
---|
585 | var y = event.clientY+2; //-halfHeight; |
---|
586 | |
---|
587 | var scroll = 0; |
---|
588 | |
---|
589 | // Position the selection div |
---|
590 | selectAll.scrollTop = scroll; |
---|
591 | menu.style.left = (x)+'px'; |
---|
592 | menu.style.top = (y)+'px'; |
---|
593 | event.stopPropagation(); |
---|
594 | } |
---|
595 | |
---|
596 | function poolSelected(event) |
---|
597 | { |
---|
598 | var optionId = event.target.id; |
---|
599 | var pool = null; |
---|
600 | if (optionId != 'pool-none') |
---|
601 | { |
---|
602 | var index = event.target.getAttribute('data-index'); |
---|
603 | pool = selectedPools[index]; |
---|
604 | } |
---|
605 | flowCells[currentFcNo].lanes[currentLaneNo].pool = pool; |
---|
606 | setInnerHTML('lane.'+currentLaneNo+'.'+currentFcNo, pool ? pool.name : ''); |
---|
607 | checkFlowCells(); |
---|
608 | } |
---|
609 | |
---|
610 | function presetOnChange() |
---|
611 | { |
---|
612 | var frm = document.forms['reggie']; |
---|
613 | var preset = frm.preset.value; |
---|
614 | |
---|
615 | if (preset == PRESET_HISEQ) |
---|
616 | { |
---|
617 | frm.num_lanes[0].disabled = true; |
---|
618 | frm.num_lanes[1].disabled = true; |
---|
619 | frm.num_lanes[2].disabled = false; |
---|
620 | frm.num_lanes[2].checked = true; |
---|
621 | for (var i = 0; i<frm.pools.length; i++) |
---|
622 | { |
---|
623 | frm.pools[i].selected = i < 4; |
---|
624 | } |
---|
625 | frm.read1.value = DEFAULT_READ_HISEQ[0]; |
---|
626 | frm.indexRead.value = DEFAULT_READ_HISEQ[1]; |
---|
627 | frm.read2.value = DEFAULT_READ_HISEQ[2]; |
---|
628 | } |
---|
629 | else if (preset == PRESET_NEXTSEQ) |
---|
630 | { |
---|
631 | document.getElementById('num_lanes_4').checked = true; |
---|
632 | frm.num_lanes[0].disabled = true; |
---|
633 | frm.num_lanes[1].disabled = false; |
---|
634 | frm.num_lanes[2].disabled = true; |
---|
635 | frm.num_lanes[1].selected = true; |
---|
636 | for (var i = 0; i<frm.pools.length; i++) |
---|
637 | { |
---|
638 | frm.pools[i].selected = i < 1; |
---|
639 | } |
---|
640 | frm.read1.value = DEFAULT_READ_NEXTSEQ[0]; |
---|
641 | frm.indexRead.value = DEFAULT_READ_NEXTSEQ[1]; |
---|
642 | frm.read2.value = DEFAULT_READ_NEXTSEQ[2]; |
---|
643 | } |
---|
644 | else |
---|
645 | { |
---|
646 | frm.num_lanes[0].disabled = false; |
---|
647 | frm.num_lanes[1].disabled = false; |
---|
648 | frm.num_lanes[2].disabled = false; |
---|
649 | } |
---|
650 | |
---|
651 | poolsOnChange(); |
---|
652 | } |
---|
653 | |
---|
654 | </script> |
---|
655 | <style> |
---|
656 | #numSelected |
---|
657 | { |
---|
658 | font-style: italic; |
---|
659 | margin-top: 0.25em; |
---|
660 | margin-left: 1em; |
---|
661 | } |
---|
662 | |
---|
663 | .plate .header |
---|
664 | { |
---|
665 | height: 3em; |
---|
666 | } |
---|
667 | |
---|
668 | .plate .header th.col-0, .plate .header th.col-1 |
---|
669 | { |
---|
670 | border-bottom: 1px solid #A0A0A0; |
---|
671 | } |
---|
672 | |
---|
673 | .well |
---|
674 | { |
---|
675 | height: 2em; |
---|
676 | max-height: 2em; |
---|
677 | min-height: 2em; |
---|
678 | width: 10em; |
---|
679 | max-width: 10em; |
---|
680 | min-width: 10em; |
---|
681 | font-size: 100%; |
---|
682 | text-align: center; |
---|
683 | vertical-align: middle; |
---|
684 | } |
---|
685 | |
---|
686 | .plate tbody .lane |
---|
687 | { |
---|
688 | border-right: 1px solid #A0A0A0; |
---|
689 | width: 3em; |
---|
690 | } |
---|
691 | |
---|
692 | .well.col-1 |
---|
693 | { |
---|
694 | border-left-style: solid; |
---|
695 | } |
---|
696 | |
---|
697 | .hide-fc-1 .col-1 |
---|
698 | { |
---|
699 | display: none; |
---|
700 | } |
---|
701 | |
---|
702 | #select-pool-all |
---|
703 | { |
---|
704 | max-height: 20em; |
---|
705 | overflow: auto; |
---|
706 | } |
---|
707 | |
---|
708 | #select-pool .menuitem |
---|
709 | { |
---|
710 | padding-left: 16px; |
---|
711 | } |
---|
712 | |
---|
713 | #select-pool div.current |
---|
714 | { |
---|
715 | font-weight: bold; |
---|
716 | background-image: url('../images/selected.gif'); |
---|
717 | background-position: 2px 50%; |
---|
718 | background-repeat: no-repeat; |
---|
719 | } |
---|
720 | |
---|
721 | #select-pool div.default:after |
---|
722 | { |
---|
723 | content: ' (default)'; |
---|
724 | } |
---|
725 | |
---|
726 | #select-pool .menuitem:hover |
---|
727 | { |
---|
728 | padding-left: 14px; |
---|
729 | background-position: 0px 50%; |
---|
730 | } |
---|
731 | |
---|
732 | </style> |
---|
733 | </base:head> |
---|
734 | <base:body onload="init()"> |
---|
735 | |
---|
736 | <p:path><p:pathelement |
---|
737 | title="Reggie" href="<%="../index.jsp?ID="+ID%>" |
---|
738 | /><p:pathelement title="Create flow cells" |
---|
739 | /></p:path> |
---|
740 | |
---|
741 | <div class="content" onclick="Main.hide('select-pool')"> |
---|
742 | <% |
---|
743 | if (sc.getActiveProjectId() == 0) |
---|
744 | { |
---|
745 | %> |
---|
746 | <div class="messagecontainer note" style="width: 950px; margin-left: 20px; margin-bottom: 20px; margin-right: 0px; font-weight: bold; color: #cc0000;"> |
---|
747 | No project has been selected. You may proceed with the registration but |
---|
748 | created items will not be shared. |
---|
749 | </div> |
---|
750 | <% |
---|
751 | } |
---|
752 | %> |
---|
753 | |
---|
754 | <div id="select-pool" class="menu vertical" style="width: 150px; display: none;" |
---|
755 | onclick="poolSelected(event)"> |
---|
756 | <div id="select-pool-all"></div> |
---|
757 | </div> |
---|
758 | |
---|
759 | <form name="reggie" onsubmit="return false;"> |
---|
760 | |
---|
761 | <div id="step.1.section" style="display: none;"> |
---|
762 | <table class="stepform"> |
---|
763 | <tr> |
---|
764 | <td rowspan="3" class="stepno">1</td> |
---|
765 | <td class="steptitle">Select pools</td> |
---|
766 | </tr> |
---|
767 | <tr> |
---|
768 | <td class="stepfields"> |
---|
769 | <table> |
---|
770 | <tr valign="top"> |
---|
771 | <td class="prompt">Flow cell type</td> |
---|
772 | <td class="input"> |
---|
773 | <select name="preset" onchange="presetOnChange()"> |
---|
774 | <option value="">Custom |
---|
775 | <option value="HiSeq" selected>HiSeq |
---|
776 | <option value="NextSeq">NextSeq |
---|
777 | </select> |
---|
778 | </td> |
---|
779 | <td class="status" id="preset.status"></td> |
---|
780 | <td class="help"><span id="preset.message" class="message" style="display: none;"></span> |
---|
781 | The selected preset affects number of lanes per flow cell. |
---|
782 | </td> |
---|
783 | </tr> |
---|
784 | <tr valign="top"> |
---|
785 | <td class="prompt">Number of flow cells</td> |
---|
786 | <td class="input"> |
---|
787 | <label><input type="radio" name="num_flowcells" value="1">1</label> |
---|
788 | <label><input type="radio" name="num_flowcells" value="2" checked>2</label> |
---|
789 | </td> |
---|
790 | <td class="status" id="numFlowCells.status"></td> |
---|
791 | <td class="help"><span id="numFlowCells.message" class="message" style="display: none;"></span> |
---|
792 | Select how many flow cells to create. |
---|
793 | </td> |
---|
794 | </tr> |
---|
795 | <tr valign="top"> |
---|
796 | <td class="prompt">Lanes/flow cell</td> |
---|
797 | <td class="input" id="lanes"> |
---|
798 | <label><input type="radio" name="num_lanes" id="num_lanes_2" value="2">2</label> |
---|
799 | <label><input type="radio" name="num_lanes" id="num_lanes_4" value="4">4</label> |
---|
800 | <label><input type="radio" name="num_lanes" id="num_lanes_8" value="8" checked>8</label> |
---|
801 | </td> |
---|
802 | <td class="status" id="lanes.status"></td> |
---|
803 | <td class="help"><span id="lanes.message" class="message" style="display: none;"></span> |
---|
804 | Select the number of lanes on each flow cell. |
---|
805 | </td> |
---|
806 | </tr> |
---|
807 | <tr valign="top"> |
---|
808 | <td class="prompt">Pools</td> |
---|
809 | <td class="input"><select style="width:90%;" size="6" |
---|
810 | name="pools" id="pools" multiple onchange="poolsOnChange()"></select> |
---|
811 | <div id="numSelected"></div> |
---|
812 | <base:buttongroup style="margin-top: 0.5em;"> |
---|
813 | <base:button title="Select manually…" onclick="selectPools()" id="btnSelectPools" /> |
---|
814 | </base:buttongroup> |
---|
815 | </td> |
---|
816 | <td class="status" id="pools.status"></td> |
---|
817 | <td class="help"><span id="pools.message" class="message" style="display: none;"></span> |
---|
818 | Select the pools that should be used in the flow cells. The list contain pools that has |
---|
819 | not yet been used (determined by comparing remaining and original quantity). |
---|
820 | </td> |
---|
821 | </tr> |
---|
822 | </table> |
---|
823 | </td> |
---|
824 | </tr> |
---|
825 | </table> |
---|
826 | </div> |
---|
827 | |
---|
828 | <div id="step.2.section" style="display: none;"> |
---|
829 | <table class="stepform"> |
---|
830 | <tr> |
---|
831 | <td rowspan="3" class="stepno">2</td> |
---|
832 | <td class="steptitle">Flow cell information</td> |
---|
833 | </tr> |
---|
834 | <tr> |
---|
835 | <td class="stepfields"> |
---|
836 | |
---|
837 | <table style="border-collapse: collapse;"> |
---|
838 | <tr valign="top"> |
---|
839 | <td class="prompt">Sequencing cycles</td> |
---|
840 | <td colspan="2">Read 1</td> |
---|
841 | <td colspan="2">Index</td> |
---|
842 | <td colspan="2">Read 2</td> |
---|
843 | <td class="help" rowspan="3"> |
---|
844 | Planned number of sequencing cycles. The actual numbers used may be changed in the |
---|
845 | registration wizard. |
---|
846 | </td> |
---|
847 | </tr> |
---|
848 | <tr valign="top"> |
---|
849 | <td class="subprompt"></td> |
---|
850 | <td> |
---|
851 | <input type="text" class="required" name="read1" value="" |
---|
852 | size="8" onkeypress="return Numbers.integerOnly(event)" onblur="readOnBlur(this.name, 0)"> |
---|
853 | </td> |
---|
854 | <td class="status" id="read1.status"></td> |
---|
855 | <td> |
---|
856 | <input type="text" class="required" name="indexRead" value="" |
---|
857 | size="8" onkeypress="return Numbers.integerOnly(event)" onblur="readOnBlur(this.name, 1)"> |
---|
858 | </td> |
---|
859 | <td class="status" id="indexRead.status"></td> |
---|
860 | <td> |
---|
861 | <input type="text" class="required" name="read2" value="" |
---|
862 | size="8" onkeypress="return Numbers.integerOnly(event)" onblur="readOnBlur(this.name, 2)"> |
---|
863 | |
---|
864 | </td> |
---|
865 | <td class="status" id="read2.status"></td> |
---|
866 | </tr> |
---|
867 | <tr valign="top"> |
---|
868 | <td class="prompt"></td> |
---|
869 | <td colspan="2"><span id="read1.message" class="message" style="display: none;"></span></td> |
---|
870 | <td colspan="2"><span id="indexRead.message" class="message" style="display: none;"></span></td> |
---|
871 | <td colspan="2"><span id="read2.message" class="message" style="display: none;"></span></td> |
---|
872 | </tr> |
---|
873 | <tr valign="top" style="border-top: 1em solid transparent;"> |
---|
874 | <td class="prompt">Flow cell layout</td> |
---|
875 | <td class="input" colspan="5"> |
---|
876 | <table class="plate" id="plate" style="margin-bottom: 1em;"> |
---|
877 | <thead> |
---|
878 | <tr class="header"> |
---|
879 | <th class="lane">Lane</th> |
---|
880 | <% |
---|
881 | for (int fcNo = 0; fcNo < 2; fcNo++) |
---|
882 | { |
---|
883 | %> |
---|
884 | <th class="col-<%=fcNo%>" id="fc.<%=fcNo%>">FlowCell<%=fcNo%></th> |
---|
885 | <% |
---|
886 | } |
---|
887 | %> |
---|
888 | </tr> |
---|
889 | </thead> |
---|
890 | <tbody> |
---|
891 | <% |
---|
892 | for (int laneNo = 0; laneNo < 8; laneNo++) |
---|
893 | { |
---|
894 | %> |
---|
895 | <tr class="row-<%=laneNo%>" id="lane.<%=laneNo%>"> |
---|
896 | <th class="lane"><%=laneNo+1%></th> |
---|
897 | <% |
---|
898 | for (int fcNo = 0; fcNo < 2; fcNo++) |
---|
899 | { |
---|
900 | %> |
---|
901 | <td class="well col-<%=fcNo%>" id="lane.<%=laneNo%>.<%=fcNo%>" |
---|
902 | onclick="selectPool(event, <%=fcNo%>, <%=laneNo%>)"></td> |
---|
903 | <% |
---|
904 | } |
---|
905 | %> |
---|
906 | </tr> |
---|
907 | <% |
---|
908 | } |
---|
909 | %> |
---|
910 | </tbody> |
---|
911 | </table> |
---|
912 | |
---|
913 | </td> |
---|
914 | <td class="status" id="flowCells.status"></td> |
---|
915 | <td class="help"><span id="flowCells.message" class="message" style="display: none;"></span> |
---|
916 | Assign a pool to each flow cell lane. Click on each lane to select a different pool. |
---|
917 | </td> |
---|
918 | </tr> |
---|
919 | <tr valign="top"> |
---|
920 | <td class="prompt">Comments</td> |
---|
921 | <td class="input" colspan="5"></td> |
---|
922 | <td class="status" id="comments.status"></td> |
---|
923 | <td class="help"><span id="comments.message" class="message" style="display: none;"></span>Comments about the flow cells.</td> |
---|
924 | </tr> |
---|
925 | <tbody id="flowcell-comments"> |
---|
926 | <% |
---|
927 | for (int fcNo = 0; fcNo < 2; fcNo++) |
---|
928 | { |
---|
929 | %> |
---|
930 | <tr valign="top" id="comments.<%=fcNo%>"> |
---|
931 | <td class="subprompt" id="comments.<%=fcNo%>.name">FlowCell<%=fcNo%></td> |
---|
932 | <td class="input" colspan="5"><textarea rows="3" cols="50" style="width: 90%;" name="comments.<%=fcNo%>" value=""></textarea></td> |
---|
933 | <td class="status"></td> |
---|
934 | <td class="help"></td> |
---|
935 | </tr> |
---|
936 | <% |
---|
937 | } |
---|
938 | %> |
---|
939 | </tbody> |
---|
940 | </table> |
---|
941 | </td> |
---|
942 | </tr> |
---|
943 | </table> |
---|
944 | </div> |
---|
945 | |
---|
946 | <div class="loading" id="loading" style="display: none;"><table><tr><td><img src="../images/loading.gif"></td><td id="loading.msg">Please wait...</td></tr></table></div> |
---|
947 | |
---|
948 | <div class="messagecontainer error" id="errorMessage" style="display: none; width: 950px; margin-left: 20px; margin-bottom: 0px;"></div> |
---|
949 | |
---|
950 | <div id="messages" class="success" style="display: none; width: 950px; margin-left: 20px; margin-top: 20px;"></div> |
---|
951 | |
---|
952 | <table style="margin-left: 20px; margin-top: 10px; display: none;" class="navigation" id="navigation"> |
---|
953 | <tr> |
---|
954 | <td><base:button id="gocancel" title="Cancel" onclick="goRestart(false)" style="display: none;"/></td> |
---|
955 | <td><base:button id="gonext" title="Next" image="<%=home+"/images/gonext.png"%>" onclick="goNext(true)"/></td> |
---|
956 | <td><base:button id="goregister" title="Register" image="<%=home+"/images/import.png"%>" onclick="goRegister()" style="display: none;"/></td> |
---|
957 | <td><base:button id="gorestart" title="Restart" image="<%=home+"/images/goback.png"%>" onclick="goRestart(true)" style="display: none;"/></td> |
---|
958 | <td id="gonext.message" class="message"></td> |
---|
959 | </tr> |
---|
960 | </table> |
---|
961 | |
---|
962 | </form> |
---|
963 | </div> |
---|
964 | |
---|
965 | </base:body> |
---|
966 | </base:page> |
---|
967 | <% |
---|
968 | } |
---|
969 | finally |
---|
970 | { |
---|
971 | if (dc != null) dc.close(); |
---|
972 | } |
---|
973 | %> |
---|